Product defect detection system, method and device and storage medium
Through the combination of image acquisition equipment and edge computing equipment, semantic segmentation technology is used for automated product defect detection, which solves the problem of low efficiency and accuracy of manual inspection and achieves efficient and accurate automated inspection.
Patent Information
- Application Number
- CN202410592371.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-13
- Publication Date
- 2024-08-30
AI Technical Summary
In the existing technology, product quality inspection relies on manual visual observation, resulting in low inspection efficiency and accuracy, and also leads to missed inspections and inconsistencies due to personnel fatigue and subjective factors.
Image acquisition equipment and edge computing equipment are used to automatically detect product images through semantic segmentation technology, identify defect information, realize automated defect detection, reduce labor costs, and improve inspection accuracy.
Automated defect detection is realized, inspection efficiency and accuracy are improved, detection response time is shortened, delay and network transmission costs are reduced, and data security is improved.
Smart Images

Figure CN118570128A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology applications, and in particular to a product defect detection system, method, device and storage medium. Background Art
[0002] In the current production lines, product quality inspection still relies on manual visual observation to check whether there are defects on the product surface to control product quality, which requires highly qualified inspectors to perform repetitive work for a long time.
[0003] However, inspectors are prone to fatigue when doing repetitive work for a long time, which may lead to missed inspections. At the same time, they are also affected by the inspectors' own subjective factors, resulting in inconsistent inspection and judgment standards, which in turn affects the efficiency and accuracy of product inspection. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a product defect detection system, method, device and storage medium to solve the problems of low quality inspection efficiency and accuracy in the manual quality inspection process.
[0005] In order to achieve the above objectives, the present application embodiment adopts the following technical solutions:
[0006] In a first aspect, an embodiment of the present application provides a product defect detection system, including an image acquisition device and an edge computing device;
[0007] The image acquisition device is used to acquire product images of products on the assembly line and send the product images to the edge computing device;
[0008] The edge computing device is used to perform semantic segmentation on the product image to obtain a segmented image of the product, and determine defect information of the product based on the segmented image.
[0009] In a second aspect, an embodiment of the present application provides a product defect detection method, comprising:
[0010] Collect product images of products on the assembly line;
[0011] Performing semantic segmentation on the product image to obtain a segmented image of the product;
[0012] Defect information of the product is determined based on the segmented image.
[0013] In a third aspect, an embodiment of the present application provides a product defect detection device, including:
[0014] A collection module, used to collect product images of products on the assembly line;
[0015] A detection model, used to perform semantic segmentation on the product image to obtain a segmented image of the product;
[0016] A judgment module is used to determine defect information of the product based on the segmented image.
[0017] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the method described in the second aspect.
[0018] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the method described in the second aspect.
[0019] At least one of the above-mentioned technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects: the product defect detection system provided in the embodiments of the present application includes an image acquisition device and an edge computing device. The image acquisition device can acquire product images of products on the assembly line and send them to the edge computing device for processing. After receiving the product image, the edge computing device first performs semantic segmentation to obtain a segmented image of the product, and then determines the defect information of the product based on the segmented image. Therefore, there is no need to rely on manual visual observation, and automated defect detection is achieved, thereby improving inspection efficiency and reducing labor costs. It can also avoid missed detections or inconsistencies caused by personnel fatigue or subjective factors, thereby improving inspection accuracy. At the same time, data processing is achieved at the data source or locally in the system through the edge computing device, without the need for remote servers or cloud services, which can shorten detection response time, reduce latency, reduce network transmission costs, and improve data security. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0021] Figure 1 A schematic diagram of the structure of a product defect detection system provided for one embodiment of the present application;
[0022] Figure 2 A flowchart of a product defect detection method provided for an embodiment of the present application;
[0023] Figure 3 A schematic diagram of an application scenario of a product defect detection method provided for an embodiment of the present application;
[0024] Figure 4A schematic diagram of the structure of a product defect detection device provided in one embodiment of the present application;
[0025] Figure 5 A schematic diagram of the structure of an electronic device provided for one embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0027] The terms "first", "second", etc. in this specification and claims are used to distinguish similar objects, and are not used to describe a particular order or precedence. It should be understood that the terms used in this way can be interchanged where appropriate so that the embodiments of the present application are implemented in a sequence other than those illustrated or described herein. In addition, "and / or" in this specification and claims means at least one of the connected objects, and the character " / " generally means that the objects associated with each other are in an "or" relationship.
[0028] Next, the product defect detection system, method, device and storage medium proposed in the embodiments of the present application will be described in conjunction with the accompanying drawings.
[0029] In the current production line, product quality inspection still relies on manual visual observation of product surface defects to control product quality, which requires highly qualified inspectors to perform repetitive work for a long time. However, inspectors are prone to fatigue when performing repetitive work for a long time, resulting in missed inspections. At the same time, the subjective factors of the inspectors themselves affect the standards of inspection and judgment, which in turn affects the efficiency and accuracy of product inspection.
[0030] In view of this, an embodiment of the present application provides a product defect detection system, which includes an image acquisition device and an edge computing device. The image acquisition device can acquire product images of products on the assembly line and send them to the edge computing device for processing. After receiving the product image, the edge computing device first performs semantic segmentation to obtain a segmented image of the product, and then determines the defect information of the product based on the segmented image. Therefore, there is no need to rely on manual visual observation, and automated defect detection is achieved, thereby improving inspection efficiency and reducing labor costs. It can also avoid missed detections or inconsistencies due to personnel fatigue or subjective factors, thereby improving inspection accuracy. At the same time, data processing is performed at the data source or locally in the system through the edge computing device, without the need for remote servers or cloud services, which can shorten detection response time, reduce latency, reduce network transmission costs, and improve data security.
[0031] Specifically, see Figure 1 , is a schematic diagram of the structure of a product defect detection system provided by an embodiment of the present application. Figure 1 As shown, the system includes an image acquisition device 110 and an edge computing device 120.
[0032] In an embodiment of the present application, the image acquisition device 110 is used to acquire product images of products on an assembly line and send the product images to the edge computing device 120 .
[0033] Among them, the assembly line refers to an automated assembly line in the production process of products (such as mechanical parts, food packaging, electronic equipment, etc.). The products produced are transmitted to the discharge end through the assembly line for quality inspection. As an example, the image acquisition device 110 can be installed above the discharge end of the assembly line, and when the product passes through the discharge end, the image acquisition device 110 can capture the product image of the product. Of course, the embodiment of the present application can also reasonably select the location for installing the image acquisition device 110 according to actual conditions, and the embodiment of the present application does not specifically limit this.
[0034] The product image refers to a digital image of the product, which can be a two-dimensional static image or a video stream. The image acquisition device 110 is a device that can convert the appearance of the product into a digital image, such as a video camera, a camera, a mobile phone, etc. Specifically, it can be selected according to the actual situation, and the embodiment of the present application does not specifically limit this.
[0035] In the embodiment of the present application, the image acquisition device 110 and the edge computing device 120 can be connected via USB, Ethernet, a camera-specific bus, etc. The corresponding connection method can be selected according to the actual situation, and the embodiment of the present application does not specifically limit this. After the image acquisition device 110 acquires the product image of the product, it sends the product image to the edge computing device 120 in real time for processing through the corresponding connection method.
[0036] As an optional implementation, the product defect detection system provided in the embodiment of the present application further includes a light source. The image acquisition device 110 is also used to: obtain the ambient light intensity of the current environment and the attribute information of the product;
[0037] Determine the illumination parameters of the light source based on the ambient light intensity and attribute information;
[0038] Based on the illumination parameters, the light source is controlled to irradiate light onto the product.
[0039] Among them, the product attribute information includes data such as the type and shape of the product. Products of different types or shapes may require different light sources, such as light sources of different colors and different light intensities. Irradiation parameters refer to the parameters related to controlling the light source irradiating the product, including but not limited to the light intensity, direction, wavelength, color temperature, RGB value, etc. of the light source.
[0040] The image acquisition device 110 can obtain the ambient light intensity of the current environment and the property information of the product for analysis, determine the illumination parameters suitable for the current product, and then configure the light source to ensure that the light can fully illuminate the product surface to achieve a clear imaging effect, thereby capturing images of the products on the assembly line. As an example, the image acquisition device 110 can also control the on / off state of the light source to ensure that the light is irradiated to the product at an appropriate time to capture a clear product image.
[0041] The product defect detection system provided in the embodiment of the present application also includes a light source. The image acquisition device 110 determines the illumination parameters of the light source by acquiring the current ambient light intensity and product attribute information, and controls the light source to irradiate light to the product. It can effectively cope with the changes in lighting in different environments and the requirements of different product characteristics, and can collect product images with better lighting effects in various environments, improve the imaging quality and detection accuracy of the product surface, thereby improving the robustness, flexibility, defect detection capability and reliability of the product defect detection system.
[0042] In an embodiment of the present application, the edge computing device 120 is used to perform semantic segmentation on the product image, obtain a segmented image of the product, and determine defect information of the product based on the segmented image.
[0043] Among them, semantic segmentation is to assign each pixel in the image to a predefined category, and then to classify the various parts of the product image, such as the product itself, the background, and defects on the surface of the product. The segmented image refers to the segmentation result obtained after the product image is processed by semantic segmentation, which can show that the various parts of the product image are divided into different areas or categories. Defect information refers to the relevant data about the defects or problems of the product extracted from the segmented image. As an example, the defect information may include information such as the location, type, size, severity, and other features related to the defect of the identified defect. The edge computing device 120 refers to a computing device used to process and analyze data at the data source or locally in the system.
[0044] An embodiment of the present application provides a product defect detection system, which includes an image acquisition device 110 and an edge computing device 120. The image acquisition device 110 can acquire product images of products on the assembly line and send them to the edge computing device 120 for processing. After receiving the product image, the edge computing device 120 first performs semantic segmentation to obtain a segmented image of the product, and then determines the defect information of the product based on the segmented image. Therefore, there is no need to rely on manual visual observation, and automatic defect detection is achieved, thereby improving inspection efficiency and reducing labor costs. It can also avoid missed inspections or inconsistencies caused by personnel fatigue or subjective factors, thereby improving inspection accuracy. At the same time, data processing is achieved at the data source or locally in the system through the edge computing device 120, without the need for remote servers or cloud services, which can shorten detection response time, reduce latency, reduce network transmission costs, and improve data security.
[0045] As an optional implementation, the edge computing device 120 can be used to perform semantic segmentation on the product image based on a semantic segmentation model to obtain a segmented image of the product.
[0046] Among them, the semantic segmentation model is a deep learning model. The model learns the semantic information of different regions in the sample image through training and maps it to the corresponding categories, thereby realizing the semantic segmentation of the product image. It should be understood that the semantic segmentation technology can adapt to products of various shapes and sizes, so that the versatility of the system is enhanced. Common semantic segmentation models include: Fully Convolutional Network (FCN), U-Net, SegNet, DeepLab, BiSeNet, etc.
[0047] As an example, you can also use threshold-based segmentation, edge detection, region growing algorithms, etc. to perform semantic segmentation on product images to obtain segmented images of the product, but such methods are limited by the manual extraction and processing of image features and are difficult to adapt to complex scenes and object changes. Therefore, this application takes the semantic segmentation model as a priority implementation embodiment, which can learn higher-level feature representations, such as spatial features, contextual features, etc., so as to more accurately perform semantic segmentation tasks in various scenarios, especially to achieve pixel-level understanding and segmentation of product images, thereby accurately detecting defective areas of the product, with higher accuracy and robustness, and can adapt to product images of different shapes, sizes and backgrounds, thereby improving the efficiency and reliability of defect detection.
[0048] The embodiment of the present application uses the edge computing device 120 to perform semantic segmentation on the product image based on the semantic segmentation model to obtain a segmented image of the product. The image can accurately identify different parts and segment them into regions with semantic information, thereby accurately locating and identifying defects on the surface of the product, making the detection results more accurate and reliable. In addition, the semantic segmentation model can also effectively process complex product surfaces and images under various environmental conditions, improve the applicability and robustness of the system, and thus improve the performance and efficiency of the product defect detection system.
[0049] Specifically, as an optional implementation, the semantic segmentation model may obtain a segmented image of the product by performing the following steps: extracting spatial features and context features of the product image;
[0050] The spatial features and the context features are fused to obtain fused features;
[0051] Based on the fusion features, the pixels of the product image are classified to obtain the categories of the pixels;
[0052] Based on the pixel categories, the product image is segmented to obtain a segmented image.
[0053] Among them, spatial features refer to the positional relationship and spatial structure information between pixels in the image, which may include pixel coordinates, relative distance, distribution of surrounding pixels, etc., and are used to describe the spatial layout between different regions or objects in the image, which can help the model understand the shape, boundary and structure of the object, so as to more accurately perform pixel-level classification and improve the accuracy and precision of segmentation. Contextual features refer to the surrounding environment or contextual information of pixels in the image, which may include pixel values, textures, color distributions, etc. around the pixels, and are used to provide the semantic and contextual background of the pixels in the entire image, and can provide the contextual information of the pixels, helping the model understand the correlation and semantic coherence between different regions in the image, so as to better segment semantic regions with consistency and continuity. Fusion features refer to the feature representation obtained after fusion processing, which contains the comprehensive information of spatial features and contextual features, and can better describe the semantic and structural information in the image, providing a more accurate basis for subsequent pixel classification and image segmentation.
[0054] Among them, fusion processing refers to combining the extracted spatial features and contextual features together to obtain a more comprehensive and comprehensive feature representation. Fusion processing can use various methods, such as splicing, weighted summation, convolution operations, etc., to fuse different feature information into a unified feature vector or feature map. Among them, weighted summation can adjust the weights according to the importance of different features, so that the model can focus on the features that are most beneficial to the task, while reducing the sensitivity to irrelevant features, thereby improving the generalization ability and performance of the model. As an example, when the spatial features and contextual features are fused as mentioned above, the semantic segmentation model must first determine the weights of each feature, then multiply each feature by the corresponding weight, and then add all the weighted features to obtain the fused features, where the weights of each feature can be preset, cross-validated, or learned during the model training process.
[0055] As an example, when the spatial features and contextual features are fused, the ambiguous segmentation model may also include fusing the color features, texture features, morphological features, etc. of the product image to obtain fused features. However, spatial features and contextual features can provide rich image structure and semantic information, which helps the model to understand and analyze the image more comprehensively and accurately. Spatial features can capture the shape and structural information of objects, and can use the contextual information of the image to optimize the segmentation results. Therefore, in the fusion process, the semantic segmentation model in the embodiment of the present application can focus mainly on spatial features and contextual features, supplemented by other image features, and obtain fused features through fusion processing. Then, the semantic segmentation model is based on the obtained fused features for reasoning and analysis to obtain the segmentation results, which can make the model better adapt to the needs of semantic segmentation tasks and improve the accuracy and robustness of segmentation.
[0056] In the embodiment of the present application, when classifying pixels of a product image based on fusion features, the semantic segmentation model can input the feature vector of each pixel and output the probability distribution of the pixel belonging to different categories. The softmax function is usually used to normalize these probabilities to obtain the most likely category of each pixel. As an example, the categories of pixels can include background, product itself, defect, etc.
[0057] In an embodiment of the present application, the semantic segmentation model is based on the category of pixels, and the product image can be segmented by using pixel-level labeling or segmentation algorithms, such as graph cuts, conditional random fields, etc. According to the category information of the pixels, adjacent pixels of the same category in the image are combined into regions with similar semantics, thereby obtaining the final segmented image.
[0058] The semantic segmentation model in the embodiment of the present application helps to capture the location information and surrounding environment of pixels in the image, and form a more comprehensive and comprehensive feature representation by extracting and fusing spatial features and context features, which can more accurately understand and segment product images, thereby achieving accurate defect detection. Then, based on the fused features, the pixels are classified to determine the category to which each pixel in the product image belongs, thereby achieving semantic understanding of the image. Finally, based on the category of the pixels, the image is segmented to obtain the final segmented image, which can clearly show the different parts of the product and possible defective areas. Therefore, by extracting and fusing multiple features and performing segmentation based on fused features, high-precision product image segmentation can be achieved, providing reliable technical support for automated defect detection.
[0059] As an optional implementation, when the segmented image includes pixels of multiple categories, the edge computing device 120 may be used to: connect pixels in the segmented image that are classified as defects and are adjacent to each other to obtain at least one candidate region;
[0060] Determine the area and shape of at least one candidate region based on the number of pixels included in the at least one candidate region;
[0061] Determine at least one candidate region whose area satisfies a preset screening condition as a target defect region;
[0062] Determine the defect information of the product based on the area and shape of the target defect area.
[0063] Among them, the candidate area refers to the area that is identified as a possible defect in the segmented image. The edge computing device 120 forms a connected area by connecting the adjacent pixels that are classified as defects in the segmented image, and determines the area and shape of each connected area by counting the number of pixels in each connected area. As an example, when the edge computing device 120 determines the area and shape of the candidate area based on the number of pixels contained in the candidate area, the area of one pixel can be preset as the unit area, and the number of pixels in the target candidate area can be multiplied by the unit area to obtain the area of the target candidate area, and the shape of the target candidate area can be determined by analyzing the position coordinates of the pixels at the edge or boundary of the target candidate area, such as using a bounding box or shape fitting algorithm to approximate the shape of the target candidate area.
[0064] After determining the area and shape of each candidate area, the edge computing device 120 selects the area in the candidate area that meets the condition based on the preset screening condition, and uses it as the target defect area. As an example, the preset screening condition can be a preset minimum area. If the area of the candidate area is greater than or equal to the minimum area, it is determined that the candidate area meets the screening condition and the candidate area is determined as the target defect area; if the area of the candidate area is less than the minimum area, the candidate area does not meet the screening condition.
[0065] Among them, the target defect area is the final defect area determined after screening among all candidate areas. When the edge computing device 120 determines the defect information of the product based on the area and shape of the target defect area, specifically, it can evaluate the severity of the defect according to the area size of the defect area, and further describe the type of defect, such as scratches, stains, cracks, bumps, etc., and the severity level of the defect with the help of shape information. It can also locate the location of the defect according to the position coordinates of the pixels. For example: if the shape of the target defect area is a scratch, the edge pixels of the target defect area are extracted, and based on the number of edge pixels, the length of the target defect area is calculated to obtain the length of the scratch. Furthermore, if the scratch length is shorter, the corresponding degree of defect is smaller; if the scratch length is longer, the corresponding degree of defect is larger.
[0066] As an example, the edge computing device 120 can also generate a defect detection report or trigger subsequent processing steps, such as automated repair or manual intervention, based on the defect information of the product. The content of the defect detection report can be that the product has no defects; or the product has defects, with detailed information of the defects, such as defect type, defect severity level, defect location, etc. Then, the edge computing device 120 sends the generated defect detection information to the convergence platform for reference by quality inspectors to control the quality of the product.
[0067] In the embodiment of the present application, the edge computing device 120 identifies multiple categories of pixels in the segmented image, determines the candidate area by connecting adjacent defective pixels, and determines the target defective area based on preset screening conditions, and finally determines the defect information of the product. It can effectively identify the defective area in the segmented image, determine the location, size and type of the defect according to characteristics such as area and shape, provide an accurate basis for subsequent defect processing and analysis, and can also realize automated defect detection and identification, improve the efficiency and accuracy of product quality control, and thus provide reliable technical support for quality management in the production process.
[0068] As an optional implementation, the edge computing device 120 in the embodiment of the present application is used to: intercept a first image area located within the image acquisition frame from the product image;
[0069] Performing target detection on the first image area based on a target detection model to obtain location information of the product;
[0070] Based on the position information of the product, determining a second image area containing the product from the first image area;
[0071] Perform semantic segmentation on the second image region to obtain a segmented image of the product.
[0072] The image acquisition frame refers to a frame or boundary used to define an area during the image acquisition process, and is usually used to indicate a specific image area that needs to be processed or analyzed. As an example, the edge computing device 120 traverses each frame of the product image sent by the image acquisition device 110 through the image acquisition frame, limits the area of the currently traversed image, obtains a first image area, performs target detection on the first image area through the target detection model, and determines whether the first image area contains a product. If so, obtain the location information of the product in the first image area; if not, continue to process the next frame of the image to obtain the first image area. As an example, before performing target detection on the first image area through the target detection model, the edge computing device 120 can also scale the first image area by a large proportion to reduce the amount of target detection calculation to meet the edge computing device 120's requirements for lightweight and efficient calculations. Subsequently, the location information output by the target detection model is multiplied by the corresponding scaling factor to obtain the location information of the product in the first image area.
[0073] In an embodiment of the present application, when the above-mentioned edge computing device 120 determines the second image area containing the product from the first image area based on the location information of the product, it includes directly using the first image area as the second image area; or, according to the obtained product location information, cutting out a smaller image area containing the product from the first image area, such as the minimum circumscribed rectangular frame of the product, to obtain the second image area.
[0074] The first image area refers to an area captured from the product image and located within the image acquisition frame. It is an initial image area used for target detection and further processing and is obtained by locating and capturing the portion that fits the acquisition frame in the entire product image.
[0075] Among them, the target detection model is a deep learning model used to locate and identify specific target objects or object categories in an image. The characteristics of the target object can be learned through training, so that the position of the target object can be detected in a new image. Common target detection models include two-stage detection models (Two-Stage Detectors), such as Faster R-CNN, R-FCN (Region-based Fully Convolutional Networks), Mask R-CNN, etc.; and also include single-stage detection models (One-Stage Detectors), such as YOLO (You Only Look Once), SSD (Single Shot Multibox Detector), RetinaNet, etc. Among them, the single-stage detection model has a faster reasoning speed and less resource consumption, and can adapt to the edge computing device 120 for the light and efficient computing requirements. Therefore, this application takes the single-stage detection model as a preferred embodiment. Of course, in practical applications, a suitable model can also be selected according to actual business needs, and the embodiment of this application does not make specific restrictions on this. In addition, single-stage detection models, such as YOLO and SSD, have efficient network structures and can achieve real-time target detection to meet the needs of real-time defect detection of products on the assembly line.
[0076] Among them, the position information refers to the position coordinates or position description of the target object in the image, which is usually used to indicate the relative position or absolute position of the target object in the image. The position information may include the coordinates of the object, the position and size of the bounding box of the object, etc. When the edge computing device 120 performs target detection on the first image area based on the target detection model, the first image area can be input into the target detection model, and the model will identify the target object in the image and return its position information, such as the coordinates of the object or the position and size of the bounding box of the object.
[0077] Based on the location information of the product, the edge computing device 120 can determine a second image area containing the product in the first image area, which involves cutting out an area that more accurately contains the product in the first image area based on the location information of the target object or the position and size of the bounding box of the object, so as to perform subsequent semantic segmentation or other processing.
[0078] In the embodiment of the present application, the edge computing device 120 uses an image acquisition frame to capture a first image area from the product image, and then identifies the location information of the product through a target detection model, thereby determining a second image area containing the product, and performing semantic segmentation on it to obtain a segmented image of the product, so that the system can automatically identify and locate the position of the product in the image, and then accurately capture the area containing the product for further processing, such as defect detection or analysis. During subsequent semantic segmentation, there is no need to perform segmentation calculations on each frame of the video stream sent by the image acquisition device 110, which greatly reduces the amount of segmentation calculations. The high sensitivity of the segmentation method is retained to improve the defect detection rate, and pixel-level detection results are obtained. By combining target detection and semantic segmentation technology, efficient and accurate product detection and segmentation are achieved, providing reliable technical support for production quality control, thereby improving production efficiency and product quality.
[0079] As another optional implementation, the edge computing device 120 is further used to: before performing target detection on the first image area based on the target detection model, obtain a training data set, the training data set including multiple sample product images and product location information in each sample product image, the multiple sample product images are obtained by photographing sample products on the assembly line under different environmental factors, and the environmental factors include at least one of the following factors: ambient light intensity, shooting position of the image acquisition device, and shooting angle of the image acquisition device;
[0080] Based on the training data set, the target detection model is trained.
[0081] The training data set refers to a data set used to train the model, which includes input data, i.e., sample images, and corresponding label information, i.e., product location information in each sample product image. The training data set is used to train the object detection model so that the model can accurately detect the product location in the first image area.
[0082] Among them, the sample images refer to the image samples in the training data set, including the images of the sample products. In order to adapt to the interference caused by different light conditions, products, placement positions, and camera angles, product images are obtained by taking sample products on the assembly line under different environmental factors to increase the richness of the training data set. For example: product images of sample products under strong light, normal light, weak light, etc. under different ambient light intensities. At the same time, images of various non-product background objects on the flow are taken by the image acquisition device 110 as negative samples and added to the training data set to increase the richness of the training data set, so that the target detection obtained by training has better robustness.
[0083] Among them, the ambient light intensity refers to the intensity or brightness of the light in the environment when the image is captured. The shooting position refers to the relative position between the image acquisition device and the assembly line. The shooting angle refers to the angle between the camera or image acquisition device and the object being photographed when the image is captured.
[0084] As an example, the above-mentioned training of the target detection model based on the training data set may include the following steps: preprocessing the images in the training data set, including resizing, standardization, enhancement and other operations to ensure the quality and consistency of the input data; selecting a target detection model structure suitable for the task, such as Faster R-CNN, YOLO, SSD, etc.; defining a loss function suitable for the target detection task, usually including position loss (such as bounding box regression loss) and classification loss (such as cross entropy loss); updating the model parameters through the back propagation algorithm and optimizer (such as stochastic gradient descent) to minimize the loss function value of the model on the training data; using methods such as validation sets or cross-validation to evaluate and tune the model during the training process to ensure the generalization ability of the model on unseen data; saving the parameters and status of the model during the training process, and applying the trained model for prediction and detection in subsequent target detection tasks.
[0085] It should be understood that the sample images in the above training data set can be obtained by collecting sample products on the production line through the image acquisition device 110.
[0086] The edge computing device 120 of the embodiment of the present application obtains a training data set, and the training data set includes multiple sample product images and product location information in each sample product image. The sample images include product images taken under different environmental factors. The target detection model is trained based on the obtained training data set, so that the model can accurately detect the product position in the image under various environments. The training data set covers factors such as ambient light intensity, the shooting position and shooting angle of the image acquisition device. Under different light intensity conditions, the brightness and contrast of the image may change. Different shooting positions may cause changes in features such as the size, shape and projection of the object in the image. Different shooting angles may cause changes in the projection shape and appearance of the object in the image, thereby increasing the richness of the training data set, making the target detection more accurate and robust. H can also improve the adaptability and generalization ability of the target detection model, so that it can effectively perform target detection in different environments, thereby improving the detection accuracy and reliability of the system.
[0087] See also Figure 2 , is a flow chart of a product defect detection method provided by an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:
[0088] S202, collecting product images of products on the assembly line.
[0089] S204: Perform semantic segmentation on the product image to obtain a segmented image of the product.
[0090] S206: Determine defect information of the product based on the segmented image.
[0091] Optionally, performing semantic segmentation on the product image to obtain a segmented image of the product may include the following steps: performing semantic segmentation on the product image based on a semantic segmentation model to obtain a segmented image of the product.
[0092] Optionally, the performing semantic segmentation on the product image based on the semantic segmentation model to obtain the segmented image of the product may include the following steps: extracting spatial features and context features of the product image;
[0093] Fusing the spatial feature and the context feature to obtain a fused feature;
[0094] Based on the fusion features, pixels of the product image are classified to obtain categories of the pixels;
[0095] The product image is segmented based on the categories of the pixels to obtain the segmented image.
[0096] Optionally, in the case where the segmented image includes pixels of multiple categories, determining the defect information of the product based on the segmented image may include the following steps: connecting adjacent pixels in the segmented image that are classified as defects to obtain at least one candidate region;
[0097] Determining the area and shape of the at least one candidate region based on the number of pixels included in the at least one candidate region;
[0098] Determine a candidate region whose area satisfies a preset screening condition among the at least one candidate region as a target defect region;
[0099] Defect information of the product is determined based on the area and shape of the target defect area.
[0100] Optionally, the performing semantic segmentation on the product image to obtain the segmented image of the product may include the following steps: intercepting a first image area located within an image acquisition frame from the product image;
[0101] Performing target detection on the first image area based on a target detection model to obtain location information of the product;
[0102] Based on the position information of the product, determining a second image area including the product from the first image area;
[0103] Perform semantic segmentation on the second image region to obtain a segmented image of the product.
[0104] Optionally, before performing target detection on the first image area based on the target detection model, the method may further include: obtaining a training data set, the training data set including a plurality of sample product images and product location information in each sample product image, the plurality of sample product images being obtained by photographing sample products on the assembly line under different environmental factors, the environmental factors including at least one of the following factors: ambient light intensity, the shooting position of the image acquisition device, and the shooting angle of the image acquisition device;
[0105] The target detection model is trained based on the training data set.
[0106] Optionally, before collecting the product images of the products on the assembly line, the method may further include: obtaining the ambient light intensity of the current environment and the attribute information of the product;
[0107] Determining illumination parameters of a light source based on the ambient light intensity and the attribute information;
[0108] Based on the illumination parameters, the light source is controlled to illuminate the product.
[0109] The following is an actual application scenario to illustrate the product defect detection method provided in the embodiment of the present application, which should not be understood as a limitation on the method of the embodiment of the present application. Figure 3 , is a schematic diagram of an application scenario of a product defect detection method provided by an embodiment of the present application. Figure 3As shown in the figure, the application scenario includes: product defect detection system, assembly line and convergence platform. The product defect detection system includes edge computing devices, cameras (i.e., image acquisition devices) and light sources. The edge computing devices and cameras can be connected via USB, Ethernet, bus, etc. Products that need quality inspection are transported on the assembly line. The convergence platform is a management platform used to manage the inspection results of the product defect detection system and help quality inspectors control product quality. In this example, by installing the camera at the discharge end of the assembly line, when the product is transported to the discharge end, the camera can timely collect the video stream data of the product (i.e., product image) and send it to the edge computing device for processing in real time to complete the defect detection of the product surface. At the same time, the light source can be configured to fill the surface of the product under test so that the light fully covers the surface to clarify the surface defect characteristics of the product, so as to meet the visual recognition of the product under the dark light conditions of the production line. The processing process of the edge computing device is as follows: the edge computing device pulls pictures from the video stream, scales each frame of the picture, and then performs target detection through a single-stage detection model to determine whether the product is contained. If it is contained, the product's location information is obtained and multiplied by the corresponding scaling factor to obtain the product's location information in the original image; if it is not contained, continue to perform target detection on the next frame of the picture; then, based on the obtained location information, the image area containing the product is obtained and semantic segmentation is performed through a semantic segmentation model to obtain a segmented image of the product; then, the obtained segmented image is post-processed to delete defect areas with smaller areas to obtain the target defect area. Finally, based on the number and shape of pixels in the target defect area, the type, degree of defect, location and other information of the product surface defect are determined and sent to the aggregation platform for reference by quality inspectors.
[0110] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0111] With the above Figure 2 Corresponding to the product defect detection method shown, the present application embodiment also proposes a product defect detection device. Figure 4 , is a structural diagram of a product defect detection device provided in an embodiment of the present application, the device 400 includes: an acquisition module 410, a detection model 420, and a judgment model 430.
[0112] The acquisition module 410 is used to acquire product images of products on the assembly line.
[0113] The detection module 420 is used to perform semantic segmentation on the product image to obtain a segmented image of the product;
[0114] The judgment module 430 is used to determine the defect information of the product based on the segmented image.
[0115] Optionally, when performing semantic segmentation on the product image to obtain the segmented image of the product, the detection module 420 may execute the following steps: performing semantic segmentation on the product image based on a semantic segmentation model to obtain the segmented image of the product.
[0116] Optionally, when the detection module 420 performs semantic segmentation on the product image based on the semantic segmentation model to obtain the segmented image of the product, the following steps may be performed: extracting spatial features and context features of the product image;
[0117] Fusing the spatial feature and the context feature to obtain a fused feature;
[0118] Based on the fusion features, pixels of the product image are classified to obtain categories of the pixels;
[0119] The product image is segmented based on the categories of the pixels to obtain the segmented image.
[0120] Optionally, in the case where the segmented image includes pixels of multiple categories, the judgment module 430 may perform the following steps when determining the defect information of the product based on the segmented image: connecting adjacent pixels of the defect category in the segmented image to obtain at least one candidate region;
[0121] Determining the area and shape of the at least one candidate region based on the number of pixels included in the at least one candidate region;
[0122] Determine a candidate region whose area satisfies a preset screening condition among the at least one candidate region as a target defect region;
[0123] Defect information of the product is determined based on the area and shape of the target defect area.
[0124] Optionally, when performing semantic segmentation on the product image to obtain the segmented image of the product, the detection module 420 may perform the following steps: intercepting a first image area located within an image acquisition frame from the product image;
[0125] Performing target detection on the first image area based on a target detection model to obtain location information of the product;
[0126] Based on the position information of the product, determining a second image area including the product from the first image area;
[0127] Perform semantic segmentation on the second image region to obtain a segmented image of the product.
[0128] Optionally, the apparatus 400 may further include a training module;
[0129] The training module is used to perform the following steps before the detection module 420 performs target detection on the first image area based on the target detection model: obtaining a training data set, the training data set including a plurality of sample product images and product location information in each sample product image, the plurality of sample product images are obtained by photographing sample products on the assembly line under different environmental factors, the environmental factors including at least one of the following factors: ambient light intensity, the shooting position of the image acquisition device, and the shooting angle of the image acquisition device;
[0130] The target detection model is trained based on the training data set.
[0131] Optionally, the device 400 may further include a control module;
[0132] The control module is used to perform the following steps before the acquisition module 410 acquires the product image of the product on the assembly line: obtaining the ambient light intensity of the current environment and the attribute information of the product;
[0133] Determining illumination parameters of a light source based on the ambient light intensity and the attribute information;
[0134] Based on the illumination parameters, the light source is controlled to illuminate the product.
[0135] Obviously, the product defect detection device provided in the embodiment of the present application can be used as Figure 2 The execution subject of the product defect detection method shown is, for example Figure 2 In the product defect detection method shown in FIG. 1 , step S202 may be performed by Figure 4 The acquisition module 410 in the device 400 shown in FIG. 4 is executed, and step S204 can be performed by Figure 4 The detection module 420 in the device 400 shown in FIG. 4 is executed, and step S206 can be performed by Figure 4 The decision module 430 in the device 400 shown is executed.
[0136] According to another embodiment of the present application, Figure 4The various units in the product defect detection device shown can be separately or completely combined into one or several other units to constitute, or one (some) of the units can be further divided into multiple functionally smaller units to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the function of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the product defect detection device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0137] According to another embodiment of the present application, the program can be executed on a general computing device such as a computer including a central processing unit (CPU), a random access memory (RAM), a read-only memory (ROM), and other processing elements and storage elements. Figure 2 A computer program (including program code) for each step involved in the corresponding method shown in FIG. Figure 4 The product defect detection device shown in and the product defect detection method of the embodiment of the present application are implemented. The computer program can be recorded on, for example, a computer-readable storage medium, and transferred to an electronic device through the computer-readable storage medium and run therein.
[0138] Figure 5 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 5 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0139] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0140] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0141] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a data processing device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0142] Collect product images of products on the assembly line;
[0143] Performing semantic segmentation on the product image to obtain a segmented image of the product;
[0144] Defect information of the product is determined based on the segmented image.
[0145] The above application Figure 4The method performed by the product defect detection device disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0146] The electronic device may also perform Figure 2 The method is implemented in a product defect detection device. Figure 2 , Figure 4 The functions of the illustrated embodiment will not be described in detail in the embodiments of the present application.
[0147] Of course, in addition to software implementation methods, the electronic device of the present application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0148] The embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by a portable electronic device including a plurality of application programs, enable the portable electronic device to execute Figure 2 The method of the embodiment shown is specifically used to perform the following operations:
[0149] Collect product images of products on the assembly line;
[0150] Performing semantic segmentation on the product image to obtain a segmented image of the product;
[0151] Defect information of the product is determined based on the segmented image.
[0152] In short, the above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
[0153] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0154] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0155] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0156] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
Claims
1. A product defect detection system, characterized in that: Including image acquisition equipment and edge computing equipment; The image acquisition device is used to acquire product images of products on the assembly line and send the product images to the edge computing device; The edge computing device is used to perform semantic segmentation on the product image to obtain a segmented image of the product, and determine defect information of the product based on the segmented image.
2. The system according to claim 1, characterized in that The edge computing device is used to: Based on the semantic segmentation model, semantic segmentation is performed on the product image to obtain a segmented image of the product.
3. The system according to claim 2, characterized in that The semantic segmentation model obtains the segmented image of the product by performing the following steps: Extracting spatial features and contextual features of the product image; Fusing the spatial feature and the context feature to obtain a fused feature; Based on the fusion features, pixels of the product image are classified to obtain categories of the pixels; The product image is segmented based on the categories of the pixels to obtain the segmented image.
4. The system according to claim 1, characterized in that The segmented image includes pixels of multiple categories; The edge computing device is used to: Connecting adjacent pixels in the segmented image that are classified as defects to obtain at least one candidate region; Determining the area and shape of the at least one candidate region based on the number of pixels included in the at least one candidate region; Determine a candidate region whose area satisfies a preset screening condition among the at least one candidate region as a target defect region; Defect information of the product is determined based on the area and shape of the target defect area.
5. The system according to claim 1, characterized in that The edge computing device is used to: intercepting a first image area located within an image acquisition frame from the product image; Performing target detection on the first image area based on a target detection model to obtain location information of the product; Based on the position information of the product, determining a second image area including the product from the first image area; Perform semantic segmentation on the second image region to obtain a segmented image of the product.
6. The system according to claim 5, characterized in that The edge computing device is also used for: Before performing target detection on the first image area based on the target detection model, a training data set is obtained, wherein the training data set includes a plurality of sample product images and product location information in each sample product image, wherein the plurality of sample product images are obtained by photographing sample products on the assembly line under different environmental factors, wherein the environmental factors include at least one of the following factors: ambient light intensity, the shooting position of the image acquisition device, and the shooting angle of the image acquisition device; The target detection model is trained based on the training data set.
7. The system according to any one of claims 1 to 6, characterized in that The product defect detection system also includes a light source; The image acquisition device is also used for: Obtaining the ambient light intensity of the current environment and the attribute information of the product; Determining illumination parameters of the light source based on the ambient light intensity and the attribute information; Based on the illumination parameters, the light source is controlled to illuminate the product.
8. A product defect detection method, characterized in that: include: Collect product images of products on the assembly line; Performing semantic segmentation on the product image to obtain a segmented image of the product; Defect information of the product is determined based on the segmented image.
9. A product defect detection device, characterized in that: include: A collection module, used to collect product images of products on the assembly line; A detection model, used to perform semantic segmentation on the product image to obtain a segmented image of the product; A judgment module is used to determine defect information of the product based on the segmented image.
10. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the method as claimed in claim 8.
Citation Information
Patent Citations
Industrial product detection method and device
CN117745694A
