Method, device and electronic device for removing defective products based on product images

CN118558621BActive Publication Date: 2024-11-05TIMACO (JIANGSU) IND TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411043064.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-31
Publication Date
2024-11-05
Estimated Expiration
2044-07-31

AI Technical Summary

Technical Problem

Existing technologies cannot accurately detect and remove defective products from the conveyor line, resulting in high labor costs and a high risk of missed detections.

Method used

The camera is triggered by the Z-axis pulse of the encoder to take a picture, and the position of the defective product is calculated by the A-axis pulse of the encoder. The image is compared with the preset defective product sample, and the rejection device is controlled to reject the defective product at the accurate position.

Benefits of technology

It enables accurate detection and rejection of defective products, reducing labor costs and lowering the rate of missed detections.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118558621B_ABST
    Figure CN118558621B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device and electronic equipment for rejecting defective products based on product images. A camera is used to take pictures of products on a conveyor line, and a reject device is used to reject defective products. The direction in which the camera faces the reject device is a preset direction. The method comprises the following steps: triggering the camera to take pictures of each product one by one through a Z-direction pulse of an encoder to obtain a product image of each product; comparing the appearance information of the product in the product image with a preset product defect sample to determine that the product in the product image is a target image of a defective product; recording the first line number of the A-direction pulse of the encoder when the camera shoots the target image; calculating the increase in the number of lines of the A-direction pulse of the encoder when the defective product corresponding to the target image moves from the position of the camera to the position of the reject device; adding the first line number to the increase in the number of lines to obtain a second line number; and controlling the reject device to reject the defective product when the number of lines of the A-direction pulse of the encoder is equal to the second line number.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a method, device and electronic equipment for removing defective products based on product images. Background Art

[0002] Before products leave the factory, it is often necessary to test their quality to prevent defective products from entering the market and damaging the rights and interests of users.

[0003] At present, the detection of defective products is mainly completed through manual inspection, which not only consumes a lot of manpower and time costs, but also easily leads to missed inspections. Although some existing solutions can find defective products through image recognition technology, they cannot accurately remove defective products from the product conveyor line. Therefore, how to accurately detect defective products and remove them from the conveyor line has become a technical problem that needs to be solved urgently. Summary of the invention

[0004] The present invention provides a method, a device and an electronic device for removing defective products based on product images, so as to solve the defect in the prior art that products on a conveyor line cannot be accurately removed.

[0005] On the one hand, the present invention provides a method for removing defective products based on product images, wherein a conveyor line conveys products to be inspected at a preset speed and in a preset direction, a camera is used to take pictures of the products on the conveyor line, and a reject device is used to remove defective products, and the direction in which the camera faces the reject device is the preset direction, and the method comprises:

[0006] The camera is triggered by the Z-direction pulse of the encoder to take pictures of each product one by one to obtain a product image of each product;

[0007] Comparing the appearance information of the product in the product image with a preset product defect sample to determine that the product in the product image is a target image of a defective product;

[0008] Recording the first row number of the A-direction pulse of the encoder when the camera captures the target image;

[0009] Calculate the increase in the number of rows of the A-direction pulses of the encoder when the defective product corresponding to the target image moves from the position of the camera to the position of the reject device;

[0010] Adding the first row number and the row number increase amount to obtain a second row number;

[0011] When the number of rows of the A-direction pulses of the encoder is equal to the second number of rows, the reject device is controlled to reject the defective product.

[0012] According to a method for removing defective products based on product images provided by the present invention, the calculation of the increase in the number of rows of the A-direction pulses of the encoder when the defective product corresponding to the target image moves from the position of the camera to the position of the reject device includes:

[0013] Calculate a first ratio of the distance between the position of the camera and the position of the waste rejection device to the distance represented by a row of A-direction pulses of the encoder;

[0014] Calculate a second ratio of the rejection delay preset by the rejection device to the duration of the encoder sending a row of A-direction pulses; wherein the rejection delay is the time taken by the rejection device to reach the defective product;

[0015] The difference between the first ratio and the second ratio is calculated to obtain the increase in the number of rows of the A-direction pulses of the encoder.

[0016] According to a method for removing defective products based on product images provided by the present invention, after adding the first number of lines to the increase in the number of lines to obtain the second number of lines, the method further includes:

[0017] Storing the second row number in the queue;

[0018] The second number of rows is taken from the queue.

[0019] According to a method for removing defective products based on product images provided by the present invention, before comparing the appearance information of the product in the product image with a preset product defect sample, the method further includes:

[0020] Performing noise reduction processing on the product image; and / or

[0021] performing enhanced image processing on the product image; and / or

[0022] Performing background removal on the product image; and / or

[0023] The product image is grayscaled.

[0024] According to a method for removing defective products based on product images provided by the present invention, controlling the reject device to remove the defective products includes:

[0025] Controlling the reject device to reject the defective product from the conveyor line; or

[0026] The reject device is controlled to attach a defect label to the defective product; wherein the defect label has a one-to-one correspondence with the preset product defect sample.

[0027] According to a method for removing defective products based on product images provided by the present invention, after comparing the appearance information of the product in the product image with a preset product defect sample and determining that the product in the product image is a target image of a defective product, the method further includes:

[0028] Counting the number of defective products corresponding to each of the preset product defect samples;

[0029] Count the ratio of the number of each defective product to the total number of products.

[0030] According to a method for removing defective products based on product images provided by the present invention, after counting the ratio of the number of each defective product to the total number of products, the method further includes:

[0031] The number of defective products is displayed in the form of a bar chart, a pie chart or a ring chart.

[0032] On the other hand, the present invention also provides a device for removing defective products based on product images, wherein a conveyor line conveys products to be inspected at a preset speed and in a preset direction, a camera is used to take pictures of the products on the conveyor line, and a reject device is used to remove defective products, and the direction in which the camera faces the reject device is the preset direction, and the device comprises:

[0033] An image acquisition module is used to trigger the camera to take pictures of each product one by one through the Z-direction pulse of the encoder to obtain a product image of each product;

[0034] A defect image recognition module, used to compare the appearance information of the product in the product image with a preset product defect sample, and determine that the product in the product image is a target image of a defective product;

[0035] A first counting module, used for recording the first row number of the A-direction pulse of the encoder when the camera captures the target image;

[0036] A second counting module is used to calculate the increase in the number of rows of the A-direction pulses of the encoder when the defective product corresponding to the target image moves from the position of the camera to the position of the reject device;

[0037] A third counting module, configured to add the first row number and the row number increment to obtain a second row number;

[0038] The rejecting module is used to control the rejecting device to reject the defective product when the number of rows of the A-direction pulses of the encoder is equal to the second number of rows.

[0039] On the other hand, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, it implements any of the methods described above for eliminating defective products based on product images.

[0040] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the above-described methods for eliminating defective products based on product images.

[0041] The method, device and electronic device for rejecting defective products based on product images provided by the present invention trigger the camera to take pictures of each product one by one through the Z-direction pulse of the encoder to obtain the product image of each product, compare the appearance information of the product in the product image with the preset product defect sample, determine that the product in the product image is the target image of the defective product, record the first line number of the A-direction pulse of the encoder when the camera shoots the target image, calculate the increase in the number of lines of the A-direction pulse of the encoder when the defective product corresponding to the target image moves from the position of the camera to the position of the reject device, add the first line number and the increase in the number of lines to obtain the second line number, and when the line number of the A-direction pulse of the encoder is equal to the second line number, control the reject device to reject the defective product. By making full use of the relationship between the A-direction pulse and the Z-direction pulse of the encoder, it is possible to accurately obtain whether the defective product has been transported to the position of the reject device, so that the defective product can be accurately rejected. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0043] Figure 1 is a flow chart of a method for removing defective products based on product images provided by an embodiment of the present invention;

[0044] Figure 2 This is one of the schematic diagrams of application scenarios of the method for removing defective products based on product images provided by an embodiment of the present invention;

[0045] Figure 3 This is the second schematic diagram of an application scenario of the method for removing defective products based on product images provided by an embodiment of the present invention;

[0046] Figure 4 is a schematic diagram of the structure of a device for removing defective products based on product images provided by an embodiment of the present invention;

[0047] Figure 5 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0048] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0049] Figure 1 is a flow chart of a method for removing defective products based on product images provided by an embodiment of the present invention. The conveyor line conveys the products to be inspected at a preset speed and in a preset direction, such as Figure 2 As shown, Figure 2 This is one of the application scenario schematic diagrams of the method for removing defective products based on product images provided by an embodiment of the present invention. Figure 2 The direction indicated by the middle arrow is the preset direction. The camera is used to take pictures of the products on the conveyor line. The reject device is used to reject defective products. The direction of the camera toward the reject device is the preset direction. There can be multiple products to be tested, such as product one, product two, product three and product four, or more.

[0050] like Figure 1 As shown, the method for removing defective products based on product images provided in the embodiment of the present invention can be executed by a computer, a mobile phone or a smart wearable device. The method is mainly used to remove defective products on a conveyor line. The method mainly includes the following steps:

[0051] 101. The camera is triggered by the Z-direction pulse of the encoder to take pictures of each product one by one to obtain the product image of each product.

[0052] In this step, the encoder can output Z-direction pulses as well as A-direction pulses. The encoder outputs a Z-direction pulse every time it rotates one circle. Similarly, the number of A-direction pulses output by the encoder when it rotates one circle is also known.

[0053] 102. Compare appearance information of the product in the product image with a preset product defect sample to determine that the product in the product image is a target image of a defective product.

[0054] In this step, the product image and the preset product defect samples can be compared through visual software. Appearance information can include information such as the color, texture, shape and edge of the product. Defective products can include products with uneven colors, products with dents or cracks or scratches on the surface, etc.

[0055] 103. Record the first line number of the encoder's A-direction pulse when the camera captures the target image.

[0056] In this step, the A-direction pulse can be recorded by the counter of the programmable controller, and the Z-direction pulse can also be recorded by the counter.

[0057] 104. Calculate the increase in the number of lines of the A-direction pulse of the encoder when the defective product corresponding to the target image moves from the position of the camera to the position of the reject device.

[0058] In this step, the distance between the camera and the reject device is a known quantity. The frequency of the A-direction pulse output by the encoder is also a known quantity. Therefore, the number of rows of A-direction pulses output by the encoder when the defective product moves from the camera to the reject device can be obtained, that is, the increase in the number of A-direction pulses.

[0059] 105. Add the first row number and the row number increase to obtain the second row number.

[0060] In this step, the second row number represents the row number of A-direction pulses recorded when the defective product moves from the position of the camera to the position of the reject device.

[0061] 106. When the number of lines of the A-direction pulse of the encoder is equal to the second number of lines, the reject device is controlled to reject defective products.

[0062] In this step, the type of the reject device can be a labeling device for labeling defective products, or a robot device for removing defective products from the conveyor line.

[0063] In this embodiment, the camera is triggered by the Z-direction pulse of the encoder to take pictures of each product one by one to obtain the product image of each product, and the appearance information of the product in the product image is compared with the preset product defect sample to determine that the product in the product image is the target image of the defective product, and the first line number of the A-direction pulse of the encoder is recorded when the camera takes the target image, and the increase in the number of lines of the A-direction pulse of the encoder is calculated when the defective product corresponding to the target image moves from the position of the camera to the position of the waste rejection device, and the first line number is added to the increase in the number of lines to obtain the second line number. When the line number of the A-direction pulse of the encoder is equal to the second line number, the waste rejection device is controlled to reject the defective product. By making full use of the relationship between the A-direction pulse and the Z-direction pulse of the encoder, this embodiment can accurately obtain whether the defective product has been transported to the position of the waste rejection device, so that the defective product can be accurately rejected.

[0064] In one embodiment of the present invention, the calculation of the increase in the number of lines of the A-direction pulse of the encoder when the defective product corresponding to the target image moves from the position of the camera to the position of the reject device includes:

[0065] Calculate a first ratio of the distance between the position of the camera and the position of the waste rejection device to the distance represented by a row of A-direction pulses of the encoder;

[0066] Calculate a second ratio of a preset rejection delay of the rejection device to the duration of a row of A-direction pulses sent by the encoder; wherein the rejection delay is the time taken by the rejection device to reach the defective product;

[0067] The difference between the first ratio and the second ratio is calculated to obtain the increase in the number of lines of the A-direction pulse of the encoder.

[0068] In this embodiment, it can be understood that the parameters of the A-direction pulse of the encoder are all known. For example, the number of rows of A-direction pulses output by the encoder when it rotates one circle is known, the distance represented by each row of A-direction pulses is also known, and the frequency of A-direction pulses is also known. When the reject device receives the instruction to reject defective products, the action of the reject device often has a certain delay when it reaches the defective product. The first ratio represents the increase in the number of A-direction pulses when the defective product is transported from the location of the camera to the location of the reject device under the ideal state without delay. The second ratio represents the number of rows of A-direction pulses output by the encoder when the reject device receives the rejection instruction and the rejection action reaches the location of the defective product. The difference between the first ratio and the second ratio represents the increase in the number of A-direction pulses of the encoder from the time when the camera takes a picture to the time when the reject device receives the instruction to reject the defective product. In this embodiment, the difference between the first ratio and the second ratio is used as the final increase in the number of A-direction pulses, which can ensure that when the defective product is transported to the location of the reject device, the action of the reject device just arrives, so that the defective product can be accurately rejected. Because the delay of the reject device to reach the position of the defective product is generally small, technicians in this field tend to ignore this problem. However, the conveyor line continuously conveys products, which may lead to the possibility of failure in rejecting defective products as time goes by. This embodiment discovers this problem, breaks through the shackles of the above traditional thinking, and ensures the successful rejection of defective products.

[0069] In one embodiment of the present invention, after adding the first row number and the row number increment to obtain the second row number, the method further includes:

[0070] Store the second row number into the queue;

[0071] Take the second row number from the queue.

[0072] In this embodiment, there are often multiple defective products. Because the data in the queue has a first-in-first-out feature, the second row number is stored in the queue, and the second row number is taken out from the queue. The defective products can be removed one by one in the order in which they are arranged (i.e., the order in which the defective products are found), avoiding the phenomenon of wrong removal or missed removal.

[0073] In one embodiment of the present invention, before comparing the appearance information of the product in the product image with the preset product defect sample, the method further includes:

[0074] Perform noise reduction on product images; and / or

[0075] Performing enhanced image processing on product images; and / or

[0076] Perform background subtraction on product images; and / or

[0077] Grayscale the product image.

[0078] In this embodiment, the noise reduction process is to reduce the noise in the product image. Enhanced image processing can improve the resolution of the product image and make the image clearer. Background removal processing of the product image can make the features of the product in the product image more prominent, reduce background interference, and improve the accuracy of defect detection. Grayscale processing of the product image can reduce the complexity of the image data and make the defect search process more efficient. In summary, before comparing the appearance information of the product in the product image with the preset product defect sample, the product image is optimized in the above manner, which can facilitate more efficient discovery of product defects.

[0079] In one embodiment of the present invention, controlling the reject device to reject defective products includes:

[0080] Controlling the reject device to remove defective products from the conveyor line; or

[0081] The reject device is controlled to attach defect labels to defective products; wherein the defect labels have a one-to-one correspondence with preset product defect samples.

[0082] In this embodiment, under normal circumstances, when the shape of the defective product is a fixed shape, the defective product can be removed from the conveyor line. For example, when the defective product is a cigarette box, a soda bottle, or a metal part, it can be removed. When the shape of the defective product is a variable shape, a defective label can be affixed to the defective product. For example, when the defective product is a towel or a soft food packaging bag, a label can be affixed. The defective label has a one-to-one correspondence with the preset product defect sample, that is, the defective product is classified and labeled, which is convenient for the staff to classify and count the defective products and improve the work efficiency of the staff.

[0083] In one embodiment of the present invention, after comparing the appearance information of the product in the product image with the preset product defect sample and determining that the product in the product image is a target image of a defective product, the method further includes:

[0084] Count the number of defective products corresponding to each preset product defect sample;

[0085] Count the ratio of the number of defective products to the total number of products.

[0086] In this embodiment, the number of defective products corresponding to each preset product defect sample is counted, and the ratio of each defective product number to the total number of products is counted, so as to facilitate classification of defective products according to defect type, thereby facilitating improvement. For example, if the total number of products is 100, the number of color defective products is 5, the number of surface dent products is 2, and the number of crack products is 1, then the ratios of the three are 0.05, 0.02, and 0.01, respectively.

[0087] In one embodiment of the present invention, after calculating the ratio of the number of defective products to the total number of products, the method further includes:

[0088] Use a bar chart, pie chart or donut chart to display the number of defective products.

[0089] In this embodiment, a bar chart, a pie chart or a doughnut chart is used to display the number of each defective product, so that the staff can more intuitively understand the proportion of each type of defective product.

[0090] In some other embodiments of the present invention, the conveyor line may be a ring-shaped conveyor line. Figure 3 , Figure 3 This is the second schematic diagram of an application scenario of the method for eliminating defective products based on product images provided by an embodiment of the present invention. Figure 3 The direction of the middle arrow is the rotation direction of the conveyor line. There are multiple products to be tested on the conveyor line, such as product 1, product 2, product 3 and product 4. The cycle time of a product rotating on the conveyor line is a known quantity. The conveying time of the product on the conveyor line is counted. When the conveying time is equal to the cycle time, the product on the conveyor line is controlled to flip so that the side of the product facing away from the camera is flipped to the side facing the camera. Alternatively, the position of the product on the conveyor line is detected. When the product passes the position of the waste rejection device, the product after the position of the waste rejection device is controlled to flip so that the side of the product facing away from the camera is flipped to the side facing the camera.

[0091] In this embodiment, considering that the camera can only take pictures of one side of the product at a time, and the other side of the product may also have defects. Therefore, the conveyor line is set as a circular conveyor line. When the product passes the position where the waste rejection device is located, or the conveying time of the product on the conveyor line is equal to the cycle time, the side of the product facing away from the camera is turned to the side facing the camera, so that the camera can take pictures of the other side of the product for inspection. The concept of this embodiment is novel and ingenious, and can detect product defects in a more comprehensive manner, further reducing the possibility of defective products being missed.

[0092] Generally, the shape of the product in this embodiment is a fixed-shape product, such as a cigarette box or a device, etc. There are many ways to flip the product, for example, the product can be rotated by a robot, or the area where the product is located is set as a rotatable area, and the product is flipped by rotating the rotatable area.

[0093] In some other embodiments, when the conveyor line is a unidirectional conveyor line rather than a circular conveyor line, cameras and waste rejection devices can be set on both sides of the product, so that both sides of the product can be photographed for defect detection, thereby reducing the possibility of defective products being missed.

[0094] When a camera and a reject device are respectively arranged on both sides of a product, the two reject devices should avoid being arranged opposite to each other, that is, there should be a lateral spacing between the two reject devices to avoid the phenomenon that the two reject devices reject the same defective product at the same time.

[0095] The present invention is introduced below through a specific example.

[0096] The encodable controller establishes a connection with the host computer and the industrial computer through the Ethernet Mubdus TCP protocol. The encodable controller can record the A-direction pulse, B-direction pulse (which can be used as a backup) and Z-direction pulse output by the encoder through a high-speed pulse counter. The host computer obtains the product image, and the host computer can compare the appearance information of the product in the product image with the preset product defect sample through the visual software to determine that the product in the product image is the target image of the defective product. When the visual software detects a defective product, the visual software records the number of rows of the encoder's A-direction pulse when the camera captures the target image, and sends the recorded results to the encodable controller. The encodable controller stores the received results in the queue. Afterwards, the encodable controller retrieves the saved results from the queue. When it is determined that the defective product has reached the location of the rejection device based on the retrieved results, the encodable controller can control the rejection device through the industrial computer to reject the defective product. Afterwards, the encodable controller continues to extract the stored results from the queue and continues to reject defective products.

[0097] Based on the same general inventive concept, the present invention also protects a device for removing defective products based on product images, see Figure 4 , Figure 4 1 is a schematic diagram of the structure of the device for removing defective products based on product images provided by an embodiment of the present invention. The device for removing defective products based on product images provided by the present invention is described below, and the device for removing defective products based on product images described below and the method for removing defective products based on product images described above can be referred to each other.

[0098] The device includes an image acquisition module 501 , a defective image recognition module 502 , a first counting module 503 , a second counting module 504 , a third counting module 505 and a rejection module 506 .

[0099] The image acquisition module 501 is used to trigger the camera to take pictures of each product one by one through the Z-direction pulse of the encoder to obtain the product image of each product;

[0100] The defect image recognition module 502 is used to compare the appearance information of the product in the product image with the preset product defect sample, and determine that the product in the product image is a target image of a defective product;

[0101] The first counting module 503 is used to record the first row number of the A-direction pulse of the encoder when the camera captures the target image;

[0102] The second counting module 504 is used to calculate the increase in the number of lines of the A-direction pulse of the encoder when the defective product corresponding to the target image moves from the position of the camera to the position of the reject device;

[0103] The third counting module 505 is used to add the first row number and the row number increment to obtain a second row number;

[0104] The rejecting module 506 is used to control the rejecting device to reject defective products when the number of rows of the A-direction pulses of the encoder is equal to the second number of rows.

[0105] Figure 5 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.

[0106] like Figure 5 As shown, the electronic device may include: a processor 610, a communication interface 620, a memory 630 and a communication bus 640, wherein the processor 610, the communication interface 620 and the memory 630 communicate with each other through the communication bus 640. The processor 610 may call the logic instructions in the memory 630 to execute a method for removing defective products based on product images, the method comprising: triggering the camera to take pictures of each product one by one through the Z-direction pulse of the encoder to obtain the product image of each product;

[0107] Comparing the appearance information of the product in the product image with a preset product defect sample to determine that the product in the product image is a target image of a defective product;

[0108] Recording the first row number of the A-direction pulse of the encoder when the camera captures the target image;

[0109] Calculate the increase in the number of rows of the A-direction pulses of the encoder when the defective product corresponding to the target image moves from the position of the camera to the position of the reject device;

[0110] Adding the first row number and the row number increase amount to obtain a second row number;

[0111] When the number of rows of the A-direction pulses of the encoder is equal to the second number of rows, the reject device is controlled to reject the defective product.

[0112] In addition, the logic instructions in the above-mentioned memory 630 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and 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, etc. Various media that can store program codes.

[0113] On the other hand, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to perform the method for removing defective products based on product images provided by the above methods, the method comprising: triggering the camera to take pictures of each product one by one through the Z-direction pulse of the encoder to obtain the product image of each product;

[0114] Comparing the appearance information of the product in the product image with a preset product defect sample to determine that the product in the product image is a target image of a defective product;

[0115] Recording the first row number of the A-direction pulse of the encoder when the camera captures the target image;

[0116] Calculate the increase in the number of rows of the A-direction pulses of the encoder when the defective product corresponding to the target image moves from the position of the camera to the position of the reject device;

[0117] Adding the first row number and the row number increase amount to obtain a second row number;

[0118] When the number of rows of the A-direction pulses of the encoder is equal to the second number of rows, the reject device is controlled to reject the defective product.

[0119] In another aspect, the present invention further provides a computer program product, the computer program product comprising a computer program, the computer program can be stored in a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the method for removing defective products based on product images provided by the above methods, the method comprising: triggering the camera to take pictures of each product one by one through the Z-direction pulse of the encoder to obtain the product image of each product;

[0120] Comparing the appearance information of the product in the product image with a preset product defect sample to determine that the product in the product image is a target image of a defective product;

[0121] Recording the first row number of the A-direction pulse of the encoder when the camera captures the target image;

[0122] Calculate the increase in the number of rows of the A-direction pulses of the encoder when the defective product corresponding to the target image moves from the position of the camera to the position of the reject device;

[0123] Adding the first row number and the row number increase amount to obtain a second row number;

[0124] When the number of rows of the A-direction pulses of the encoder is equal to the second number of rows, the reject device is controlled to reject the defective product.

[0125] 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.

[0126] 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.

[0127] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for removing defective products based on product images, characterized in that: The conveyor line conveys the products to be inspected at a preset speed and in a preset direction, the camera is used to take pictures of the products on the conveyor line, the reject device is used to reject defective products, the direction of the camera toward the reject device is the preset direction, and the method includes: The camera is triggered by the Z-direction pulse of the encoder to take pictures of each product one by one to obtain a product image of each product; Comparing the appearance information of the product in the product image with a preset product defect sample to determine that the product in the product image is a target image of a defective product; Recording the first row number of the A-direction pulse of the encoder when the camera captures the target image; Calculate the increase in the number of rows of the A-direction pulses of the encoder when the defective product corresponding to the target image moves from the position of the camera to the position of the reject device; Adding the first row number and the row number increase amount to obtain a second row number; When the number of rows of the A-direction pulses of the encoder is equal to the second number of rows, controlling the reject device to reject the defective product; The step of calculating the increase in the number of rows of the A-direction pulses of the encoder when the defective product corresponding to the target image moves from the position of the camera to the position of the reject device includes: Calculate a first ratio of the distance between the position of the camera and the position of the waste rejection device to the distance represented by a row of A-direction pulses of the encoder; Calculate a second ratio of the rejection delay preset by the rejection device to the duration of the encoder sending a row of A-direction pulses; wherein the rejection delay is the time taken by the rejection device to reach the defective product; The difference between the first ratio and the second ratio is calculated to obtain the increase in the number of rows of the A-direction pulses of the encoder.

2. The method for eliminating defective products based on product images according to claim 1, characterized in that: After adding the first number of rows to the row number increment to obtain the second number of rows, the method further includes: Storing the second row number in the queue; The second number of rows is taken from the queue.

3. The method for removing defective products based on product images according to claim 1, characterized in that: Before comparing the appearance information of the product in the product image with the preset product defect sample, the method further includes: Performing noise reduction processing on the product image; and / or performing enhanced image processing on the product image; and / or Performing background removal on the product image; and / or The product image is grayscaled.

4. The method for removing defective products based on product images according to claim 1, characterized in that: The controlling the reject device to reject the defective product comprises: Controlling the reject device to reject the defective product from the conveyor line; or The reject device is controlled to attach a defect label to the defective product; wherein the defect label has a one-to-one correspondence with the preset product defect sample.

5. The method for removing defective products based on product images according to claim 1, characterized in that: After comparing the appearance information of the product in the product image with a preset product defect sample to determine that the product in the product image is a target image of a defective product, the method further includes: Counting the number of defective products corresponding to each of the preset product defect samples; Count the ratio of the number of each defective product to the total number of products.

6. The method for removing defective products based on product images according to claim 5, characterized in that: After counting the ratio of the number of each defective product to the total number of products, the method further includes: The number of defective products is displayed in the form of a bar chart, a pie chart or a ring chart.

7. A device for removing defective products based on product images, characterized in that: The conveyor line conveys the products to be inspected at a preset speed and in a preset direction. The camera is used to take pictures of the products on the conveyor line. The reject device is used to reject defective products. The direction of the camera toward the reject device is the preset direction. The device includes: An image acquisition module is used to trigger the camera to take pictures of each product one by one through the Z-direction pulse of the encoder to obtain a product image of each product; A defect image recognition module, used to compare the appearance information of the product in the product image with a preset product defect sample, and determine that the product in the product image is a target image of a defective product; A first counting module, used for recording the first row number of the A-direction pulse of the encoder when the camera captures the target image; A second counting module is used to calculate the increase in the number of rows of the A-direction pulses of the encoder when the defective product corresponding to the target image moves from the position of the camera to the position of the reject device; A third counting module, configured to add the first row number and the row number increment to obtain a second row number; A rejection module, used for controlling the rejection device to reject the defective product when the number of rows of the A-direction pulses of the encoder is equal to the second number of rows; The calculation of the increase in the number of lines of the A-direction pulses of the encoder when the defective product corresponding to the target image moves from the position of the camera to the position of the reject device includes: Calculate a first ratio of the distance between the position of the camera and the position of the waste rejection device to the distance represented by a row of A-direction pulses of the encoder; Calculate a second ratio of the rejection delay preset by the rejection device to the duration of the encoder sending a row of A-direction pulses; wherein the rejection delay is the time taken by the rejection device to reach the defective product; The difference between the first ratio and the second ratio is calculated to obtain the increase in the number of rows of the A-direction pulses of the encoder.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method for eliminating defective products based on product images as described in any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for eliminating defective products based on product images as described in any one of claims 1 to 6 is implemented.