When starting yolov5, it will occupy the entire desktop because the pixels are too large, which greatly affects the use and operation. We can modify the pixel size of the recognition window through the resize function in opencv, which makes the operation much more convenient.
In the original code
By modifying (500, 320) in cv2.resizeWindow(str( P ), 500, 320), the size of the recognition window cannot be controlled .
Here, we replace cv2.resizeWindow(str( P ),500,320) with
im0=cv2.resize(im0,(480,480),interpolation=cv2.INTER_CUBIC)
The length and width of the window can be adjusted by modifying (480, 480).