How to do it...

Perform the following steps to implement object detection with a Yolo v3 pretrained model, using the opencv-python library functions:

  1. First, initialize all of the parameters (for example, thresholds for non-maximum suppression and confidence for classification) with appropriate values:
conf_threshold = 0.5 # Confidence thresholdnms_threshold = 0.4 # Non-maximum suppression thresholdwidth = 416 # Width of network's input imageheight = 416 # Height of network's input image
  1. Load the names of the object classes (there are 80 classes corresponding to the MS-COCO dataset, including a person, bicycle, car, motorbike, and airplane) from the text file provided. Create unique colors corresponding to each object class (to distinguish ...

Get Python Image Processing Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.