The invention discloses a PCB defect detection method based on boundary segment number values, and the method comprises the following steps: S1, employing a plurality of standard images, obtaining thestandard images through an averaging method, carrying out the repeated image collection of a standard printed circuit board, and calculating to obtain a gray scale average value, and obtaining a standard printed circuit board image; s2, performing image registration on the image of the printed circuit board to be detected; s3, classifying and marking the images of the printed circuit board to bedetected by adopting a refining operation and a trimming operation; and S4, performing morphological operation on the image of the printed circuit board to be detected by adopting a morphological closed operation method so as to eliminate noise in the image, and the like. The method can replace a traditional manual visual inspection method, and achieves the purpose of saving the manufacturing costof the PCB by improving the PCB defect recognition efficiency and reducing the time consumed by a detection process.