The invention discloses a defect detecting method based on gradient multiple threshold value optimization. Firstly, an optimization threshold value is calculated through a simplified mean value clustering algorithm; next, statistic is performed on 100 modules in each sample gradient image through a normal distribution model, and a dynamic threshold is calculated and obtained; then, through partitioning processing on the sample images, based on a statistical method, a pixel maximum value and a pixel difference maximum value are extracted from each module; finally, on the basis of modularization, judgment is conducted through the multiple threshold values, the output modules are obtained and combined into a complete image, and median filtering is conducted on the image to obtain a defect detection result image. According to the defect detecting method based on the gradient multiple threshold value optimization, through the simplified mean value clustering algorithm, the accuracy of the algorithm is improved, and the time cost of the algorithm in the iterative process is reduced; based on statistics and the normal distribution model, edges are extracted from the gradient image, and the accuracy and the processing effect of the algorithm are remarkably increased. The defect detecting method based on the gradient multiple threshold value optimization can rapidly and accurately detect defects of wood, and the detection application range and the quality of produced wood are improved.