'True positive, False positive, False Negative calculation data frame python
I have trained an object detection network. I have a ground truth annotation CSV in the format,
filename, height, width, xmin, ymin, xmax, ymax, class. When I score an input image, I get the output CSV in this format: filename, xmin, ymin, xmax, ymax, class, confidence.
I need to merge these data frames considering the IoU. SO basically the output dataframe should contain,
- The ground truth and its corresponding prediction along with
IoUvalue if a match is found - The ground truth values and Nan Prediction values if
IoUmatch was not found - Nan ground truth values and prediction values if
IoUmatch was not found.
This will be an intermediate step for calculating Precision and recall values.
I am just adding a very small sample dataframe as an example here, which tests for these conditions.
sample prediction:
filename xmin ymin xmax ymax class confidence
0 dummyfile.jpg 4060 2060 4214 2242 DR 0.999985
1 dummyfile.jpg 3599 1282 3732 1456 DR 0.999900
sample ground truth:
filename width height class xmin xmax ymin ymax
0 dummyfile.jpg 7201 5400 DR 3598 3728 1279 1451
1 dummyfile.jpg 7201 5400 DR 3916 4038 2186 2274
Expected final output:
I am adding my current approach as an answer. Is there any better way to achieve this? The data can be pretty large.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

