Foreign Object Detection Method, Device, and Storage Medium
By using twin self-coding network model and multi-layer pixel-level subtraction and expansion processing in foreign object detection, the huge parameters in the prior art are solved, the detection accuracy is improved and the cost is reduced.
Patent Information
- Application Number
- CN202210201139.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-02
- Publication Date
- 2025-07-01
- Estimated Expiration
- 2042-03-02
AI Technical Summary
The edge gradient information of the foreign object reconstruction image obtained by the existing autoencoder network in foreign matter detection is huge, resulting in too large parameters and cannot meet the large-scale and high-concurrency needs in the industry.
The image to be detected is detected using a twin self-coding network model, a first pixel-level subtraction process, a second pixel-level subtraction process, a third pixel-level subtraction process and an expansion process to remove edge gradient information.
Through this method, the removal effect of edge gradient information is improved, the accuracy of foreign object detection is improved, and the detection cost is reduced.
Smart Images

Figure CN114663829B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image detection, and particularly relates to a foreign object detection method, device, and storage medium. Background Art
[0002] Currently, the autoencoder network has achieved good performance in tasks such as image reconstruction and foreign object detection. However, the edge gradient information of the foreign object reconstruction image obtained by the foreign object detection algorithm based on the autoencoder network is huge, resulting in overly large parameters, and thus requiring more data and computing resources, which cannot meet the industrial requirements of large batches and high concurrency. Summary of the Invention
[0003] The present invention aims to at least solve one of the technical problems existing in the prior art. For this purpose, the present invention provides a foreign object detection method, device, and storage medium, which can improve the effect of removing edge gradient information, improve the accuracy of foreign object detection, and reduce the detection cost.
[0004] The foreign object detection method according to the first aspect embodiment of the present invention includes:
[0005] Obtain an image to be detected;
[0006] Input the image to be detected into a siamese autoencoder network model to obtain a first reconstructed image and a second reconstructed image;
[0007] Perform a first pixel-level subtraction process on the image to be detected and the first reconstructed image to obtain a first contour gradient image containing foreign objects;
[0008] Perform a second pixel-level subtraction process on the first reconstructed image and the second reconstructed image to obtain a second contour gradient image;
[0009] Perform a dilation process on the second contour gradient image to obtain a third contour gradient image;
[0010] Perform a third pixel-level subtraction process on the first contour gradient image and the third contour gradient image to obtain a foreign object detection result.
[0011] According to one or more technical solutions provided in the embodiments of the present invention, there are at least the following beneficial effects: The present invention performs foreign object detection on the image to be detected through a siamese autoencoder network model, a first pixel-level subtraction process, a second pixel-level subtraction process, a third pixel-level subtraction process, and a dilation process to obtain a foreign object detection result. Through this foreign object detection method, the effect of removing edge gradient information is improved, the accuracy of foreign object detection is increased, and the detection cost is reduced.
[0012] According to some embodiments of the present invention, the siamese auto-encoding network model is a fully convolutional network structure including a first auto-encoder, a second auto-encoder, and a decoder; the step of inputting the image to be detected into the siamese auto-encoding network model to obtain a first reconstructed image and a second reconstructed image includes:
[0013] Input the image to be detected into the first auto-encoder to obtain a first processed image;
[0014] Input the first processed image into the decoder to obtain a first reconstructed image;
[0015] Input the image to be detected into the second auto-encoder to obtain a second processed image;
[0016] Input the second processed image into the decoder to obtain a second reconstructed image.
[0017] According to some embodiments of the present invention, the calculation formula of the first pixel-level subtraction process is as follows:
[0018] R1 = |X - Y1|,
[0019] wherein, R1 represents the first contour gradient image, X represents the image to be detected, and Y1 represents the first reconstructed image;
[0020] The calculation formula of the second pixel-level subtraction process is as follows:
[0021] R2 = |Y2 - Y1|,
[0022] wherein, R2 represents the second contour gradient image, Y1 represents the first reconstructed image, and Y2 represents the second reconstructed image;
[0023] The calculation formula of the third pixel-level subtraction process is as follows:
[0024] OUT = {R1 - R3} ∩ {Z > 0},
[0025] wherein, R1 represents the first contour gradient image, R3 represents the third contour gradient image, OUT represents the foreign object detection result, and Z represents the pixel value obtained by subtracting the third contour gradient image from the first contour gradient image.
[0026] According to some embodiments of the present invention, the calculation formula of the dilation process is as follows:
[0027] D(X) = {a|Ba↑X}, R3 = D(R2),
[0028] Among them, D represents the dilation function, D(X) represents the expression of the dilation function, Ba represents the structuring element, X represents the image to be detected, a represents the set of pixel points in the image to be detected that satisfy the structuring element, R2 represents the second contour gradient image, R3 represents the third contour gradient image, and D(R2) represents the dilation processing of the second contour gradient image.
[0029] According to some embodiments of the present invention, the siamese autoencoder network model is obtained by the following steps:
[0030] Obtain a sample training set;
[0031] Input the sample training set into the siamese autoencoder network model for regression training until the change rate of the loss function meets the preset conditions.
[0032] According to some embodiments of the present invention, the calculation formula of the loss function used in the regression training is as follows:
[0033]
[0034] Among them, Loss represents the loss function, G represents the sample training set, x i represents the i-th component of the image to be detected, y i represents the i-th component of the first reconstructed image and the second reconstructed image, λ represents hyperparameter data, w i represents network parameter data.
[0035] The foreign object detection device according to the embodiment of the second aspect of the present invention includes: a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the foreign object detection method as described in the first aspect above.
[0036] The computer-readable storage medium according to the embodiment of the third aspect of the present invention stores computer-executable instructions, and the computer-executable instructions are used to cause a computer to execute the foreign object detection method as described in the first aspect above.
[0037] Other features and advantages of the present invention will be described in the following specification, and part of them will become obvious from the specification, or be understood by implementing the present invention. The objectives and other advantages of the present invention can be achieved and obtained through the structures specifically pointed out in the specification, claims, and drawings. Description of the Drawings
[0038] The accompanying drawings are used to provide a further understanding of the technical solution of the present invention, and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the technical solution of the present invention, and do not constitute a limitation to the technical solution of the invention.
[0039] Figure 1 is a schematic flowchart of a foreign object detection method provided by an embodiment of the present invention;
[0040] Figure 2 is a schematic flowchart of obtaining a first reconstructed image provided by an embodiment of the present invention;
[0041] Figure 3 is a schematic flowchart of obtaining a second reconstructed image provided by an embodiment of the present invention;
[0042] Figure 4 is a schematic flowchart of obtaining a first contour gradient image provided by an embodiment of the present invention;
[0043] Figure 5 is a schematic flowchart of obtaining a second contour gradient image provided by an embodiment of the present invention;
[0044] Figure 6 is a schematic flowchart of obtaining a siamese autoencoder network model provided by an embodiment of the present invention;
[0045] Figure 7 is a schematic diagram of a foreign object detection result provided by an embodiment of the present invention;
[0046] Figure 8 is a schematic flowchart of a foreign object detection provided by an embodiment of the present invention;
[0047] Figure 9 is another schematic diagram of a foreign object detection result provided by an embodiment of the present invention;
[0048] Figure 10 is a schematic structural diagram of a foreign object detection method provided by an embodiment of the present invention. Detailed Embodiments
[0049] In order to make the objectives, technical solutions and advantages of the present invention clearer and more understandable, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0050] It should be noted that although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order from the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above-mentioned drawings are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence.
[0051] At present, the autoencoder network has achieved good performance in tasks such as image reconstruction and foreign object detection. However, the edge gradient information of the foreign object reconstruction image obtained by the foreign object detection algorithm based on the autoencoder network is huge, resulting in overly large parameters, which in turn leads to the need for more data and computing resources, unable to meet the large-batch and high-concurrency requirements in industry, or reducing the effect of foreign object detection due to too much noise.
[0052] Based on this, the embodiments of the present invention provide a foreign object detection method, device, and storage medium, which improve the effect of removing edge gradient information, improve the accuracy of foreign object detection, and reduce the detection cost.
[0053] The following further elaborates on the embodiments of the present invention in conjunction with the accompanying drawings.
[0054] Specifically, an embodiment of the first aspect of the present invention provides a foreign object detection method, as Figure 1 shown, Figure 1 is a flowchart of the foreign object detection method provided by the embodiment of the present invention. The foreign object detection method of the embodiment of the present invention includes but is not limited to the following steps:
[0055] Step S100, obtain the image to be detected;
[0056] Step S200, input the image to be detected into the siamese autoencoder network model to obtain a first reconstructed image and a second reconstructed image;
[0057] Step S300, perform a first pixel-level subtraction process on the image to be detected and the first reconstructed image to obtain a first contour gradient image containing foreign objects;
[0058] Step S400, perform a second pixel-level subtraction process on the first reconstructed image and the second reconstructed image to obtain a second contour gradient image;
[0059] Step S500, perform a dilation process on the second contour gradient image to obtain a third contour gradient image;
[0060] Step S600, perform a third pixel-level subtraction process on the first contour gradient image and the third contour gradient image to obtain a foreign object detection result.
[0061] The present invention performs foreign object detection on the image to be detected through a siamese autoencoder network model, a first pixel-level subtraction process, a second pixel-level subtraction process, a third pixel-level subtraction process, and a dilation process to obtain a foreign object detection result. Through this foreign object detection method, the effect of removing edge gradient information is improved, the accuracy of foreign object detection is increased, and the detection cost is reduced.
[0062] In the related art, foreign object detection is a key step in industrial production. The foreign object detection method of the present invention is used to identify and locate foreign objects appearing on the surface of a product. Based on the foreign object detection result, it is determined whether the product is qualified, and then the production plan is adjusted in a timely manner to improve production efficiency and reduce production costs. Among them, the image to be detected is an image of the product, and the foreign object detection method of the present invention can be applied to unsupervised foreign object detection.
[0063] It should be noted that the siamese autoencoder network model is composed of a fully convolutional network including a first autoencoder, a second autoencoder, and a decoder. The second autoencoder is a four-layer fully convolutional neural network. The first autoencoder and the second autoencoder have the same structure but different parameters. The image to be detected is input into the first autoencoder and the second autoencoder respectively, and the first autoencoder and the second autoencoder are connected to the same decoder. The first contour gradient image includes the generated foreign object and the contour gradient image. The second contour gradient image is the generated primary contour gradient image. The second contour gradient image does not contain foreign objects and noise and is a relatively stable contour gradient image. The third contour gradient image is the generated image that can enclose the true contour gradient. Since the second contour gradient image is only a rough contour gradient image, it needs to be dilated to enclose the true contour gradient.
[0064] For example, it is assumed that an image to be detected is composed of a clean image and a foreign object image, and its calculation formula is as follows:
[0065] X = Q + E,
[0066] where X represents the image to be detected, Q represents the clean image, and E represents the foreign object image.
[0067] The clean image needs to be restored from the image to be detected. Subtracting the clean image from the image to be detected, the resulting image is the foreign object image. The clean image can be restored through the siamese autoencoder network model. Due to the characteristics of the first autoencoder and the second autoencoder, the contour edge gradient information of the reconstructed second contour gradient image will be very large, so that most of the remaining pixels in total are composed of component contour information. Its calculation formula is as follows:
[0068] X = Q + E + R2,
[0069] Among them, R2 represents the second contour gradient image. The second contour gradient image is obtained through the siamese autoencoder network model. At this time, the second contour gradient image is only a rough contour gradient image and cannot be pixel-level aligned with the foreign object image. Therefore, it is necessary to perform dilation processing on the second contour gradient image. In this embodiment, only a 3*3 dilation operation is required to obtain the third contour gradient image. The first contour gradient image and the third contour gradient image obtained through dilation processing are subjected to third pixel-level subtraction processing to obtain the foreign object detection result, improving the accuracy of foreign object detection.
[0070] It should be noted that in step S600, the pixel value is obtained by subtracting the pixel level of the third contour gradient image from the pixel level of the first contour gradient image, and the part where the pixel value is greater than 0 is taken as the foreign object detection result. If the pixel value is less than 0, the part less than 0 is taken as 0, and 0 is taken as the foreign object detection result.
[0071] Refer to Figure 2 and Figure 3 , it can be understood that the siamese autoencoder network model is a fully convolutional network structure including a first autoencoder, a second autoencoder, and a decoder. Step S200 includes but is not limited to the following steps:
[0072] Step S201, input the image to be detected into the first autoencoder to obtain the first processed image;
[0073] Step S202, input the first processed image into the decoder to obtain the first reconstructed image;
[0074] Step S203, input the image to be detected into the second autoencoder to obtain the second processed image;
[0075] Step S204, input the second processed image into the decoder to obtain the second reconstructed image.
[0076] It should be noted that the first autoencoder and the second autoencoder are connected to the same decoder. This network structure setting is used for image reconstruction tasks to obtain the first reconstructed image and the second reconstructed image.
[0077] Refer to Figure 4 and Figure 5 , it can be understood that the first pixel-level subtraction processing includes the first image subtraction processing and the first absolute value extraction processing, and the second pixel-level subtraction processing includes the second image subtraction processing and the second absolute value extraction processing;
[0078] Step S300 includes but is not limited to the following steps:
[0079] Step S310: Perform a first image subtraction process and a first absolute value extraction process on the image to be detected and the first reconstructed image in sequence, to obtain a first contour gradient image containing foreign objects.
[0080] Correspondingly, step S400 includes but is not limited to the following steps:
[0081] Step S410: Perform a second image subtraction process and a second absolute value extraction process on the first reconstructed image and the second reconstructed image in sequence, to obtain a second contour gradient image.
[0082] It should be noted that in step S310, the pixel level of the image to be detected is subtracted from the pixel level of the first reconstructed image, and the absolute value is taken, to obtain a first contour gradient image containing foreign objects; in step S410, the pixel level of the second reconstructed image is subtracted from the pixel level of the first reconstructed image, and the absolute value is taken, to obtain a second contour gradient image.
[0083] For example, referring to Figure 7 , Figure 7 in it, the first row of images is the image to be detected, the second row of images is the first reconstructed image, the third row of images is the first contour gradient image containing foreign objects, the fourth row of images is the second reconstructed image, the fifth row of images is the second contour gradient image, and the sixth row of images is the image corresponding to the foreign object detection result; referring to Figure 9 , Figure 9 in it, the first row of images is the image to be detected, the second row of images is the first reconstructed image, the third row of images is the first contour gradient image containing foreign objects, the fourth row of images is the second reconstructed image, the fifth row of images is the second contour gradient image, and the sixth row of images is the image corresponding to the foreign object detection result. Referring to Figure 10 , Figure 10 in it: 1 represents the image to be detected, 2 represents the first reconstructed image, 3 represents the second reconstructed image, 10 represents the first autoencoder, 20 represents the second autoencoder, and 30 represents the decoder. Figure 10 The process of the structural schematic diagram is as follows: The image to be detected 1 is respectively input into the first autoencoder 10 and the second autoencoder 20, and the image to be detected 1 processed by the first autoencoder 10 and the image to be detected 1 processed by the second autoencoder 20 are both input into the decoder 30, to obtain the first reconstructed image 2 and the second reconstructed image 3. Referring to Figure 8 , Figure 8 in it: 1 represents the image to be detected, 2 represents the first reconstructed image, 3 represents the second reconstructed image, 4 represents the first contour gradient image, 5 represents the second contour gradient image, 6 represents the third contour gradient image, 7 represents the image of the foreign object detection result, fx represents the siamese autoencoding network model, - represents the pixel-level subtraction process, and × represents the dilation process. Figure 8The foreign object detection process is as follows: Input the image to be detected 1 into the Siamese auto-encoder network model to obtain the first reconstructed image 2 and the second reconstructed image 3; perform the first pixel-level subtraction process on the image to be detected 1 and the first reconstructed image 2 to obtain the first contour gradient image 4 containing foreign objects; perform the first pixel-level subtraction process on the first reconstructed image 2 and the second reconstructed image 3 to obtain the second contour gradient image 5; perform a dilation process on the second contour gradient image 5 to obtain the third contour gradient image 6; perform the third pixel-level subtraction process on the first contour gradient image 4 and the third contour gradient image 6 to obtain the image 7 of the foreign object detection result. The pixel-level subtraction process includes the first pixel-level subtraction process and the third pixel-level subtraction process.
[0084] It can be understood that the calculation formula for the first pixel-level subtraction process is as follows:
[0085] R1 = |X - Y1|,
[0086] where R2 represents the second contour gradient image, Y1 represents the first reconstructed image, and Y2 represents the second reconstructed image;
[0087] R2 = |Y2 - Y1|,
[0088] where R2 represents the second contour gradient image, Y1 represents the first reconstructed image, and Y2 represents the second reconstructed image;
[0089] The calculation formula for the third pixel-level subtraction process is as follows:
[0090] OUT = {R1 - R3} ∩ {Z > 0},
[0091] where R1 represents the first contour gradient image, R3 represents the third contour gradient image, OUT represents the foreign object detection result, and Z represents the pixel value obtained by subtracting the third contour gradient image from the first contour gradient image.
[0092] It should be noted that in some embodiments, the part where the pixel value obtained by subtracting the pixel level of the third contour gradient image from the pixel level of the first contour gradient image is greater than 0 is taken as the foreign object detection result. If the pixel value is less than 0, the part less than 0 is taken as 0, and 0 is used as the foreign object detection result.
[0093] It can be understood that the calculation formula for the dilation process is as follows:
[0094] D(X) = {a|Ba↑X}, R3 = D(R2),
[0095] Among them, D represents the dilation function, D(X) represents the expression of the dilation function, Ba represents the structuring element, X represents the image to be detected, a represents the set composed of the pixel points in the image to be detected that satisfy the structuring element, R2 represents the second contour gradient image, R3 represents the third contour gradient image, and D(R2) represents the dilation processing of the second contour gradient image.
[0096] It should be noted that a 3*3 dilation operation is used for the second contour gradient image for dilation processing to obtain the third contour gradient image.
[0097] Refer to Figure 6 , it can be understood that the siamese autoencoder network model is obtained through the following steps:
[0098] Step S210, obtain the sample training set;
[0099] Step S220, input the sample training set into the siamese autoencoder network model for regression training until the change rate of the loss function meets the preset conditions.
[0100] It should be noted that the sample training set is input into the siamese autoencoder network model for regression training to obtain the change rate of the loss function; according to the change rate of the loss function, the siamese autoencoder network model is retrained until the change rate of the loss function meets the preset conditions.
[0101] In this embodiment, the preset condition that is met is that the change rate of the loss function Loss is less than 0.1%. The sample training set includes collecting 3000 to 5000 training samples. The sample training set is input into the siamese autoencoder network model for regression training. The sample training set is input into the siamese autoencoder network model in the way of arranging multiple samples side by side, and the number of samples input at the same time can be set; according to the change rate of the loss function Loss between the (N - 1)th epoch and the Nth epoch, the siamese autoencoder network model is retrained until the change rate of the loss function Loss between the (N - 1)th epoch and the Nth epoch is less than 0.1%; for example, when the change rate of the loss function Loss between the 9th epoch and the 10th epoch is less than 0.1%, the training is stopped to obtain the trained siamese autoencoder network model. At this time, only 10 epochs need to be trained.
[0102] It can be understood that the calculation formula of the loss function used in the regression training is as follows:
[0103]
[0104] Among them, Loss represents the loss function, G represents the sample training set, x i represents the i-th component of the image to be detected, y irepresents the i-th component of the first reconstructed image and the second reconstructed image, λ represents hyperparameter data, and w i represents network parameter data.
[0105] It should be noted that λ represents hyperparameter data, that is, the parameter data set before training the Siamese autoencoder network model, rather than the parameter data obtained through training. In this embodiment, λ is set to 1e-9; w i The network parameter data represented is the parameter data that can independently reflect the characteristics of the Siamese autoencoder network; because it is an image reconstruction task, x = y.
[0106] In addition, the second aspect embodiment of the present invention also provides a foreign object detection device, which includes: a memory, a processor, and a computer program stored on the memory and executable on the processor.
[0107] The processor and the memory can be connected by a bus or other means.
[0108] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs and non-transitory computer-executable programs. In addition, the memory can include high-speed random access memory, and can also include non-transitory memory, such as at least one disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely set relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above networks include but are not limited to the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0109] The non-transitory software programs and instructions required to implement the foreign object detection method of the above first aspect embodiment are stored in the memory, and when executed by the processor, execute the foreign object detection method in the above embodiment. For example, execute the Figure 1 method steps S100 to S600 described above, Figure 2 method steps S201 to step S202 in Figure 3 method steps S203 to step S204 in Figure 4 method step S310 in Figure 5 method step S410 in Figure 6 method steps S210 to step S220 in
[0110] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0111] In addition, an embodiment of the present invention further provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are executed by a processor or a controller, for example, executed by a processor in the above device embodiment, the processor can execute the foreign object detection method in the above embodiment. For example, execute the method steps S100 to S600 described above Figure 1 in the method steps S100 to S600, Figure 2 in the method steps S201 to step S202, Figure 3 in the method steps S203 to step S204, Figure 4 in the method step S310, Figure 5 in the method step S410, Figure 6 in the method steps S210 to step S220.
[0112] Those of ordinary skill in the art can understand that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and appropriate combinations thereof. Some physical components or all physical components can be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include a computer storage medium (or a non-transitory medium) and a communication medium (or a transitory medium). As is well known to those of ordinary skill in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable instructions, data structures, program modules, or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassette, tape, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, as is well known to those of ordinary skill in the art, a communication medium generally contains computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and can include any information delivery medium.
[0113] The above is a specific description of the preferred embodiment of the present invention. However, the present invention is not limited to the above embodiments. Those skilled in the art can make various equivalent deformations or substitutions without departing from the spirit of the present invention. These equivalent deformations or substitutions are all included in the scope defined by the claims of the present invention.
Claims
1. A foreign object detection method, characterized in that, Including: Obtain the image to be detected; Input the image to be detected into the siamese auto - encoder network model to obtain a first reconstructed image and a second reconstructed image; Perform a first pixel - level subtraction operation on the image to be detected and the first reconstructed image to obtain a first contour gradient image containing foreign objects; Perform a second pixel - level subtraction operation on the first reconstructed image and the second reconstructed image to obtain a second contour gradient image; Perform a dilation operation on the second contour gradient image to obtain a third contour gradient image; Perform a third pixel - level subtraction operation on the first contour gradient image and the third contour gradient image to obtain a foreign object detection result; Wherein, the siamese auto - encoder network model is a fully convolutional network structure including a first auto - encoder, a second auto - encoder, and a decoder; the step of inputting the image to be detected into the siamese auto - encoder network model to obtain a first reconstructed image and a second reconstructed image includes: Input the image to be detected into the first auto - encoder to obtain a first processed image; Input the first processed image into the decoder to obtain a first reconstructed image; Input the image to be detected into the second auto - encoder to obtain a second processed image; Input the second processed image into the decoder to obtain a second reconstructed image.
2. The foreign object detection method according to claim 1, wherein The calculation formula of the first pixel - level subtraction operation is as follows: R1 = |X - Y1|, Wherein, R1 represents the first contour gradient image, X represents the image to be detected, and Y1 represents the first reconstructed image; The calculation formula of the second pixel - level subtraction operation is as follows: R2 = |Y2 - Y1|, Wherein, R2 represents the second contour gradient image, Y1 represents the first reconstructed image, and Y2 represents the second reconstructed image; The calculation formula of the third pixel - level subtraction operation is as follows: OUT = {R1 - R3} ∩ {Z > 0}, Wherein, R1 represents the first contour gradient image, R3 represents the third contour gradient image, OUT represents the foreign object detection result, and Z represents the pixel value obtained by subtracting the third contour gradient image from the first contour gradient image.
3. The foreign object detection method according to claim 1, wherein The calculation formula of the dilation operation is as follows: D(X) = {a|Ba↑X}, R3 = D(R2), Wherein, D represents the dilation function, D(X) represents the expression of the dilation function, Ba represents the structuring element, X represents the image to be detected, a represents the set of pixel points in the image to be detected that satisfy the structuring element, R2 represents the second contour gradient image, R3 represents the third contour gradient image, and D(R2) represents performing a dilation operation on the second contour gradient image.
4. The foreign object detection method according to claim 1, characterized in that The siamese auto - encoder network model is obtained by the following steps: Obtain a sample training set; Input the sample training set into the siamese auto - encoder network model for regression training until the change rate of the loss function meets the preset conditions.
5. The foreign object detection method according to claim 4, wherein The calculation formula of the loss function used in the regression training is as follows: Among them, Loss represents the loss function, G represents the sample training set, x i represents the i-th component of the image to be detected, y i represents the i-th component of the first reconstructed image and the second reconstructed image, λ represents hyperparameter data, w i represents network parameter data.
6. A foreign object detection device, characterized in that, Including: A memory, a processor, and a computer program stored on the memory and executable on the processor, wherein when the processor executes the computer program, the foreign object detection method according to any one of claims 1 to 5 is implemented.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions for causing a computer to execute the foreign object detection method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Static target detection method based on two-background differencing
CN107204006A
Remaining object recognition method, apparatus and device, and storage medium
CN111091097A