CN-121999271-A - Visual detection method, visual detection device, computer equipment and storage medium
Abstract
The application discloses a visual detection method, a visual detection device, computer equipment and a storage medium, which effectively improve image quality through pretreatment steps such as illumination compensation, denoising, background suppression and the like, further amplify local gray scale difference of a potential target area through contrast enhancement, introduce a pretrained convolutional neural network, adopt a YOLOv network structure and combine multi-scale feature extraction, residual enhancement and feature fusion, so that a system can simultaneously capture target visual features of different sizes and different depth levels. By using the extracted multi-level effective feature vectors for training the classification model, the system is able to develop target recognition capabilities for specific machined workpieces. In the real detection stage, the model rapidly deduces the image to be detected, and can keep higher detection precision and stability in a complex production environment, thereby meeting the industrial visual detection requirements of high efficiency, real time and high reliability.
Inventors
- ZHOU CHANGLIN
- Yin Jiehao
- CUI JIAN
- LIU JIE
Assignees
- 彩迅工业(中山)有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20251219
Claims (10)
- 1. A visual inspection method comprising: acquiring original image data shot in real time from a processing environment to obtain a first image; denoising the first image aiming at illumination change and background interference in the processing environment to obtain a second image; performing contrast enhancement on the second image to obtain a third image; Acquiring pixel distribution information of the third image, and extracting multi-layer features from the third image by adopting a pretrained convolutional neural network based on the pixel distribution information to obtain a feature vector set containing multi-vision morphological details; The feature vector set is used as a data training set, and the data training set is used for training a preset initial classification model to obtain a target detection model; and receiving a detection instruction, acquiring an image to be detected, and carrying out target detection on the image to be detected based on the target detection model to obtain a target detection result.
- 2. The visual inspection method according to claim 1, wherein the step of denoising the first image to obtain a second image with respect to the illumination change and the background disturbance in the processing environment comprises: performing illumination intensity estimation on the first image, and performing normalization processing on the image brightness based on an illumination intensity distribution result to obtain a first denoising image; separating random noise and background texture interference from the first denoising image by adopting a multi-scale filtering mode, and extracting noise characteristics; performing spatial domain smoothing on the first denoising image based on the noise characteristic to obtain a second denoising image; Performing frequency domain filtering treatment on the second denoising image to obtain a third denoising image; and carrying out pixel reconstruction and image detail correction on the third denoising image to obtain the second image.
- 3. The visual inspection method of claim 1, wherein said step of contrast enhancing said second image to obtain a third image comprises: Carrying out local brightness statistical analysis on the second image to obtain brightness distribution characteristics of the second image in different areas; Dynamically expanding the gray scale range of the second image based on the brightness distribution characteristics to obtain a first enhanced image; Performing histogram equalization processing of a local area on the first enhanced image to obtain a second enhanced image; And carrying out smooth correction and pixel coordination on the second enhanced image to obtain the third image.
- 4. The visual inspection method according to claim 1, wherein the step of obtaining pixel distribution information of the third image, extracting multi-layer features from the third image by using a pre-trained convolutional neural network based on the pixel distribution information, and obtaining a feature vector set including multi-visual morphological details, specifically comprises: performing pixel distribution statistics on the third image to generate a pixel density map for guiding the activation of the convolution layer; inputting the third image and the pixel density map into a pre-trained convolutional neural network, and adjusting an initial receptive field of the convolutional neural network according to the pixel density map to activate the convolutional neural network; After the convolutional neural network is activated, performing layer-by-layer feature extraction on the third image through a multi-scale convolutional layer, a residual error module and a feature fusion layer of the convolutional neural network to obtain an intermediate feature set containing target contour, texture and edge information; And performing feature stitching and vectorization on the intermediate feature set to form a feature vector set containing multi-vision morphological details.
- 5. The visual inspection method according to claim 4, wherein the step of extracting the layer-by-layer features of the third image through the multi-scale convolutional layer, the residual module and the feature fusion layer of the convolutional neural network to obtain an intermediate feature set including the target contour, texture and edge information specifically comprises: Sequentially inputting the third image into the multi-scale convolution layer, and extracting basic edge features and texture details of the third image through a multi-scale convolution kernel; inputting the output of the multi-scale convolution layer to the residual error module, and enhancing deep layer characteristics through a residual error connection structure to obtain primary target morphological characteristics; Performing feature response calculation of different scales on the preliminary target morphological features through the multi-scale convolution layer to obtain the outline, texture and edge structure features of targets with different sizes; Inputting the outline, texture and edge structure characteristics of the targets with different sizes into the characteristic fusion layer, and integrating and enhancing the scale characteristics through a preset spatial attention mechanism to obtain a target fusion characteristic diagram; And carrying out dimension normalization and unified coding on the target fusion feature map, and outputting the intermediate feature set containing target contour, texture and edge information.
- 6. The visual inspection method of claim 5, wherein the step of inputting the output of the multi-scale convolution layer to the residual module to enhance deep features through residual connection structure and obtain preliminary target morphological features comprises: inputting the output of the multi-scale convolution layer to a main branch and a shortcut branch of the residual error module; Overlapping the characteristics of the main branch output and the characteristics of the quick branch output element by element to obtain residual enhancement characteristics; Performing an activation function process on the residual enhancement features to further enhance deep feature expression and improve the resolvable property of multi-visual morphological details; And taking the activated residual enhancement feature as the preliminary target morphological feature, and outputting the preliminary target morphological feature.
- 7. The visual inspection method of claim 1, wherein the step of using the feature vector set as a data training set and training a preset initial classification model by using the data training set to obtain a target inspection model specifically comprises: Labeling and classifying the feature vector set according to the type of the target to be detected to form a structured data training set; Inputting the structured data training set into a preset initial classification model, and executing forward propagation and loss calculation on model parameters based on feature labels; iteratively updating parameters of the initial classification model according to the loss calculation result to improve the distinguishing capability of the model to different target features; And in the iterative updating process, performing verification set evaluation and super-parameter adjustment on the initial classification model to obtain the target detection model with stable convergence.
- 8. A visual inspection apparatus, comprising: The real-time shooting module is used for acquiring original image data shot in real time from a processing environment to obtain a first image; the denoising processing module is used for denoising the first image aiming at illumination change and background interference in the processing environment to obtain a second image; the contrast enhancement module is used for carrying out contrast enhancement on the second image to obtain a third image; The feature extraction module is used for acquiring pixel distribution information of the third image, extracting multi-layer features from the third image by adopting a pre-trained convolutional neural network based on the pixel distribution information, and obtaining a feature vector set containing multi-vision morphological details; the classification training module is used for taking the feature vector set as a data training set, and training a preset initial classification model by using the data training set to obtain a target detection model; The target detection module is used for receiving the detection instruction, acquiring an image to be detected, and carrying out target detection on the image to be detected based on the target detection model to obtain a target detection result.
- 9. A computer device comprising a memory and a processor, the memory having stored therein computer readable instructions which when executed by the processor implement the steps of the visual inspection method of any one of claims 1 to 7.
- 10. A computer readable storage medium having stored thereon computer readable instructions which when executed by a processor implement the steps of the visual inspection method according to any of claims 1 to 7.
Description
Visual detection method, visual detection device, computer equipment and storage medium Technical Field The application belongs to the technical field of vision processing, and particularly relates to a vision detection method, a vision detection device, computer equipment and a storage medium. Background Industrial vision inspection is an important support in modern manufacturing, carrying key tasks to improve product quality and productivity. Under the large background of intelligent manufacturing, the target product is accurately identified through an image analysis technology, so that the cost of manual detection can be reduced, and the stability and reliability of detection can be obviously improved. Research and application in this area is directly related to the level of intellectualization of industrial production and the core competitiveness of enterprises. However, many current visual inspection methods face significant limitations in practical applications. Traditional detection means often depend on fixed rules or preset templates, and are difficult to adapt to complex and changeable processing environments. Such limitations manifest themselves in insufficient capture capability of image features during dynamic production, especially in the face of image variations in different stations, under different light conditions, where accuracy and robustness of detection is often challenging. Taking logo detection as an example, the standard size, angle and gray scale characteristics of the logo are required to be preset in the traditional method, and when the logo rotates, zooms or is partially shielded due to positioning deviation of a workpiece on a production line, the similarity score of template matching can be greatly reduced, and detection omission or false detection is very easy to occur. Therefore, how to accurately identify the detection target from the image photographed in real time in a dynamic complex processing environment becomes a key problem to be solved in the field of industrial visual detection. Disclosure of Invention The embodiment of the application aims to provide a visual detection method, a visual detection device, computer equipment and a storage medium, so as to solve the technical problem of accurately identifying a detection target from an image shot in real time in a dynamic complex processing environment. In order to solve the technical problems, the embodiment of the application provides a visual detection method, which adopts the following technical scheme: A visual inspection method comprising: acquiring original image data shot in real time from a processing environment to obtain a first image; Denoising the first image aiming at illumination change and background interference in the processing environment to obtain a second image; contrast enhancement is carried out on the second image, and a third image is obtained; Acquiring pixel distribution information of a third image, and extracting multi-layer features from the third image by adopting a pre-trained convolutional neural network based on the pixel distribution information to obtain a feature vector set containing multi-vision morphological details; The feature vector set is used as a data training set, and the data training set is used for training a preset initial classification model to obtain a target detection model; And receiving a detection instruction, acquiring an image to be detected, and carrying out target detection on the image to be detected based on a target detection model to obtain a target detection result. In order to solve the technical problems, the embodiment of the application also provides a visual detection device, which adopts the following technical scheme: a visual inspection apparatus comprising: The real-time shooting module is used for acquiring original image data shot in real time from a processing environment to obtain a first image; The denoising processing module is used for denoising the first image aiming at illumination change and background interference in the processing environment to obtain a second image; The contrast enhancement module is used for enhancing the contrast of the second image to obtain a third image; the feature extraction module is used for acquiring pixel distribution information of the third image, extracting multi-layer features from the third image by adopting a pretrained convolutional neural network based on the pixel distribution information, and obtaining a feature vector set containing multi-vision morphological details; The classification training module is used for taking the feature vector set as a data training set, and training a preset initial classification model by using the data training set to obtain a target detection model; the target detection module is used for receiving the detection instruction, acquiring an image to be detected, and carrying out target detection on the image to be detected based on the target detection model t