How it works...
In the post_process() function, all bounding boxes (returned by the model as output) were scanned through, subsequently discarding the ones with low confidence scores. The detected object's class label was the one corresponding to the highest probability score. The non-maximum suppression algorithm was run to prune overlapping/redundant bounding boxes.
The opencv-python function, cv2.dnn.readNetFromDarknet(), was used to read the pretrained Darknet model, using the paths to the provided .cfg file with a text description of the network architecture and the .weights file with a pretrained network as parameters.
The cv2.dnn.blobFromImage() function was used to create a 4D blob (the format in which the deep learning model expects ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access