Skip to content

Workshop 6 ‐ Object detection metrics

gcielniak edited this page Nov 4, 2024 · 8 revisions

Preliminaries

First, synchronise your fork with the main repository on GitHub (Sync fork) as some structural changes were made and new files were added. Then clone or pull the repository to your local PC and re-open it in the dev container using VSC. Rebuild the updated packages colcon build --symlink-install, and source the repository source install/setup.bash.

The Rectangle class and IoU

The tutorial repository includes a helper class called Rectangle. Familiarise yourself with the class and its methods and check out the example usage iou_example.py. Then, calculate, first by hand and then with the use of the provided class, an Intersection over Union between the two following bounding boxes (x, y, w, h): A = 10, 10, 20, 30 and B = 15, 5, 25, 30. Remember to specify the correct coordinates as Rectangle operates on corners rather than width/height. Drawing the rectangles might help you with the calculations. Compare if the manual results correspond to those obtained through your Python script. If my calculations were correct, the IoU = 0.385.

Detection metrics

Run the simulator and populate the environment with 6 red objects placed in front of the robot, with at least 3 of them overlapping, leading to errors in object detection and counting. Run the object detector node and record the topic /object_polygon using techniques discovered in Workshop 3 on data acquisition. Switch on image logging so you can record images with overlaid detections. In an image editor (e.g. a free online one like Photopea) draw manually the "correct" bounding boxes around occluded/occluding objects and note the box coordinates. Finally, write a script that will run through two lists containing all detected and annotated boxes (stored in suitable variables using Rectangle class) and calculate IoU metric between each pair of objects. As a stretch task, develop a script calculating all the metrics covered in the mini-lecture on object detection metrics.