In the process of industrial production, whether the machine can work stably is an important issue related to production efficiency and production safety. The cleaning of mechanical parts is an important factor affecting the stable operation of mechanical equipment, so the cleaning of mechanical parts is one of the important manufacturing links before assembly and manufacturing. The important value of the application of image recognition technology in the quality inspection of mechanical parts is briefly analyzed, and then the common problems in the quality inspection of mechanical parts are studied, the relevant measures of the application of image recognition technology in the quality inspection of mechanical parts are discussed, and finally the case analysis of the quality inspection of mechanical parts is carried out. The main purpose is to rationally use image recognition technology to complete the quality inspection of mechanical parts, so as to improve the overall level of production automation and give full play to the maximum role of this technology. At present, a variety of mechanical parts classification methods based on deep learning are studied. According to the demand of industrial machine parts, the corresponding machine parts data set is created. According to the production requirements, the SPP structure in the traditional YOLOV5 network is improved, and a new SPC structure is proposed: The YOLOv5 network with SPC structure is characterized by no pooling layer, which improves the accuracy and recall rate compared with the traditional YOLOv5 network. Secondly, the control method of robot grasping mechanical parts is studied. Using the camera to capture the image and the upper computer to calculate the mechanical parts under the camera coordinate system; Through camera calibration and hand-eye calibration, the transformation relationship between the grasping coordinates of mechanical parts in the camera coordinate system and the grasping coordinates of mechanical parts in the robot base coordinate system is obtained. The grasping coordinates and part type information of the mechanical parts in the robot base coordinate system are transmitted from the host computer to the robot through Modbus/TCP communication protocol.