A method and device for determining impurities in a transparent container

Through differential image technology and object detection algorithm, the impurities in liquor and impurities in liquor bottles are accurately distinguished, and the problem of judging quality errors in the prior art is solved, and the determination effect of liquor quality is improved.

CN112381776BActive Publication Date: 2024-11-12WEBANK (CHINA)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011237632.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-09
Publication Date
2024-11-12
Estimated Expiration
2040-11-09

AI Technical Summary

Technical Problem

The prior art cannot accurately distinguish between impurities in liquor and impurities in liquor bottles, resulting in errors in determining the quality of liquor.

Method used

By acquiring multiple images, generating differential images, and determining impurities using a preset object detection algorithm, distinguishing impurities located in transparent containers, ensuring that the identified impurities are located in the container rather than in the container.

Benefits of technology

It improves the accuracy of the quality of the wine, reduces the rate of misjudgment, and ensures the accurate determination of the quality of the wine.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112381776B_ABST
    Figure CN112381776B_ABST
Patent Text Reader

Abstract

The present application relates to the field of computer vision technology, and discloses a method and device for determining impurities in contents located in a transparent container. The method first obtains multiple images; the multiple images are images of the contents at different times when the contents are in a dynamic state; then determines a differential image between a reference image and a comparison image, and the reference image and the comparison image are any two different images in the multiple images; then determines the impurity points in the reference image through a preset target detection algorithm; finally, determines the impurity points with the same position as the differential image as the impurities in the contents. The scheme first obtains a differential image through a differential algorithm, and then executes a target detection algorithm on the reference image to determine all impurities, including impurities in the contents and impurities in the transparent container. Finally, according to the corresponding relationship between the impurity points in the differential image and the reference image, accurately determines that one / some impurity points are impurities in the contents, thereby achieving the purpose of accurately identifying the specific location of the impurities.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer vision technology, and more particularly to a method and device for determining impurities in contents in a transparent container. Background Art

[0002] As people's living standards improve, their requirements for the quality of liquor are getting higher and higher. Although liquor is usually sold according to different qualities or grades in the market, if there are impurities in the liquor to be shipped, it will affect the quality of the liquor and thus affect the sale of the liquor.

[0003] The existing technology uses the target detection algorithm to detect the quality of liquor. The target detection algorithm can determine all impurities in a colorless transparent bottle containing liquor. However, this method cannot accurately determine whether the impurities are impurities in the liquor itself or impurities in the bottle containing the liquor, that is, it cannot distinguish between impurities in the bottle, bubbles in the bottle, impurities in the liquor, etc., which can easily lead to misjudgment of the quality of the liquor.

[0004] In summary, there is an urgent need for a method to accurately determine the impurities in wine, so as to improve the effect of determining the quality of the wine. Summary of the invention

[0005] The present application provides a method and device for determining impurities in contents located in a transparent container, so as to solve the problem that the prior art cannot accurately determine impurities in wine, thereby improving the effect of determining the quality of the wine.

[0006] In a first aspect, an embodiment of the present application provides a method for determining impurities in contents located in a transparent container, the method comprising: acquiring multiple images; the multiple images are images of the contents at different moments when the contents are in a dynamic state; wherein the transparent container is in a stationary state at the different moments; determining a differential image between a reference image and a comparison image, the reference image and the comparison image being any two different images among the multiple images; determining impurity points in the reference image through a preset target detection algorithm; and determining impurity points having the same position in the reference image and the differential image as impurities in the contents.

[0007] Based on this scheme, for the moving contents in the transparent container, its images at multiple different times are collected, and two different images are randomly selected as the reference image and the comparison image, and the difference image between the two is further generated. After the impurity points in the reference image are determined using the preset target detection algorithm, it can be determined that the impurity points in the reference image that have the same position as the differential image are impurities in the contents, rather than impurities located on the transparent container. This scheme first obtains a differential image through a differential algorithm, and then executes a target detection algorithm on the reference image to determine all impurities, including impurities in the contents and impurities in the transparent container. Finally, according to the corresponding relationship between the impurity points in the differential image and the reference image, it is accurately determined that one / some impurity points are impurities in the contents, thereby achieving the purpose of accurately identifying the specific location of the impurities. When this scheme is applied to liquor detection, it will greatly improve the effect of determining the quality of the liquor.

[0008] In one possible method, the multiple images include at least three images; determining the differential image between the reference image and the comparison image includes: determining a reference image from the multiple images; using any image of the multiple images except the reference image as the comparison image; determining a differential image between the reference image and the comparison image for each comparison image; determining impurity points having the same position as the differential image as impurities of the contents includes: if an impurity point in the reference image has the same position as an impurity point in any one of the multiple differential images, determining the impurity point to be an impurity of the contents.

[0009] Based on this scheme, in order to further improve the recognition effect of impurities in the contents, at least three images can be selected and any one of them can be used as a reference image, and the images of the at least three images excluding the determined reference image can be used as comparison images. By forming differential images between the multiple comparison images and the reference image respectively, for each of the multiple differential images formed, the impurity points that have the same position as the reference image can be confirmed one by one. Finally, the impurity points pointed to by multiple recognition results can be determined as impurities in the contents. In this way, the recognition effect can be improved and the probability of misjudgment can be reduced.

[0010] In a possible implementation method, the acquiring of the plurality of images includes: allowing the transparent container in motion to stand still for a set period of time, and then continuously capturing the plurality of images from a preset angle.

[0011] Based on this scheme, when identifying impurities in the contents, a transparent container that is initially in a moving state can be left still for a period of time so that the movement amplitude of the contents in the transparent container is appropriate, and then the transparent container is photographed at a preset angle. In this way, the pixel points at the same position in the comparison image and the reference image are calculated to form a differential image.

[0012] In one possible method, determining the differential image between the reference image and the comparison image for each comparison image includes: determining the differential image between the reference image and each comparison image in sequence according to the shooting time of each comparison image; the method also includes: determining the movement state of impurities in the contents based on each differential image.

[0013] Based on this scheme, the differential images are calculated in turn between the multiple contrast images obtained by continuous shooting and the reference image, so as to further determine the movement state of the impurities in the contents and provide a reference for the subsequent selection of methods for removing impurities.

[0014] In one possible implementation method, determining the differential image between the reference image and the comparison image includes: for the same pixel in the reference image and the comparison image, determining the first value of the pixel in the reference image and the second value of the pixel in the comparison image; determining the absolute value of the difference between the first value and the second value; and obtaining the differential image between the reference image and the comparison image based on the absolute value corresponding to each pixel.

[0015] Based on this solution, by calculating the absolute value of the difference between the pixel values ​​of the reference image and the comparison image at the same position one by one, a differential image can be obtained quickly and accurately.

[0016] In a possible implementation method, the method further includes: for the impurity point displayed in the reference image, if the impurity point is not displayed in the differential image, determining that the impurity point is an impurity of the transparent container.

[0017] Based on this scheme, when identifying impurities in the contents, there may be impurity points that only appear in the reference image, but this / these impurity points do not appear in the differential image, which can indicate that this / these impurity points are impurities in the transparent container. In this way, it can be indirectly confirmed that the impurity points in the reference image and the differential image with the same position are impurities in the contents.

[0018] In a possible method, the contents are transparent liquids; and there is a color distinction between any two of the transparent container, the transparent liquid, and the impurities.

[0019] Based on this solution, when the contents are transparent liquids and it is determined that there is a color distinction between any two of the transparent container, the transparent liquid and the impurities (of the contents), the effectiveness of the target detection algorithm and the differential algorithm will be greatly improved.

[0020] In a second aspect, an embodiment of the present application provides a device for determining impurities in contents located in a transparent container, the device comprising: an image acquisition unit, for acquiring multiple images; the multiple images are images of the contents at different moments in a dynamic state; wherein the transparent container is in a stationary state at the different moments; a differential image determination unit, for determining a differential image between a reference image and a comparison image, the reference image and the comparison image being any two different images among the multiple images; an impurity point determination unit, for determining impurity points in the reference image by using a preset target detection algorithm; an impurity determination unit, for determining impurity points having the same position in the reference image and the differential image as impurities in the contents.

[0021] Based on this scheme, for the moving contents in the transparent container, its images at multiple different times are collected, and two different images are randomly selected as the reference image and the comparison image, and the difference image between the two is further generated. After the impurity points in the reference image are determined using the preset target detection algorithm, it can be determined that the impurity points in the reference image that have the same position as the differential image are impurities in the contents, rather than impurities located on the transparent container. This scheme first obtains a differential image through a differential algorithm, and then executes a target detection algorithm on the reference image to determine all impurities, including impurities in the contents and impurities in the transparent container. Finally, according to the corresponding relationship between the impurity points in the differential image and the reference image, it is accurately determined that one / some impurity points are impurities in the contents, thereby achieving the purpose of accurately identifying the specific location of the impurities. When this scheme is applied to liquor detection, it will greatly improve the effect of determining the quality of the liquor.

[0022] In one possible implementation method, the multiple images include at least three images; the differential image determination unit is specifically used to determine a reference image from the multiple images; any image of the multiple images except the reference image is used as the comparison image; for each comparison image, a differential image between the reference image and the comparison image is determined; the impurity determination unit is specifically used to determine that an impurity point in the reference image is an impurity of the contents if the impurity point in the reference image has the same position as an impurity point in any one of the multiple differential images.

[0023] Based on this scheme, in order to further improve the recognition effect of impurities in the contents, at least three images can be selected and any one of them can be used as a reference image, and the images of the at least three images excluding the determined reference image can be used as comparison images. By forming differential images between the multiple comparison images and the reference image respectively, for each of the multiple differential images formed, the impurity points that have the same position as the reference image can be confirmed one by one. Finally, the impurity points pointed to by multiple recognition results can be determined as impurities in the contents. In this way, the recognition effect can be improved and the probability of misjudgment can be reduced.

[0024] In a possible implementation method, the image acquisition unit is specifically configured to continuously capture a plurality of images from a preset angle after the transparent container in motion is left stationary for a set period of time.

[0025] Based on this scheme, when identifying impurities in the contents, a transparent container that is initially in a moving state can be left still for a period of time so that the movement amplitude of the contents in the transparent container is appropriate, and then the transparent container is photographed at a preset angle. In this way, the pixel points at the same position in the comparison image and the reference image are calculated to form a differential image.

[0026] In one possible implementation method, the differential image determination unit is specifically used to determine the differential image between the reference image and each comparison image in sequence according to the shooting time of each comparison image; the device also includes an impurity motion state determination unit, which is used to determine the motion state of the impurities in the contents according to each differential image.

[0027] Based on this scheme, the differential images are calculated in turn between the multiple contrast images obtained by continuous shooting and the reference image, so as to further determine the movement state of the impurities in the contents and provide a reference for the subsequent selection of methods for removing impurities.

[0028] In one possible implementation method, the differential image determination unit is specifically used to determine, for the same pixel point in the reference image and the comparison image, a first value of the pixel point in the reference image and a second value of the pixel point in the comparison image; determine an absolute value of the difference between the first value and the second value; and obtain a differential image between the reference image and the comparison image based on the absolute value corresponding to each pixel point.

[0029] Based on this solution, by calculating the absolute value of the difference between the pixel values ​​of the reference image and the comparison image at the same position one by one, a differential image can be obtained quickly and accurately.

[0030] In a possible implementation method, the impurity determination unit is further configured to determine, for an impurity point displayed in the reference image, that the impurity point is an impurity of the transparent container if the impurity point is not displayed in the differential image.

[0031] Based on this scheme, when identifying impurities in the contents, there may be impurity points that only appear in the reference image, but this / these impurity points do not appear in the differential image, which can indicate that this / these impurity points are impurities in the transparent container. In this way, it can be indirectly confirmed that the impurity points in the reference image and the differential image with the same position are impurities in the contents.

[0032] In a possible method, the contents are transparent liquids; and there is a color distinction between any two of the transparent container, the transparent liquid, and the impurities.

[0033] Based on this solution, when the contents are transparent liquids and it is determined that there is a color distinction between any two of the transparent container, the transparent liquid and the impurities (of the contents), the effectiveness of the target detection algorithm and the differential algorithm will be greatly improved.

[0034] In a third aspect, an embodiment of the present application provides a computing device, including:

[0035] Memory for storing computer programs;

[0036] The processor is used to call the computer program stored in the memory and execute any method as described in the first aspect according to the obtained program.

[0037] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is used to enable a computer to execute any method as described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0039] Figure 1 A possible system architecture diagram provided for an embodiment of the present application;

[0040] Figure 2 A method for determining impurities in a content in a transparent container provided in an embodiment of the present application;

[0041] Figure 3A motion state diagram of a transparent container filled with a transparent liquid at multiple moments provided in an embodiment of the present application;

[0042] Figure 4 A differential image provided by an embodiment of the present application;

[0043] Figure 5 A schematic diagram of a target detection result provided in an embodiment of the present application;

[0044] Figure 6 A schematic diagram of multiple differential images provided in an embodiment of the present application;

[0045] Figure 7 A device for determining impurities in a content in a transparent container provided in an embodiment of the present application;

[0046] Figure 8 A schematic diagram of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.

[0048] At present, all major liquor manufacturers must strictly implement a quality inspection method to detect impurities in liquor before it leaves the factory to determine its quality. In this regard, by using the target detection algorithm, all impurities in the colorless and transparent bottle containing liquor can be identified. However, this method cannot accurately distinguish between impurities in the liquor and impurities in the bottle, which will affect the determination of the liquor quality.

[0049] like Figure 1 , which is a schematic diagram of a possible system architecture provided by an embodiment of the present application, through which wine impurities can be accurately determined. The system includes an image acquisition unit 110 and a server 120. Optionally, the system also includes a transparent container 130.

[0050] The image acquisition unit 110 may be a camera, a video camera or other device, which is used to acquire images, such as an image of the transparent container 130 , and upload the acquired image to the server 120 , which performs data processing on the image.

[0051] The server 120 may be a single server or a server cluster composed of multiple servers. The server 120 is used to receive the image captured by the image acquisition unit 110, perform data processing on the image, and output the result of the data processing. The result of the data processing includes determining which impurities belong to the contents and which impurities belong to the bottle body.

[0052] The transparent container 130 can be a container of any shape and size. When the image acquisition unit 110 acquires an image of the transparent container 130, on the one hand, the transparent container 130 contains a substance, and the substance is in motion, and on the other hand, the shooting angle between the image acquisition unit 110 and the transparent container 130 is fixed, that is, for the same transparent container, after the image acquisition unit 110 determines to acquire an image of it at a certain angle, the relative position between the two will be fixed until the image acquisition unit 110 finishes acquiring the image of the transparent container.

[0053] Based on the background technology and Figure 1 The system architecture shown in the figure, the embodiment of the present application provides a method for determining impurities in the contents of a transparent container, such as Figure 2 As shown, the method can be executed in a server or a data processing device, and can execute:

[0054] Step 201, obtaining multiple images.

[0055] In step 201, the plurality of images are images of the contents at different moments when the contents are in a dynamic state, and the transparent container is in a static state at the different moments.

[0056] When identifying impurities in the contents of a container, the container used must be made of a transparent material. The embodiment of the present application does not specifically limit the shape, size, thickness and other properties of the transparent container.

[0057] When using transparent containers to hold items, the items contained may be substances in various physical forms, such as liquid and gaseous substances. The present application does not make any specific restrictions on the color of the items contained.

[0058] Step 202: determine a difference image between the reference image and the comparison image.

[0059] In this step, the reference image and the comparison image are any two different images among the multiple images.

[0060] Step 203: determine the impurity points in the reference image by using a preset target detection algorithm.

[0061] Step 204: determine the impurity points at the same position as the differential image as impurities of the contents.

[0062] Based on this scheme, for the moving contents in the transparent container, its images at multiple different times are collected, and two different images are randomly selected as the reference image and the comparison image, and the difference image between the two is further generated. After the impurity points in the reference image are determined using the preset target detection algorithm, it can be determined that the impurity points in the reference image that have the same position as the differential image are impurities in the contents, rather than impurities located on the transparent container. This scheme first obtains a differential image through a differential algorithm, and then executes a target detection algorithm on the reference image to determine all impurities, including impurities in the contents and impurities in the transparent container. Finally, according to the corresponding relationship between the impurity points in the differential image and the reference image, it is accurately determined that one / some impurity points are impurities in the contents, thereby achieving the purpose of accurately identifying the specific location of the impurities. When this scheme is applied to liquor detection, it will greatly improve the effect of determining the quality of the liquor.

[0063] The following will explain the above steps in detail with examples.

[0064] In one implementation of the above step 201, the contents are transparent liquids, and the impurities of which colors may exist in the transparent liquid can be obtained in advance by the technicians through experience. For example, there may be black flocculent impurities in white wine, and there may be white granular impurities in cola. In this way, in the process of identifying impurities in the transparent liquid, it can be determined what color of transparent container to use according to the color of the transparent liquid and the color of the impurities in the transparent liquid, that is, the color distinction between any two of the transparent container, the transparent liquid and the impurities in the transparent liquid is controlled, so that all impurities can be better detected. For example, in the case where black flocculent impurities may exist in white wine, a colorless transparent container can be used, or a green transparent container can be used. In the case where white granular impurities may exist in cola, a colorless transparent container can be used, or a light yellow transparent container can be used. Among them, all impurities include impurities located on the transparent container and impurities in the contents.

[0065] In one implementation of the above step 201, in order to more comprehensively determine the impurities in the contents and avoid some static impurities (such as some impurities that sink to the bottom or float on the surface when the contents are liquid) from being mistakenly identified as impurities in the transparent container, the initial state of the transparent container can be set to a moving state to stimulate the contents to move fully. Furthermore, in order to avoid the problem of misjudgment of impurities in the contents due to excessive movement of the contents, the transparent container in a moving state can be left still for a period of time, and then a fixed shooting angle can be selected to start continuous shooting of the transparent container to obtain multiple images.

[0066] Among them, the length of the static state should not be too long or too short, and can be set by the technicians according to actual experience. For example, the length of the static state can be determined according to the properties of the contents in the transparent container, including: if the contents are liquids with low viscosity, the length of the static state can be controlled to be shorter, such as the length of the static state can be set to 1 minute; if the contents are liquids with high viscosity, the length of the static state can be controlled to be longer, such as the length of the static state can be set to 5 minutes. In the process of photographing the transparent container, continuous shooting means that after photographing the transparent container at a certain moment and obtaining an image, the image acquisition unit will photograph the transparent container again after a certain time interval and obtain an image, so that through multiple shootings, images of the transparent container at multiple moments will be obtained. Among them, the time interval between two adjacent shots should not be too long or too short, and can be set by the technicians according to actual experience. For example, the time interval between two adjacent shots can be determined according to the height of the transparent container and the nature of the contents, including: if the contents are a liquid with low viscosity placed in a transparent container with a relatively low height, the time interval between two adjacent shots can be controlled to be shorter, such as the time interval can be set to 30 seconds; if the contents are a liquid with high viscosity placed in a transparent container with a relatively high height, the time interval between two adjacent shots can be controlled to be longer, such as the time interval can be set to 1 minute. Among them, the time interval between any two adjacent shots can be the same or different, for example, after the first shot, the image acquisition unit takes the second shot of the transparent container after an interval of 30 seconds. At this time, the image acquisition unit can take the third shot of the transparent container after an interval of 30 seconds, or the image acquisition unit takes the third shot of the transparent container after an interval of 20 seconds, which is not limited in the embodiments of the present application. In the process of photographing the transparent container, after selecting an initial shooting angle at the initial shooting moment, the initial shooting angle is fixed, that is, the positional relationship between the transparent container and the image acquisition unit is kept the same until the shooting process ends.

[0067] like Figure 3 As shown in FIG. 1 , a motion state diagram of a transparent container filled with transparent liquid at multiple moments provided in an embodiment of the present application is shown. Figure 3 Figure (A) in the figure can be used to represent the image collected by leaving the transparent container after shaking for 1 minute; Figure 3 Figure (B) in the figure can be used to represent the distance Figure 3 (A) is an image captured 30 seconds after the shooting time. Figure 3 The (C) diagram in the figure can be used to represent the distance Figure 3 (B) is an image captured 30 seconds after the shooting time; Figure 3 The (D) diagram in the figure can be used to represent the distance Figure 3 (C) is an image captured 30 seconds after the shooting time. Figure 3 The (E) graph in the figure can be used to represent the distance Figure 3 The image in (D) was captured 30 seconds after the shooting time. Figure 3 The five images shown are all taken from the same shooting angle, from which it can be seen that the transparent container (containing transparent liquid) contains two impurities, including impurity 1 and impurity 2, among which: impurity 1 is Figure 3 In Figures (A), (B), (C), (D), and (E), they are labeled as 1a, 1b, 1c, 1d, and 1e, respectively. Impurity 2 is Figure 3 Figures (A), (B), (C), (D) and (E) are marked as 2a, 2b, 2c, 2d and 2e respectively. The oscillation method includes oscillating the transparent container in the vertical direction, oscillating the transparent container in the horizontal direction, rotating the transparent container, inverting the transparent container, or a random combination of the above oscillation methods, which is not specifically limited in the embodiments of the present application.

[0068] It should be noted that the above determination that the transparent container (containing the transparent liquid) contains two impurities means that the human eye can determine it, but the computer cannot directly determine it. When the computer accurately identifies the impurities, it can be achieved through the target detection algorithm.

[0069] In an implementation of the above step 202, the multiple images include two images, and any one of the images can be used as a reference image, and the remaining image can be used as a comparison image. In this way, after determining the difference image of the two images, the impurity points in the reference image and the difference image with the same position are used as impurities in the contents.

[0070] The difference image between the reference image and the comparison image can be determined by the following method:

[0071] Optionally, determining the differential image between the reference image and the comparison image includes: for the same pixel in the reference image and the comparison image, determining the first value of the pixel in the reference image and the second value of the pixel in the comparison image; determining the absolute value of the difference between the first value and the second value; and obtaining the differential image between the reference image and the comparison image based on the absolute value corresponding to each pixel.

[0072] For example, Figure 3Taking the illustrated (A) and (B) as examples, we can further use (A) as the reference image and (B) as the comparison image. Since the image is composed of multiple pixels and the shooting angles of (A) and (B) are the same, we can further assume that (A) and (B) each include 500*500 pixels. Then, for Figure 3 Figure (A) and Figure 3 For the same pixel in the two images in (B) of FIG, determine the first value of the pixel in (A) and determine the second value of the pixel in (B). The first value and the second value may be the average of the three channels of the pixel in the two images, such as the average of the values ​​of the three channels r, g, and b, or the average of any two channels, such as the average of the values ​​of the two channels r and g, the average of the values ​​of the two channels g and b, or other values ​​obtained by other reasonable calculation methods, which are not specifically limited in this application.

[0073] In the embodiment of the present application, the calculation method of the first value and the second value is described by taking the average of the three channels as the calculation method of the first value and the second value. Then:

[0074] The first value can be expressed as:

[0075] W1=(image_3A r +image_3A g +image_3A b ) / 3;

[0076] The second value can be expressed as:

[0077] W2=(image_3B r +image_3B g +image_3B b ) / 3;

[0078] Among them, r, g, and b represent the three channels of the image respectively, and image_3A is used to indicate that the reference image is Figure 3 In (A), image_3B is used to represent the comparison image. Figure 3 Figure (B) in .

[0079] After obtaining the first value and the second value, the absolute value of the difference between the two is calculated, that is, the calculation is:

[0080] W=|W1-W2|=|(image_3A r +image_3A g +image_3A b ) / 3-

[0081] (image_3Br +image_3B g +image_3B b ) / 3|;

[0082] So, yes Figure 3 Figure (A) and Figure 3 Any pixel point at the same position in the figure (B) in the figure is calculated in the above way. After all 250,000 pixels are calculated, it can be generated Figure 3 Figure (A) and Figure 3 Difference image of (B) in the figure.

[0083] like Figure 4 As shown, a differential image provided by an embodiment of the present application is used to represent Figure 3 Figure (A) and Figure 3 When the impurities are impurities in the contents, since the impurities in motion will be in different positions over time, the same impurity will be displayed in two different positions in the differential image through the image difference algorithm. Figure 4 , where the dotted frame 1 refers to the location of the impurity when the image (A) was taken, and the dotted frame 2 refers to the location of the impurity when the image (B) was taken. The impurities in the dotted frame 1 and the dotted frame 2 are the same impurities. When the impurities are impurities in a transparent container, they will not be displayed in the differential image through the image difference algorithm.

[0084] While obtaining the differential image, the impurity points in the reference image can also be identified. When identifying the impurity points in the reference image, a preset target detection algorithm can be used, such as the Yolo V4 (YouOnly Look Once Version 4) detection algorithm to achieve fast and accurate identification of impurities, or other target detection algorithms, which are not specifically limited in the embodiments of the present application.

[0085] like Figure 5 FIG. 1 is a schematic diagram of a target detection result provided in an embodiment of the present application, which is used to represent the target detection result of the reference image. Figure 3 The impurity identification results of Figure (A) in Figure 1 include impurity 1 and impurity 2. The position of impurity 1 is Figure 3 The position of 1a in the diagram (A) is the same as that of impurity 2. Figure 3 The position of 2a in (A) is the same. The difference is that Figure 3 The human eye can directly see where impurity 1 and impurity 2 are located. Figure 5 It is where the impurity 1 and impurity 2 are located, as identified by the computer based on the target recognition algorithm.

[0086] Combination Figure 4 and Figure 5 , it can be determined Figure 5 Impurities 1 and Figure 4 The impurity position of the dotted box 1 in the figure overlaps, that is, the two have the same position, or there is a corresponding relationship between the two. Figure 5 Impurity 2 in Figure 4 No impurity point at the corresponding position can be found in the matching, that is, Figure 4 There is no Figure 5 Therefore, the impurity point 1 in the reference image and the difference image that has the same position as the impurity point can be determined as the impurity of the contents, and the impurity point 2 shown in the reference image but not shown in the difference image can be determined as the impurity of the transparent container.

[0087] In an implementation of the above step 202, the multiple images include at least three images, and any one of the images can be used as a reference image, and any image other than the reference image in the at least three images can be used as a comparison image. In this way, for any comparison image, a differential image between it and the reference image is determined. The method of determining the differential image can refer to the aforementioned method of generating the differential image, which is not repeated here. Then, for each generated differential image, the positional relationship between it and the impurity point of the reference image is determined. For example, for a certain impurity point in the reference image, an impurity point having the same position as the impurity point can be found in each of the multiple differential images, then it can be determined that the impurity point in the reference image is an impurity of the contents. By comparing the reference image with multiple differential images, the accuracy of the comparison can be improved compared to the method of comparing the reference image with only one differential image, that is, if a certain / some impurity point in the reference image has a corresponding relationship with multiple differential images respectively, it can be more accurately determined that the certain / some impurity point must be an impurity of the contents.

[0088] In one implementation of the above step 202, the multiple images include at least three images, and these images correspond to different shooting moments. The reference image is assumed to be the image corresponding to the first shooting moment, and the comparison image is any image other than the reference image among the at least three images, and the comparison images are sorted according to the order of shooting moments, such as first determining the difference image between the comparison image with the earlier shooting moment and the reference image, and then determining the difference image between the comparison image with the later shooting moment and the reference image, so that the difference images between the reference image and each comparison image can be obtained in sequence, wherein the method for determining the difference image can refer to the aforementioned method for generating the difference image, which will not be described in detail here. Then, the obtained difference images are sorted according to the order of shooting moments, so that the motion state of the impurities in the contents can be further determined, and the properties of the impurities in the contents can be determined later. The determined properties can provide a reference for technicians to formulate methods for removing impurities. For example, for some impurities that sink to the bottom of the liquid, the impurities that sink to the bottom can be left in a transparent container by carefully pouring the liquid after it is left to stand.

[0089] like Figure 6 FIG. 1 is a schematic diagram of a plurality of differential images provided in an embodiment of the present application. The plurality of differential images in the schematic diagram are based on Figure 3 The transparent liquid in the transparent container shown in FIG. 1 is obtained by respectively capturing images corresponding to multiple shooting moments. Figure 6 Figure (A) in the figure can be used to represent Figure 3 Figure (B) and Figure 3 The difference image of (A) in Figure 6 Figure (B) in the figure can be used to represent Figure 3 Figure (C) and Figure 3 The difference image of (A) in Figure 6 Figure (C) in the figure can be used to represent Figure 3 Figure (D) and Figure 3 The difference image of (A) in Figure 6 The (D) diagram in can be used to represent Figure 3 Figure (E) and Figure 3 The difference image of (A) in . Figure 6 Figures (A), (B), (C) and (D) in the figure are respectively Figure 5 Compare, confirm Figure 5 The impurity 1 in the figure overlaps with the impurity in the dotted box 1 in the four images (A), (B), (C) and (D), so it can be determined that Figure 5 The impurity 1 in the sample belongs to the impurities in the contents. Figure 6From the results of Figures (A), (B), (C) and (D), it can be determined that impurity 1 is on an upward trend during the shooting process, which means that the density of impurity 1 will be less than the density of the transparent liquid in the transparent container, so that technicians can formulate a suitable method for removing impurity 1 from the transparent liquid based on this property and some other properties to improve the purity of the transparent liquid.

[0090] The solution of the embodiment of the present application is also applicable to the case where the contents are gas. For example, when the transparent container contains gas, energy is applied to the transparent container, such as heating the transparent container, so that the gas in the transparent container produces obvious movement, and then the image is photographed using an image acquisition unit, and the photographed image is sent to the server, which processes the image to determine the impurities contained in the gas. The way the server processes the image can refer to the processing method of the server when the contents in the transparent container are liquids, and will not be repeated.

[0091] When this solution is applied to the detection of impurities in liquor, it can accurately identify which are impurities in the liquor and which are impurities in the bottle, thus avoiding the situation where only the target detection algorithm is used to identify impurities in the bottle, which would lead to the impurities in the liquor being mistakenly identified as impurities in the liquor, thus lowering the quality of the liquor. This method can improve the effect of determining the quality of liquor.

[0092] Based on the same concept, the embodiment of the present application also provides a device for determining impurities in the contents of a transparent container, such as Figure 7 As shown, the device comprises:

[0093] The image acquisition unit 701 is used to acquire multiple images; the multiple images are images of the contents at different times when the contents are in a dynamic state; wherein the transparent container is in a static state at the different times.

[0094] The difference image determining unit 702 is used to determine a difference image between a reference image and a comparison image, where the reference image and the comparison image are any two different images among the multiple images.

[0095] The impurity point determination unit 703 is used to determine the impurity points in the reference image by using a preset target detection algorithm.

[0096] The impurity determination unit 704 is used to determine the impurity points at the same position between the reference image and the differential image as impurities of the contents.

[0097] Further, for the device, the multiple images include at least three images; the differential image determination unit 702 is specifically used to determine a reference image from the multiple images; any image of the multiple images except the reference image is used as the comparison image; for each comparison image, a differential image between the reference image and the comparison image is determined; the impurity determination unit 704 is specifically used to determine that an impurity point in the reference image is an impurity of the contents if the impurity point in the reference image has the same position as the impurity point in any one of the multiple differential images.

[0098] Furthermore, for the device, the image acquisition unit 701 is specifically configured to continuously capture a plurality of images from a preset angle after the transparent container in motion is left stationary for a set period of time.

[0099] Furthermore, for the device, the differential image determination unit 702 is specifically used to determine the differential image between the reference image and each comparison image in sequence according to the shooting time of each comparison image; the device also includes an impurity motion state determination unit 705, which is used to determine the motion state of the impurities in the contents according to each differential image.

[0100] Further, for the device, the differential image determination unit 702 is specifically used to determine, for the same pixel point in the reference image and the comparison image, a first value of the pixel point in the reference image and a second value of the pixel point in the comparison image; determine the absolute value of the difference between the first value and the second value; and obtain a differential image between the reference image and the comparison image based on the absolute value corresponding to each pixel point.

[0101] Furthermore, for the device, the impurity determination unit 704 is further configured to determine, for an impurity point displayed in the reference image, that the impurity point is an impurity of the transparent container if the impurity point is not displayed in the differential image.

[0102] Furthermore, for the device, the contents are transparent liquids; and there is a color distinction between any two of the transparent container, the transparent liquid, and the impurities.

[0103] The embodiment of the present application provides a computing device, which may be a desktop computer, a portable computer, a smart phone, a tablet computer, a personal digital assistant (PDA), etc. The computing device may include a central processing unit (CPU), a memory, an input / output device, etc. The input device may include a keyboard, a mouse, a touch screen, etc. The output device may include a display device, such as a liquid crystal display (LCD), a cathode ray tube (CRT), etc.

[0104] The memory may include a read-only memory (ROM) and a random access memory (RAM), and provides the processor with program instructions and data stored in the memory. In an embodiment of the present application, the memory may be used to store program instructions for a method of determining impurities of a content located in a transparent container;

[0105] The processor is used to call the program instructions stored in the memory and execute the method for determining the impurities of the contents in the transparent container according to the obtained program.

[0106] like Figure 8 FIG. 1 is a schematic diagram of a computing device provided in an embodiment of the present application, wherein the computing device includes:

[0107] Processor 801, memory 802, transceiver 803, bus interface 804; wherein the processor 801, memory 802 and transceiver 803 are connected via bus 805;

[0108] The processor 801 is used to read the program in the memory 802 to execute the above method for determining impurities in the contents in the transparent container;

[0109] The processor 801 may be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and a NP. It may also be a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0110] The memory 802 is used to store one or more executable programs and can store data used by the processor 801 when performing operations.

[0111] Specifically, the program may include program code, and the program code includes computer operation instructions. The memory 802 may include volatile memory, such as random-access memory (RAM); the memory 802 may also include non-volatile memory, such as flash memory, hard disk drive (HDD) or solid-state drive (SSD); the memory 802 may also include a combination of the above-mentioned types of memory.

[0112] The memory 802 stores the following elements, executable modules or data structures, or a subset thereof, or an extended set thereof:

[0113] Operation instructions: include various operation instructions, used to implement various operations.

[0114] Operating system: includes various system programs used to implement various basic businesses and handle hardware-based tasks.

[0115] The bus 805 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0116] The bus interface 804 may be a wired communication access port, a wireless bus interface or a combination thereof, wherein the wired bus interface may be, for example, an Ethernet interface. The Ethernet interface may be an optical interface, an electrical interface or a combination thereof. The wireless bus interface may be a WLAN interface.

[0117] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions for causing a computer to execute a method for determining impurities in contents located in a transparent container.

[0118] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0119] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0120] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0121] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0122] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0123] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for determining impurities in a content in a transparent container, characterized in that: The method comprises: Determine the time interval between two consecutive shots based on the height of the transparent container and the nature of the contents; After the transparent container in motion is left stationary for a set period of time, multiple images are continuously taken from a preset angle according to the time interval between two adjacent shots; the multiple images are images of the contents at different moments when they are in a dynamic state; wherein the transparent container is stationary at the different moments; Determine a differential image between a reference image and a comparison image, wherein the reference image and the comparison image are any two different images among the multiple images; Determine the impurity points in the reference image by using a preset target detection algorithm; the impurities in the reference image include impurities in the contents and impurities in the transparent container; Determine the impurity points at the same position between the reference image and the differential image as impurities in the contents rather than impurities on the transparent container; Wherein, the plurality of images include at least three images; The step of determining a difference image between the reference image and the comparison image comprises: Determining the reference image from the multiple images; Using any image among the multiple images except the reference image as the comparison image; For each comparison image, determining a difference image between the reference image and the comparison image; The step of determining the impurity points having the same position between the reference image and the differential image as impurities of the contents includes: If the impurity point in the reference image has the same position as the impurity point in any one of the plurality of differential images, then the impurity point is determined to be an impurity of the container.

2. The method according to claim 1, characterized in that The step of determining, for each comparison image, a difference image between the reference image and the comparison image comprises: Determining the difference images between the reference image and each of the comparison images in sequence according to the shooting time of each comparison image; The method further comprises: The movement state of the impurities in the contents is determined based on the differential images.

3. The method according to claim 1 or 2, characterized in that The step of determining a difference image between the reference image and the comparison image comprises: For a same pixel in the reference image and the comparison image, determining a first value of the pixel in the reference image and a second value of the pixel in the comparison image; determining an absolute value of a difference between the first value and the second value; A differential image between the reference image and the comparison image is obtained according to the absolute value corresponding to each pixel point.

4. The method according to claim 1 or 2, characterized in that: The method further comprises: For the impurity point displayed in the reference image, if the impurity point is not displayed in the differential image, it is determined that the impurity point is an impurity of the transparent container.

5. The method according to claim 1 or 2, characterized in that: The contents are transparent liquid; There is a color distinction between any two of the transparent container, the transparent liquid and the impurities.

6. A device for determining impurities in a content in a transparent container, characterized in that: The device comprises: An image acquisition unit is used to determine the time interval between two adjacent shots according to the height of the transparent container and the nature of the contents; after the transparent container in motion is left stationary for a set period of time, a plurality of images are continuously taken from a preset angle according to the time interval between two adjacent shots; wherein the transparent container is stationary at different times; and the plurality of images include at least three images; a differential image determining unit, configured to determine a differential image between a reference image and a comparison image, wherein the reference image and the comparison image are any two different images among the multiple images; An impurity point determination unit, used to determine impurity points in the reference image by using a preset target detection algorithm; the impurities in the reference image include impurities in the contents and impurities in the transparent container; An impurity determination unit, configured to determine impurity points having the same position between the reference image and the differential image as impurities of the contents rather than impurities on the transparent container; The differential image determination unit is used to determine the reference image from the multiple images; use any image of the multiple images except the reference image as the comparison image; and determine a differential image between the reference image and the comparison image for each comparison image; The impurity determination unit is used to determine that the impurity point in the reference image is an impurity of the container if the impurity point in the reference image has the same position as the impurity point in any one of the plurality of differential images.

7. A computer device, characterized in that: include: Memory for storing computer programs; A processor is used to call the computer program stored in the memory, and execute the method according to any one of claims 1 to 5 according to the obtained program.

8. A computer-readable storage medium, characterized in that: The storage medium stores a program, and when the program is run on a computer, the computer is enabled to implement the method according to any one of claims 1 to 5.