| Pseudocode for YOLOv5 Detect Part (Important Steps) |
| Loading system libraries, setting the system environment. Input: The CWD picture of Mixed signals. Step 1:The size of the zoom image is [640 640] Step 2: Conf_value = 0.3 ## Boxes whose confidence is higher than 30% will be reserved. Step 3: Iou_value = 0.4 ## IOU boxes whose value is higher than this value can be reserved. Step 4: max_det = 10; ## Maximum number of targets. This value can change depending on the testing environment. |
| Predicting part Step 1:Use blank picture (0 matrix) prediction to accelerate the prediction process.Import single-label and multi-label datasets. Step 2: im/= 255 # 0–255 to 0.0–1.0 # Normalize the image. if len(im.shape) == 3: im = im[None] ## Add the 0th dimension. Step 3: pred = model(im, augment = augment, visualize = visualize) pred = non_max_suppression(pred,conf_thres,iou_thres,classes, agnostic_nms, max_det = max_det) ##Prediction box save and NMS Step 4: if len(det): # Rescale boxes from img_size to im0 size. det [:, :4] = scale_coords(im.shape [2:], det [:, :4], im0.shape).round() # Resize the annotated bounding_box to the same size as the original image (because the original image has been scaled up and down during training) # Print results Output the predicted time for each image. The accuracy distribution is returned according to the result of each prediction, and the lowest prediction accuracy category is output. |
| Output: Mixed signal CWD image with predict box. The target category. Degree of confidence. The box position. |