A defect detection model training method, defect detection method and training system
By setting up shooting devices of multiple sites in the photoelectric packaging technology to acquire high-quality first training images, and using the defect-free image detection model to obtain negative samples and update the defect detection model, the defect detection problem of optical passive devices is solved, and training efficiency and model accuracy are improved.
Patent Information
- Application Number
- CN202411658171.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2044-11-20
AI Technical Summary
In the photoelectric packaging technology, machine vision-based defect detection models have two main problems in the training and data acquisition process: one is that the optical effect of optical passive devices makes it difficult to fully capture small defects in a single angle imaging; the other is that the training process requires a large amount of image data, which increases data acquisition time and computing resources.
The first training image of the optical components is collected by setting up a shooting device of a plurality of sites, and the shooting parameters are designed according to the structural characteristics and defect distribution of the optical components. The first trained image is detected using a pre-trained defect-free image detection model, and the defective negative samples are obtained, and used to update the defect-free image detection model to obtain the defect detection model.
It realizes that while ensuring the quality of training data, it improves training efficiency, reduces the number of negative samples, saves computing resources, and shortens the training time of defect detection models.
Smart Images

Figure CN119169006B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of device defect detection, and in particular to a defect detection model training method, a defect detection method and a training system. Background Art
[0002] In the field of high-precision electronic manufacturing, especially in optoelectronic packaging technology, defect detection of optical passive components is a key link to ensure the performance of optical systems. With the development of science and technology, the application of machine vision technology in defect detection is becoming more and more extensive. It has the advantages of non-contact, real-time, flexibility and accuracy, and can realize automated detection and improve detection efficiency and accuracy.
[0003] However, the defect detection model based on machine vision still faces the following difficulties in the training and defect sample data collection process: 1) Due to the optical effect of optical passive devices, it is difficult to fully capture the tiny defects on the surface and inside of the device under a single angle of imaging of optical passive devices; 2) The training process requires a large amount of image data, but it will increase data collection time and computing resources. Therefore, how to balance training efficiency while ensuring the quality of training data is an urgent problem to be solved. Summary of the invention
[0004] The present invention provides a defect detection model training method, a defect detection method and a training system, aiming to effectively solve the above technical problems.
[0005] According to a first aspect of the present invention, the present invention provides a method for training a defect detection model, the method comprising:
[0006] A first training image of an optical component is collected by a shooting device at at least one station and a defect-free image detection model is obtained; wherein shooting parameters corresponding to the shooting device at at least one station are designed according to the structural characteristics and defect distribution of the optical component; and the defect-free image detection model is obtained by training based on a second training image of the optical component without defects;
[0007] Using the defect-free image detection model to detect the first training image to obtain a first detection result, where the first detection result indicates whether there is a defect;
[0008] When the first detection result indicates that there is a defect, using the corresponding first training image as a negative sample;
[0009] The defect-free image detection model is trained and updated based on the negative samples to obtain a defect detection model.
[0010] Furthermore, after obtaining the defect detection model, the method further includes:
[0011] Using the defect detection model to detect the new first training image to obtain a second detection result, where the second detection result includes a defect type;
[0012] When the second detection result is a new defect type, using the corresponding first training image as a new negative sample;
[0013] The defect detection model is trained and updated based on the new negative samples to obtain a new defect detection model.
[0014] Furthermore, the collecting of the first training image of the optical component by a shooting device at at least one station includes:
[0015] Setting the site according to the size, shape and defect type of the optical component, and adjusting the position, angle and focal length of the camera according to the characteristics of the optical component;
[0016] The first training image of the optical component is collected by the set site and the adjusted shooting device.
[0017] Furthermore, the defect types include at least one or more of dirt, scratches, stains, bumps, missing parts, and cracks.
[0018] According to a second aspect of the present invention, the present invention provides a defect detection method, comprising:
[0019] Acquire an image of the optical component to be inspected by a shooting device at at least one station;
[0020] Using a defect detection model to detect the image to be detected to obtain a defect detection result;
[0021] Wherein, the defect detection model is trained using any of the defect detection model training methods described above.
[0022] Furthermore, the site includes a plurality of sites, and after obtaining the defect detection result, the method further includes:
[0023] The defect detection result of the previous site is obtained, and the shooting parameters of the shooting device of the current site are adjusted according to the defect detection result of the previous site, and a new image to be detected is obtained after the shooting parameters are adjusted.
[0024] Further, adjusting the shooting parameters of the shooting device of the current site according to the defect detection result of the previous site includes:
[0025] When the defect detection result of the previous station is characterized as no defect, adjusting the focal length of the camera of the current station so that the camera of the current station zooms in and shoots the optical component to obtain a new image to be detected;
[0026] In the case where the defect detection result of the previous site indicates that a defect exists, the defect detection result of the previous site is output as the defect detection result of the optical component.
[0027] According to a third aspect of the present invention, the present invention also provides a defect detection model training system, comprising at least one site and a training device;
[0028] The station is equipped with a shooting device, and the shooting device is used to collect a first training image of the optical component. The shooting parameters corresponding to the shooting device of at least one station are designed according to the structural characteristics and defect distribution of the optical component.
[0029] The training device is used to obtain a defect-free image detection model, and use the defect-free image detection model to detect the first training image to obtain a first detection result, wherein the defect-free image detection model is trained based on a second training image of an optical component without defects; when the first detection result is characterized as the presence of defects, the corresponding first training image is used as a negative sample; the defect-free image detection model is trained based on the negative sample to obtain a defect detection model.
[0030] Furthermore, the system also includes a lighting device for providing lighting conditions for the optical component according to the detection requirements of the optical component.
[0031] Furthermore, the system also includes a material transfer device for transferring the optical components to different sites according to the location information of the sites.
[0032] Further, the training device includes an edge node and a cloud server;
[0033] Wherein, the edge node corresponds to the shooting device, the edge node is in communication connection with the cloud server, and the defect-free image detection model is disposed on both the edge node and the cloud server;
[0034] Inputting the first training image into the defect-free image detection model on the edge node to obtain a first detection result; when the first detection result indicates that there is a defect, using the corresponding first training image as a negative sample, and transmitting the negative sample to the cloud server through the edge node;
[0035] The defect-free image detection model is trained and updated using the negative samples on the cloud server to obtain a defect detection model, and the network parameters of the defect detection model are transmitted to each edge node through the cloud server to update the defect-free image detection model on the edge node to a defect detection model.
[0036] Through one or more of the above embodiments of the present invention, at least the following technical effects can be achieved: a first training image is collected by a shooting device at at least one station, and since the shooting parameters are designed according to the structural characteristics and defect distribution of the optical component, the first training image collected is a high-quality image that can fully capture defects and has a small number of images. Then, the first training image is detected using a pre-trained defect-free image detection model to quickly obtain a defective negative sample. And the defect-free image detection model is trained and updated using the negative sample data to obtain a defect detection model. The defect detection model training method of the present invention obtains a small number of high-quality first training images by collecting a shooting device set according to the structural characteristics and defect distribution of the optical component, and quickly determines negative samples from the first training image through the defect-free image detection model, without the need for manual collection of negative samples, thereby improving the quality and collection efficiency of negative samples, reducing the number of negative samples, thereby saving computing resources, shortening the training time of the defect detection model, and improving the training efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The technical solutions and other beneficial effects of the present invention will be made apparent by describing in detail the specific embodiments of the present invention in conjunction with the accompanying drawings.
[0038] Figure 1 A schematic diagram of a flow chart of a method for training a defect detection model provided by an embodiment of the present invention;
[0039] Figure 2 A schematic diagram of a defect detection process provided by an embodiment of the present invention;
[0040] Figure 3 A schematic diagram of the structure of a defect detection model training system provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0041] The technical scheme in the embodiment of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiment of the present invention. Obviously, the described embodiment is only a part of the embodiment of the present invention, not all of the embodiments. Based on the embodiment of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0042] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the term "and / or" herein is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " herein, unless otherwise specified, generally indicates that the associated objects before and after are in an "or" relationship.
[0043] The following introduces the defect detection model training method, defect detection method and training system provided by the present invention in conjunction with the accompanying drawings.
[0044] See also Figures 1 to 3 , a defect detection model training method, comprising the following steps:
[0045] S101, collecting a first training image of an optical component and acquiring a defect-free image detection model by using a shooting device 310 of at least one station. The shooting parameters corresponding to the shooting device 310 of the at least one station are designed according to the structural characteristics and defect distribution of the optical component; the defect-free image detection model is trained based on a second training image of the optical component without defects.
[0046] Among them, optical components are optical elements and components used in electronic equipment and systems to achieve specific optical functions. Specifically, they can be lenses, mirrors, filters, prisms, gratings, etc. Some optical components have multiple layers of complex coatings on their surfaces, which can cause multiple emission, refraction, and scattering of light on the surface of the material or inside the optical component. These optical effects make it difficult to fully capture the tiny defects of the optical component in an image taken from a single angle.
[0047] In view of the limitation of single-angle images, at least one station provided by the present invention may have multiple shooting devices 310. These shooting devices shoot from different angles to obtain images at multiple angles. At the same time, in order to improve the imaging quality of the first training image and reduce the number, the shooting devices 310 configured at different stations are pre-designed with shooting parameters according to the structural characteristics and defect distribution of the optical component. Schematically, when the optical component is a lens, based on the shape of the lens being an oblate body or a cylindrical barrel, defects usually appear at the edge of the lens, the light-transmitting surface of the lens, and other positions. At the edge of the lens, defects such as edge collapse, defect, and micro-cracks usually occur. At the light-transmitting surface of the lens, defects such as micro-scratches, tiny contamination points left by grinding and polishing usually occur, or the optical anti-reflection film coated on the light-transmitting surface of the lens may have rainbow-like ripple defects due to uneven coating. According to the shape of the above-mentioned lens, the location of the defect distribution, and the specific defect types at different positions, at least three stations are required so that the shooting device at each station can collect images of all defective positions in the lens that are prone to defects, so as to detect all defects of the optical component of the lens as much as possible.
[0048] The designed shooting device 310 captures the first training image of the optical component. In addition, in this step, a defect-free image detection model is also obtained. The defect-free image detection model is pre-trained based on the defect-free second training image. In actual production, the number of qualified optical components is generally greater than that of defective ones, and images of qualified optical components are easier to acquire. The second training image is obtained based on these qualified optical components. In order to improve the training efficiency of the defect detection model, the defect-free image detection model is pre-trained using the captured defect-free second training image, and then the defect-free image detection model is used to quickly acquire defective data.
[0049] It should be noted that the defect-free image detection model can be a model based on machine learning or a model based on deep learning. Among them, the model based on machine learning can be a model based on machine learning algorithms such as support vector machines, random forests, and decision trees. The model based on deep learning can be a model based on target detection algorithms such as the R-CNN (Region-based Convolutional Neural Network) series, the YOLO (You Only Look Once) series, etc., and there is no limitation on this.
[0050] In addition, the first training image is acquired by the shooting device 310 for any optical component. It may be an image with defects or an image without defects. Each shooting device 310 shoots at least one first training image. The shooting device 310 may be a high-speed camera to capture the first training image of the optical component in a dynamic process; or it may be an ordinary camera to accurately capture the first training image of the optical component through static imaging technology.
[0051] S102: Use the defect-free image detection model to detect the first training image to obtain a first detection result. The first detection result indicates whether there is a defect in the optical component in the first training image.
[0052] S103, when the first detection result indicates that there is a defect, the corresponding first training image is used as a negative sample. When the first detection result shows that the optical component in the current first training image is qualified and has no defects, the next first training image is input into the defect-free image detection model for a new detection.
[0053] S104, training and updating the non-defective image detection model based on the negative samples to obtain a defect detection model. The non-defective image detection model is a model obtained based on deep learning.
[0054] Specifically, the negative sample is input into the defect-free image detection model to obtain the predicted value, and the loss value between the predicted value and the true value is calculated using the loss function of the defect detection model. Back propagation is performed based on the loss value to update the network parameters in the defect-free image detection model. The defect detection model is obtained by continuously iterating and updating until the training end condition is met. The true value refers to the label information of the negative sample, specifically including defect location information, defect type information, etc. The training end condition can be a preset number of iterations, the parameters of the defect detection model reaching a convergence state, etc.
[0055] It should be noted that the network structures of the defect-free image detection model and the defect detection model can be the same or different. When the network structures of the defect-free image detection model and the defect detection model are the same, the network parameters of each layer of the defect detection model are different from those of the defect-free image detection model. Based on the defect-free image detection model, the original network parameters in the defect-free image detection model are iteratively updated through negative samples and corresponding loss functions to obtain updated network parameters. The final network parameters obtained when the training end conditions are met constitute the defect detection model.
[0056] In addition, after obtaining the first training image, the first training image will be preprocessed, including denoising, contrast adjustment, cropping, etc., and the preprocessed image will be input into the defect-free image detection model.
[0057] After obtaining negative samples, the negative samples can also be automatically annotated to obtain label information corresponding to the negative samples. The defect-free image detection model is trained and updated based on the negative samples and the corresponding label information to obtain the defect detection model. The label information corresponding to the negative samples includes defect type, defect location information, etc.
[0058] The training method of the defect detection model provided by the embodiment of the present invention collects a first training image by means of a shooting device set at at least one station. Since the shooting parameters are designed according to the structural characteristics and defect distribution of the optical component, the first training image collected is a high-quality image that can fully capture defects and the number of images is small enough. Then, the first training image is detected using a pre-trained defect-free image detection model to quickly obtain a defective negative sample. The defect-free image detection model is trained and updated using the negative sample data to obtain a defect detection model. The training method of the defect detection model of the present invention obtains a small number of high-quality first training images by means of a shooting device set according to the structural characteristics and defect distribution of the optical component, and quickly determines negative samples from the first training image using the defect-free image detection model. There is no need to manually collect negative samples, thereby improving the quality and collection efficiency of negative samples, reducing the number of negative samples, thereby saving computing resources, shortening the training time of the defect detection model, and improving the training efficiency.
[0059] In some embodiments of the present invention, when the training of the defect detection model reaches a preset number of iterations, a preset time, or the model performance evaluation is passed, or when the number of collected negative samples, the type of defects, etc. reaches a preset number, the defect detection model that has been initially trained is used to detect the new first training image to obtain a second detection result. The second detection result includes the defect type. Among them, the defect types of optical components include dirt, scratches, stains, bumps, missing, cracks, etc.
[0060] In the case where the second detection result is a new defect type, the first training image corresponding to the second detection result is used as a new negative sample.
[0061] The defect detection model is trained and updated based on the new negative samples to obtain a new defect detection model.
[0062] In addition, when the second detection result shows that the optical component in the current new first training image is defect-free, the next first training image is obtained and input into the defect detection model for new detection.
[0063] When the defect type shown in the second detection result has been trained before, the corresponding first training image can be used to further fine-tune the defect detection model to further improve the detection performance of the defect detection model. In order to improve training efficiency, the next first training image can also be directly obtained and input into the defect detection model for new detection.
[0064] In this embodiment, the network parameters in the defect detection model are continuously updated and trained using new negative samples, which can not only further improve the training efficiency, but also enable the defect detection model to detect more types of defects, thereby improving the detection capability of the defect detection model.
[0065] In some embodiments of the present invention, the capturing of the first training image of the optical component by the shooting device 310 of at least one station includes:
[0066] The site is set according to the size, shape and defect type of the optical component, and the position, angle and focal length of the camera 310 are adjusted according to the characteristics of the optical component.
[0067] The first training image of the optical component is collected by the set site and the adjusted shooting device 310.
[0068] Schematically, when the optical component is a prism, since the prism is generally in the shape of a multi-faceted cube, and the prism is designed with multiple optical surface angles, the light is deflected in the prism to adjust the direction of light propagation. Therefore, according to the shape and function of the prism, its defects are usually randomly distributed on the right-angled edges of the prism, the acute angles of the prism, and the light-transmitting surface of the prism. Common defect types include edge collapse, defects, microcracks, dirt pollution, scratches, and failed coatings. Based on this, at least 3 stations are set up to fully obtain possible defects of the prism. In order to reduce the number of the first training images, the number of stations needs to be as small as possible. Therefore, for the prism, 3 to 4 stations can be set up to obtain high-quality and sufficiently small images of the prism.
[0069] The defect detection model training method provided in the embodiment of the present invention obtains the first training images with the fewest possible but high quality by setting the site and adjusting the parameters of the shooting device 310, thereby reducing computing resources and improving training efficiency.
[0070] In some embodiments of the present invention, the present invention also provides a defect detection method, such as Figure 2 As shown, the method includes:
[0071] S201, acquiring an image of an optical component to be inspected by a photographing device 310 at at least one station, wherein photographing parameters corresponding to the photographing device 310 are designed according to structural features and defect distribution of the optical component.
[0072] S202, using the defect detection model to detect the image to be detected to obtain a defect detection result. Schematically, when there is no defect in the optical component in the image to be detected, the defect detection result shows no defect; when there is a defect in the optical component in the image to be detected, the defect detection result includes defect type and defect location information.
[0073] The defect detection model is trained using the defect detection model training method provided in any of the above embodiments.
[0074] In this embodiment, the same defect detection model can be deployed at each site. When the camera 310 at the current site collects the image to be detected, the defect detection model at the current site is used to perform defect detection on the image to be detected, thereby obtaining a defect detection result. In addition, the shooting parameters corresponding to the camera 310 at different sites can be the same or different, which is specifically designed according to the structural characteristics of the optical components and the expected defect distribution.
[0075] Multiple sites may also share a defect detection model. The shooting device 310 of each site collects the image to be detected and transmits it to the defect detection model. The defect detection model returns each detection result to each site.
[0076] The imaging of the shooting devices 310 at multiple sites can fully cover the surface and interior of the optical components, and because the shooting parameters are pre-designed according to the structural characteristics of the optical components and the expected defect distribution, it is possible to obtain high-quality but as few images as possible to be inspected, thereby reducing the computing resources in the inspection process and improving the inspection efficiency.
[0077] In some embodiments of the present invention, the station includes multiple stations, and the optical component can be transferred to each station through a conveyor belt, so that the shooting device 310 of each station successively acquires the images to be detected of the same optical component at different angles. Specifically, after obtaining the defect detection result, the method further includes: obtaining the defect detection result of the previous station, and adjusting the shooting parameters of the shooting device 310 of the current station according to the defect detection result of the previous station, and obtaining a new image to be detected after the shooting parameters are adjusted.
[0078] Furthermore, when the defect detection result of the previous site is characterized as no defects, the focal length of the shooting device 310 of the current site is adjusted so that the shooting device 310 of the current site zooms in and shoots the optical component to obtain a new image to be detected.
[0079] In the case where the defect detection result of the previous site indicates that a defect exists, the defect detection result of the previous site is output as the defect detection result of the optical component.
[0080] It is understandable that, according to the transmission path of the optical components, the order in which the shooting devices 310 of each station collect the images to be detected can be predetermined, thereby obtaining the station sequence. Based on the station sequence, the defect detection model of each station detects the image to be detected, and the defect detection result of the previous station is shared with the current station.
[0081] The current site will adopt different detection strategies according to the defect detection results of the previous site. Specifically, if the defect detection results of the previous site show no defects, it may be because the angle covered by the camera 310 of the previous sites is limited and the fine features of the optical components cannot be obtained. It is necessary to adjust the shooting parameters of the camera 310 in the current site, and then use the adjusted camera 310 to shoot the image to be detected, so that the defect detection model in the current site can detect defects as much as possible. If the defect detection results of the previous site show information such as defect type and defect location, the camera 310 of the current site will no longer acquire new images to be detected, and will also stop the transmission of optical components to subsequent sites, and directly output the defect detection results of the previous site.
[0082] In addition, if the defect detection result of the current site still shows no defects, the optical component is transferred to the next site according to the site sequence, and the shooting parameters of the shooting device 310 in the next site are adjusted, and a new detection is performed using the defect detection model in the next site, and so on, until a defect is detected or the defect detection models in all sites have completed the detection, or when the defect-free detection result reaches a preset value, it stops, so that a new defect detection is performed on the new optical component.
[0083] The defect detection method provided by the embodiment of the present invention adjusts the shooting parameters of the shooting device 310 of the current site according to the defect detection result of the previous site, and obtains a new image to be detected after the shooting parameters are adjusted. Then, the defect detection model is used to perform defect detection on the new image to be detected, thereby improving the accuracy of defect detection and the detection efficiency.
[0084] In some embodiments of the present invention, the present invention further provides a defect detection model training system 300, such as Figure 3 As shown, the system includes at least one station and a training device 320 .
[0085] Each station is equipped with at least one shooting device 310. The shooting device 310 is used to collect a first training image of an optical component. The shooting parameters corresponding to the shooting device 310 of the at least one station are designed according to the structural characteristics and defect distribution of the optical component. The shooting device 310 is connected to the training device 320 for communication. The training device 320 can be one, and the shooting device 310 of each station transmits the image to be detected to the training device 320; or each station can correspond to one training device 320, which is not limited to this.
[0086] The training device 320 is used to obtain a defect-free image detection model, and use the defect-free image detection model to detect the first training image to obtain a first detection result. The defect-free image detection model is trained based on a second training image of an optical component without defects. When the first detection result is characterized as a defect, the corresponding first training image is used as a negative sample. The defect-free image detection model is trained based on the negative sample to obtain a defect detection model.
[0087] The defect detection model training system 300 provided in the embodiment of the present invention obtains high-quality and as few first training images as possible through the shooting devices 310 in multiple sites, and uses a pre-trained defect-free image detection model to collect negative samples. The defect detection model is obtained by training with negative samples based on the defect-free image detection model, thereby improving the training efficiency of the defect detection model, and reducing computing resources in the training process while obtaining better model accuracy.
[0088] In some embodiments of the present invention, since some types of defects are only easily found under specific lighting conditions, the system further includes a lighting device, which is used to illuminate the optical component.
[0089] In some embodiments of the present invention, the system further comprises a material transfer device, which is specifically designed according to the location information of the site and can transfer the optical components to different sites to improve the collection efficiency of negative samples.
[0090] In some embodiments of the present invention, considering that the production lines where different optical components may be located are far apart. Therefore, the training device 320 may include an edge node and a cloud server. The first training image is preprocessed and defect detection is performed by the edge nodes set at each site, and the model is trained and updated through the cloud server. While further improving the training efficiency, the model parameters on each edge node can also be shared, which is more convenient.
[0091] Specifically, the edge node corresponds to the shooting device 310, and the edge node is in communication connection with the cloud server. The defect-free image detection model is disposed on both the edge node and the cloud server.
[0092] The first training image is input into the defect-free image detection model on the edge node to obtain a first detection result; when the first detection result is characterized by the presence of defects, the corresponding first training image is used as a negative sample, and the negative sample is transmitted to the cloud server through the edge node.
[0093] The defect-free image detection model is trained and updated using the negative samples on the cloud server to obtain a defect detection model, and the network parameters of the defect detection model are transmitted to each edge node through the cloud server to update the defect-free image detection model on the edge node to a defect detection model.
[0094] After the defect-free image detection model on the edge node is updated to the defect detection model, the edge node will perform defect detection on the new first training image through the defect detection model. When the defect detection result shows that there is a defect and it is a new defect type, the edge node will transmit the corresponding first training image as a new negative sample to the cloud server for iterative update of the defect detection model.
[0095] It should be noted that the above-mentioned lighting equipment, material transfer equipment, edge nodes and cloud servers are all applicable to the embodiments of the above-mentioned defect detection method.
[0096] Specifically, lighting equipment is arranged at each site, and the lighting equipment is turned on or off according to the inspection requirements of the optical components. If the expected defect of a certain optical component can only be easily obtained under lighting conditions, the lighting equipment is controlled to be turned on to obtain the image of the optical component to be inspected.
[0097] Optical components are delivered to various stations through material delivery equipment, and when the defect type is output, the material delivery equipment can be controlled to stop working.
[0098] By setting up edge nodes at each site, real-time detection of images to be inspected can be achieved, thereby improving defect detection efficiency.
[0099] Based on any of the above embodiments, another embodiment of the present invention further provides an electronic device, which may include: a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor may call logic instructions in the memory to execute a defect detection model training method or a defect detection method.
[0100] In addition, when the logic instructions in the above-mentioned memory are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, part of the technical solution of the present invention can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0101] On the other hand, an embodiment of the present invention further provides a storage medium on which a plurality of instructions are stored, and the instructions are suitable for being loaded by a processor to execute the defect detection model training method provided in the above embodiments, so as to execute the defect detection model training method or defect detection method.
[0102] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0103] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0104] In summary, although the present invention has been disclosed as above in terms of preferred embodiments, the above preferred embodiments are not intended to limit the present invention. A person skilled in the art may make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the scope of protection of the present invention shall be based on the scope defined in the claims.
Claims
1. A method for training a defect detection model, characterized in that: include: A first training image of an optical component is collected by a shooting device at at least one station and a defect-free image detection model is obtained; wherein shooting parameters corresponding to the shooting device at at least one station are designed according to the structural characteristics and defect distribution of the optical component; and the defect-free image detection model is obtained by training based on a second training image of the optical component without defects; Using the defect-free image detection model to detect the first training image to obtain a first detection result, where the first detection result indicates whether there is a defect; When the first detection result indicates that there is a defect, using the corresponding first training image as a negative sample; Training and updating the defect-free image detection model based on the negative samples to obtain a defect detection model; After obtaining the negative sample, the method further includes: Automatically annotating the negative samples to obtain label information corresponding to the negative samples, wherein the label information includes defect type and defect location information; The step of training and updating the defect-free image detection model based on the negative samples to obtain a defect detection model includes: The defect detection model is trained and updated based on the negative samples and the corresponding label information to obtain a defect detection model.
2. The method according to claim 1, characterized in that After obtaining the defect detection model, the method further includes: Using the defect detection model to detect the new first training image to obtain a second detection result, where the second detection result includes a defect type; When the second detection result is a new defect type, using the corresponding first training image as a new negative sample; The defect detection model is trained and updated based on the new negative samples to obtain a new defect detection model.
3. The method according to claim 1, characterized in that The step of collecting a first training image of an optical component by a shooting device at at least one station includes: Setting the site according to the size, shape and defect type of the optical component, and adjusting the position, angle and focal length of the camera according to the characteristics of the optical component; The first training image of the optical component is collected by the set site and the adjusted shooting device.
4. The method according to claim 2, characterized in that The defect types include at least one or more of dirt, scratches, stains, bumps, missing parts, and cracks.
5. A defect detection method, characterized in that: include: Acquire an image of the optical component to be inspected by a shooting device at at least one station; Using a defect detection model to detect the image to be detected to obtain a defect detection result; Wherein, the defect detection model is trained using the defect detection model training method described in any one of claims 1 to 4.
6. The method according to claim 5, characterized in that The site includes a plurality of sites. After obtaining the defect detection result, the method further includes: The defect detection result of the previous site is obtained, and the shooting parameters of the shooting device of the current site are adjusted according to the defect detection result of the previous site, and a new image to be detected is obtained after the shooting parameters are adjusted.
7. The method according to claim 6, characterized in that The adjusting the shooting parameters of the shooting device of the current site according to the defect detection result of the previous site includes: When the defect detection result of the previous station is characterized as no defect, adjusting the focal length of the camera of the current station so that the camera of the current station zooms in and shoots the optical component to obtain a new image to be detected; In the case where the defect detection result of the previous site indicates that a defect exists, the defect detection result of the previous site is output as the defect detection result of the optical component.
8. A defect detection model training system, characterized in that: Includes at least one station and training equipment; The station is equipped with a shooting device, and the shooting device is used to collect a first training image of the optical component. The shooting parameters corresponding to the shooting device of at least one station are designed according to the structural characteristics and defect distribution of the optical component. The training device is used to obtain a defect-free image detection model, and use the defect-free image detection model to detect the first training image to obtain a first detection result, wherein the defect-free image detection model is trained based on a defect-free second training image of the optical component; when the first detection result is characterized as a defect, the corresponding first training image is used as a negative sample; the defect-free image detection model is trained based on the negative sample to obtain a defect detection model; After obtaining the negative sample, the training device is further used to: Automatically annotating the negative samples to obtain label information corresponding to the negative samples, wherein the label information includes defect type and defect location information; The defect detection model is trained and updated based on the negative samples and the corresponding label information to obtain a defect detection model.
9. The system according to claim 8, characterized in that The system further comprises a lighting device for providing lighting conditions for the optical component according to the inspection requirements of the optical component.
10. The system according to claim 8, characterized in that The system further comprises a material transfer device for transferring the optical components to different sites according to the location information of the sites.
11. The system according to claim 8, characterized in that The training device includes an edge node and a cloud server; Wherein, the edge node corresponds to the shooting device, the edge node is in communication connection with the cloud server, and the defect-free image detection model is disposed on both the edge node and the cloud server; Inputting the first training image into the defect-free image detection model on the edge node to obtain a first detection result; when the first detection result indicates that there is a defect, using the corresponding first training image as a negative sample, and transmitting the negative sample to the cloud server through the edge node; The defect-free image detection model is trained and updated using the negative samples on the cloud server to obtain a defect detection model, and the network parameters of the defect detection model are transmitted to each edge node through the cloud server to update the defect-free image detection model on the edge node to a defect detection model.
Citation Information
Patent Citations
Positive and negative sample data balancing method in factory PCB defect detection
CN111126433A
Sample-equalizable crankshaft surface defect detection method and detection system
CN114862863A