# Rescale boxes from img_size to im0 size det 4 = scale_coordsimgshape2 det 4 im0shaperound # Print results for c in det -1unique n = de
This code rescales the bounding box coordinates of detected objects in an image from the original image size (img_size) to the current image size (im0). It then prints the number of detections for each class of object found in the image. The variable "det" contains the bounding box coordinates and class labels for each detected object, while "names" contains the names of each object class. The code uses the "scale_coords" function to rescale the coordinates, which takes as input the original image size and the current image size. The "unique" function is used to identify the different classes of objects detected, and the "sum" function is used to count the number of detections per class. Finally, the code adds the number of detections and the name of the object class to a string "s" which is printed at the end
原文地址: https://www.cveoy.top/t/topic/hfqp 著作权归作者所有。请勿转载和采集!