The invention discloses an automatic
welding and defect detection method based on self-learning. The method provided by the invention comprises the steps that 1 knowledge-based coarse
welding spot positioning is used, and the optimal
welding path is planned to provide a vision
system and a
robotic arm with a running direction; 2 fine positioning of welding spots is carried out based on
machine vision, and the types of welding spots are judged; the
robotic arm is accurately guided to find the location of welding spots, so as to implement targeted automatic welding; and 3 welding spot defect detection based on online deep
reinforcement learning is used to automatically detect welding spot defects and determine the type, so as to provide basis and guidance for secondary repair welding at thesame
station. According to the invention, a path planning
algorithm is used to optimize the welding path of a camera and the
robotic arm to improve the production efficiency; a deep neural network which fuses multi-layer features is used to facilitate the detection of many
small target scenes with welding spots; for a
single type of target, the weight of coordinate loss is improved, and the positioning accuracy is improved; and threshold filtering is carried out on the results, which filters out interference targets, and improves the recognition accuracy.