Search code examples
pythonobject-detection

computing precision and recall based on two list of bounding box


does anyone know, given two lists of the bounding box, one is predicted, the other is the ground truth, is there some existing python library or code I can use to compute the accuracy? There are many existing codes for first calculating the lou, and I know I can compute it on my own. But I thought there should also be some existing tools I can use to directly get the accuracy indexes so that I finish my project in a smarter way than coding by myself.

Thanks!


Solution

  • Yes there is a lot of love from sklearn.metrics

    Heres a link: http://scikit-learn.org/stable/modules/classes.html#sklearn-metrics-metrics

    Here's a basic example:

    from sklearn.metrics import accuracy_score
    pr_score = accuracy_score(y_test, y_pred)
    print(pr_score)
    

    Where y_pred is the predictions and y_test is the so called "ground truth"

    In the above link you can read and chose the evaluation metric that suits you.