Abstract:Adaptive histogram equalization with limited contrast is applied to strengthening the target feature to solve the problem of unclear targets in a complex background during crack detection of motor covers based on machine vision. A systematic dataset construction scheme is proposed by comparing Mosaic and CutMix data augmentation and combining with a variety of data enhancement techniques to address the low generalization of the model induced by the small volume of training data in the machine vision system and single background of training pictures. Besides, a weighted fusion loss function combined with adaptive multi-scale focus loss and CIoU loss is proposed to deal with the low detection rate caused by unbalanced numbers of positive and negative samples in the single class detection and small target detection of YOLOv4, and the optimal hyper parameters are obtained through experiments. Finally, the anchor box is initialized by the K-means algorithm to make the model more suitable for predicting linear targets. Results demonstrate that this method achieves an Average Precision (AP) of 95.8% for detecting crack types, which is 9.7% higher than before, and the single-sheet detection time is 48 ms, presenting the potential for engineering application.