Liquid level detection method and device, electronic equipment and storage medium
By acquiring and processing liquid level images to determine whether the liquid level is qualified, the problem of low efficiency and large error in manual inspection after liquid product packaging is solved, realizing efficient and accurate liquid level detection and improving the qualification rate of liquid products.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SUZHOU MEGAROBO TECH CO LTD
- Filing Date
- 2023-12-18
- Publication Date
- 2026-07-10
AI Technical Summary
In the existing technology, manual inspection of liquid products after packaging is inefficient and easily affected by personal experience, leading to uncertainty in test results and false detections, which affects the pass rate of liquid products.
By acquiring an image of the liquid level to be tested in the target container, the liquid level height is determined based on image processing technology, and the liquid level height is used to determine whether the liquid level is qualified, including calculating the difference between the liquid volume and the set threshold based on the liquid level height to determine whether the liquid level is qualified.
It enables efficient liquid level detection without human intervention, reduces labor costs, improves the pass rate and detection accuracy of liquid products, and meets the needs of mass production.
Smart Images

Figure CN117842478B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of liquid level detection technology, and more specifically to a liquid level detection method, a liquid level detection device, an electronic device, and a storage medium. Background Technology
[0002] In the production of liquid products, filling is a common method for packaging them. For example, in the production of reagents in the biopharmaceutical field, reagents can be filled into corresponding reagent bottles to complete the packaging process.
[0003] In related technologies, after liquid products are packaged, each liquid product is typically inspected manually to determine its quality. However, manual inspection is inefficient and cannot meet the needs of large-scale liquid product production. Furthermore, manual inspection is easily influenced by factors such as personal experience, leading to subjectivity and uncertainty in the results. This can result in false positives, affecting the overall pass rate of the liquid products. Summary of the Invention
[0004] This application is made in view of the above-mentioned problems. This application provides a liquid level detection method, a liquid level detection device, an electronic device, and a storage medium.
[0005] According to one aspect of this application, a liquid level detection method is provided, comprising: acquiring a liquid level image of a target container, wherein the target container is a transparent container; determining the liquid level height of the target container based on the liquid level image, wherein the liquid level height represents the distance between the liquid surface in the target container and the bottom of the target container; and determining whether the liquid level of the target container is qualified based on the liquid level height.
[0006] For example, determining whether the liquid level of a target container is qualified based on the liquid level height includes: determining the liquid volume in the target container based on the liquid level height; determining whether the difference between the liquid volume and the target volume is less than a volume threshold; and determining that the liquid level of the target container is qualified when the difference between the liquid volume and the target volume is less than the volume threshold; wherein the difference between the liquid volume and the target volume is the absolute value of the liquid volume minus the target volume.
[0007] For example, the target container includes multiple container segments arranged sequentially along the height direction, each container segment corresponding to a multiple conversion relationship, which is used to indicate the relationship between liquid level and liquid volume; determining the liquid volume in the target container based on the liquid level includes: determining a target conversion relationship among the multiple conversion relationships based on the liquid level, wherein the target conversion relationship is the conversion relationship corresponding to the container segment where the liquid in the target container is currently located, and the container segment where the liquid in the target container is currently located corresponds to the liquid level; and calculating the liquid volume based on the liquid level and the target conversion relationship.
[0008] For example, the method further includes: for each of the multiple container segments, determining the transformation relationship corresponding to the container segment based on the appearance characteristics of the container segment.
[0009] For example, the multiple container segments include cylindrical segments and conical segments; the conical segments correspond to a first transformation relationship, and the cylindrical segments correspond to a second transformation relationship.
[0010] For example, the cylindrical segment is located above the conical segment, and the first conversion relationship is expressed by the following formula: V=1 / 3*π*r1*r1*h1; where h1≤h2; where V represents the liquid volume, r1 represents the radius of the plane containing the upper edge of the liquid in the target container, h1 represents the liquid level height, and h2 represents the height of the conical segment.
[0011] For example, the cylindrical segment is located above the conical segment, and the diameter of the cylindrical segment is the same as the diameter of the base of the conical segment; the second transformation relationship is expressed by the following formula:
[0012] V = 1 / 3 * π * r² * r² * h² + (h³ - h²) * π * r² * r²; where h³ > h²; where V represents the liquid volume, r² represents the radius of the base of the conical segment, h³ represents the liquid level height, and h² represents the height of the conical segment.
[0013] For example, determining the liquid level height of a target container based on a liquid level image includes: detecting the upper edge of the liquid inside the target container in the liquid level image based on the pixel values of each pixel in the liquid level image to determine the liquid level of the target container; and determining the liquid level height of the target container based on the position of the liquid level and the position of the bottom of the target container in the liquid level image.
[0014] For example, before determining the liquid level height of the target container based on the position of the liquid level and the position of the bottom of the target container in the liquid level image to be measured, the method further includes: identifying the position of the bottom of the target container in the liquid level image to be measured based on the reference features of the pixels corresponding to the bottom of the target container in the reference liquid level image.
[0015] For example, after determining the liquid level height of the target container based on the image of the liquid level to be measured, the method further includes: determining that the liquid level of the target container is unqualified when the liquid level height of the target container is 0.
[0016] According to another aspect of this application, a liquid level detection device is provided, comprising: an acquisition module for acquiring an image of the liquid level to be measured in a target container, wherein the target container is a transparent container; a first determination module for determining the liquid level height of the target container based on the image of the liquid level to be measured, wherein the liquid level height represents the distance between the liquid surface in the target container and the bottom of the target container; and a second determination module for determining whether the liquid level of the target container is qualified based on the liquid level height.
[0017] According to another aspect of this application, an electronic device is provided, including a processor and a memory, wherein the memory stores computer program instructions that are executed by the processor to perform the methods described above.
[0018] According to another aspect of this application, a storage medium is provided on which program instructions are stored, which are used to execute the method described above when the program instructions are run.
[0019] The above technical solution acquires an image of the liquid level to be tested in the target container and determines the liquid level height based on this image. This allows for a relatively accurate determination of whether the liquid level in the target container is within acceptable limits. This solution requires no manual intervention, helping to reduce labor costs and improve liquid level detection efficiency, thus facilitating the requirements of mass production. Furthermore, this solution avoids errors introduced by manual inspection, contributing to a higher pass rate for liquid products. Attached Figure Description
[0020] The above and other objects, features, and advantages of this application will become more apparent from the more detailed description of the embodiments of this application in conjunction with the accompanying drawings. The accompanying drawings are used to provide a further understanding of the embodiments of this application and form part of the specification. They are used together with the embodiments of this application to explain this application and do not constitute a limitation thereof. In the accompanying drawings, the same reference numerals generally represent the same components or steps.
[0021] Figure 1 A schematic flowchart of a liquid detection method according to an embodiment of this application is shown;
[0022] Figure 2 A schematic diagram of a target container according to an embodiment of this application is shown;
[0023] Figure 3 A schematic block diagram of a liquid level detection device according to an embodiment of this application is shown; and
[0024] Figure 4 A schematic block diagram of an electronic device according to an embodiment of this application is shown. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of this application more apparent, exemplary embodiments according to this application will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this application, and not all embodiments of this application. It should be understood that this application is not limited to the exemplary embodiments described herein. Based on the embodiments of this application described herein, all other embodiments obtained by those skilled in the art without inventive effort should fall within the protection scope of this application.
[0026] Liquid products are widely used in fields such as biomedicine and food. Liquid products can include biological reagents, beverages, etc. In the production process of liquid products, filling is generally used for packaging. Taking biological reagents as an example, in the production process of biological reagents, the reagents can be filled into corresponding reagent bottles. Currently, to meet the requirements of mass production, peristaltic pumps are commonly used for filling liquid products such as biological reagents. During the filling process, the user sets the filling time for each container used to package the liquid product based on the accuracy and stability of the peristaltic pump itself. However, this filling method relies on the accuracy and stability of the peristaltic pump itself, which is limited by factors such as pipeline, liquid type, frequency of use, and ambient temperature and humidity. Furthermore, the accuracy and stability of the peristaltic pump may decrease as the usage time increases. Therefore, relying solely on controlling the filling time of the peristaltic pump cannot guarantee the pass rate of the liquid product (i.e., whether the liquid volume in the liquid product meets the requirements). Related technologies, in order to improve the pass rate of liquid products, involve manually inspecting each liquid product for pass rate after packaging with a peristaltic pump. However, manual inspection is inefficient and cannot meet the needs of large-scale liquid product production. Furthermore, manual inspection is easily affected by factors such as personal experience, leading to subjectivity and uncertainty in the results. This can result in false detections, affecting the pass rate of liquid products. To solve the above technical problems, this application provides a liquid level detection method, a liquid level detection device, an electronic device, and a storage medium. This method helps to improve the pass rate of liquid products. The liquid detection method, device, electronic device, and storage medium are described in detail below.
[0027] According to one aspect of this application, a liquid detection method is provided. Figure 1 A schematic flowchart of a liquid detection method according to an embodiment of this application is shown. Figure 1 As shown, the liquid detection method 100 may include steps S110, S120 and S130.
[0028] In step S110, an image of the liquid level to be measured in the target container is obtained. The target container is a transparent container.
[0029] Optionally, the image of the liquid level to be measured can be a raw image acquired by an image acquisition device. According to embodiments of this application, any existing or future image acquisition method can be used to acquire the image of the liquid level to be measured. For example, an image acquisition device in a machine vision inspection system can be used to acquire the image of the liquid level to be measured, such as using a camera matched to the production environment of the liquid product and the target container.
[0030] In another example, the image of the liquid level to be measured can be an image obtained by preprocessing the original image.
[0031] Optionally, the preprocessing operation can be any preprocessing operation that meets the needs of subsequent steps. It can include all operations that facilitate liquid level detection of the image to be tested, such as improving the visual effect of the image, increasing the image clarity, or highlighting certain features in the image (e.g., the outline features of the target container, the features of the liquid in the target container, etc.). For example, the preprocessing operation can include noise reduction operations such as filtering, or it can include adjusting image parameters, such as adjusting the grayscale, contrast, brightness, or other image parameters of the image.
[0032] Optionally, the preprocessing operation may also include image cropping. For example, the original image can be cropped to remove background information unrelated to the target container, thereby reducing the interference of background information on subsequent steps and improving the efficiency of liquid level detection. In one specific embodiment, a grayscale-based image segmentation method can be used to determine the position of the target container in the liquid level image to be measured, and then the liquid level image to be measured can be cropped based on the contour of the target container. This grayscale-based image segmentation method can be the Otsu thresholding method, edge detection method, etc. In another specific embodiment, the liquid level image to be measured can be directly input into a target detection model for detecting the contour of the target container to determine the position of the target container in the liquid level image to be measured, and the liquid level image to be measured can be cropped according to the position of the target container in the liquid level image to be measured. This target detection model can be obtained through machine learning training.
[0033] Optionally, the preprocessing operation may also include image deletion. In some embodiments, after the target container has been filled, multiple frames of original images of the target container can be acquired at once. Then, the original image with the best image quality among the multiple frames is retained, and the other original images are deleted. The retained original image with the best image quality is the liquid level image to be tested for detecting the liquid level in the target container. In this embodiment, by selecting the original image with the best image quality from multiple frames as the liquid level image to be tested, the accuracy of liquid level detection in subsequent steps is improved, thereby helping to further improve the pass rate of liquid products.
[0034] Optionally, the image of the liquid level to be measured can be an image of the target container acquired from the top or side of the target container. For example, a depth camera can be used to acquire the image of the liquid level to be measured from the top of the target container. Alternatively, the image of the liquid level to be measured can be acquired from the side of the target container.
[0035] In step S120, based on the image of the liquid level to be measured, the liquid level height of the target container is determined, where the liquid level height represents the distance between the liquid surface in the target container and the bottom of the target container.
[0036] Optionally, the liquid level height of the target container can be determined directly based on image information in the liquid level image to be measured. For example, in the embodiment described above where an image of the top of the target container is used as the liquid level image to be measured, the liquid level height of the target container can be determined directly based on the depth information of the liquid in the target container acquired by the depth camera. In the embodiment described above where an image of the side of the target container is used as the liquid level image to be measured, the liquid level height of the target container can be determined based on image information such as color information, grayscale information, and contrast information in the liquid level image to be measured.
[0037] Optionally, the liquid level height of the target container can be determined based on a pre-trained neural network model. The neural network can be any existing or future-developed neural network capable of determining the liquid level height, such as a U-Net, a Fully Convolutional Network (FCN), etc. In a specific embodiment, the U-Net can be used to segment the image of the liquid level to be measured to obtain the position of the upper edge of the liquid in the target container, and then the liquid level height can be determined based on the position of the upper edge of the liquid.
[0038] Optionally, step S120, determining the liquid level height of the target container based on the liquid level image to be measured, may include the following steps: determining the position of the upper edge of the liquid in the liquid level image to be measured and the position of the bottom of the target container; determining a first distance between the upper edge of the liquid and the bottom of the target container based on the position of the upper edge of the liquid and the position of the bottom of the target container. This first distance is the liquid level height of the target container. The method for determining the position of the upper edge of the liquid in the liquid level image to be measured has been described in detail above and will not be repeated here.
[0039] Optionally, the position of the bottom of the target container in the liquid level image can be a preset position. It is understood that in actual production processes, the relative position between the camera used to acquire the liquid level image and the workstation where the target container is located is usually relatively fixed. Therefore, the position of the bottom of the target container in the liquid level image can be determined through pre-testing. This scheme pre-determines the position of the bottom of the target container, so when determining the liquid level height based on the liquid level image, it is not necessary to redetermine the position of the bottom of the target container, thereby helping to reduce computational load and improve liquid detection efficiency.
[0040] Optionally, the position of the bottom of the target container in each frame of the liquid level image to be measured can be determined separately. For example, the position of the bottom of the target container can be determined based on image information such as color information, grayscale information, and contrast information in the liquid level image to be measured. Alternatively, the position of the bottom of the target container can be determined based on the pre-trained neural network model described above. In this embodiment, the position of the bottom of the target container in each frame of the liquid level image to be measured is determined separately, thereby allowing for a more accurate determination of the position of the bottom of the target container. This approach helps to further improve the accuracy of the determined liquid level height.
[0041] Optionally, step S120, determining the liquid level height of the target container based on the liquid level image to be measured, may include the following steps: determining the position of the upper edge of the liquid inside the target container and the position of the top of the target container in the liquid level image to be measured; determining a second distance between the liquid level and the top of the target container based on the positions of the upper edge of the liquid inside the target container and the top of the target container. The liquid level height of the target container is the difference between the height of the target container and the second distance. The method for determining the position of the top of the target container in the liquid level image to be measured is similar to the method for determining the position of the bottom of the target container in the liquid level image to be measured, and will not be described in detail.
[0042] Optionally, the liquid level height can be represented by the number of pixels in the liquid level image to be measured. For example, after determining the position of the upper edge of the liquid and the position of the bottom of the target container using the method described above, the number of pixels between the liquid level and the bottom of the target container can be counted, and this number of pixels is the liquid level height. Alternatively, the liquid level height can be a distance value determined based on the number of pixels and a preset correspondence. This preset correspondence is used to represent the distance corresponding to each pixel. For example, after determining the position of the upper edge of the liquid and the position of the bottom of the target container using the method described above, the number of pixels between the liquid level and the bottom of the target container can be counted, and then the liquid level height can be determined according to the preset correspondence. In a specific embodiment, if the preset correspondence is that one pixel corresponds to 0.1 millimeters (mm), and the number of pixels between the liquid level and the bottom of the target container is 460, then the liquid level height is 46 mm.
[0043] In step S130, based on the liquid level height, it is determined whether the liquid level of the target container is qualified.
[0044] Alternatively, the liquid level of the target container can be determined directly based on the liquid level height to determine whether the liquid level is qualified.
[0045] For example, step S130, determining whether the liquid level of the target container is qualified based on the liquid level height, may include the following steps: determining whether the difference between the liquid level height and the target height is less than a height threshold; and determining that the liquid level of the target container is qualified when the difference between the liquid level height and the target height is less than the height threshold. Here, the difference between the liquid level height and the target height is the absolute value of the difference between the liquid level height and the target height. Optionally, the target height can be set according to actual needs. For example, the target volume can be determined based on the volume of containers for different liquid products, and then the target height can be determined based on the conversion relationship between the volume and height of the container. Optionally, the height threshold can be set as needed. For example, the height threshold can be determined based on the liquid level detection accuracy. This solution directly determines whether the liquid level of the target container is qualified based on the difference between the liquid level height and the target height, which is simple to calculate and helps improve the efficiency of liquid level detection.
[0046] Optionally, the liquid volume of the target container can be determined based on the liquid level height, and then the liquid level of the target container can be judged to be qualified based on the liquid volume of the target container. The specific steps of this scheme are described in detail below.
[0047] The above technical solution acquires an image of the liquid level to be tested in the target container and determines the liquid level height based on this image. This allows for a relatively accurate determination of whether the liquid level in the target container is within acceptable limits. This solution requires no manual intervention, helping to reduce labor costs and improve liquid level detection efficiency, thus facilitating the requirements of mass production. Furthermore, this solution avoids errors introduced by manual inspection, contributing to a higher pass rate for liquid products.
[0048] For example, step S130, determining whether the liquid level of the target container is qualified based on the liquid level height, may include the following steps: determining the liquid volume in the target container based on the liquid level height; determining whether the difference between the liquid volume and the target volume is less than a volume threshold; determining that the liquid level of the target container is qualified when the difference between the liquid volume and the target volume is less than the volume threshold; wherein, the difference between the liquid volume and the target volume is the absolute value of the liquid volume minus the target volume.
[0049] Optionally, the target height can be set according to actual needs. For example, the target volume can be determined based on the volume of the container for different liquid products. Taking a target container volume of 10ml as an example, the target volume can be 10ml.
[0050] Optionally, the volume threshold can be set as needed. A larger volume threshold results in lower accuracy of level detection; a smaller volume threshold results in higher accuracy. Therefore, the volume threshold can be set according to the user's requirements for level detection accuracy. In a specific embodiment, the target volume is 300 microliters (µl), and the volume threshold is 30 µl. In this embodiment, the target container's level is considered acceptable when the difference between the liquid volume and the target volume is less than 30 µl. In other words, the target container's level is acceptable when the liquid volume is within the range of (270 µl, 330 µl).
[0051] Optionally, the liquid volume in the target container can be determined based on the conversion relationship between the liquid level and the liquid volume in the target container. For example, when the target container is a cylinder, the conversion relationship can be:
[0052] V = h * π * r * r,
[0053] Where V represents the liquid volume of the target container, h represents the liquid level height, and r represents the bottom diameter of the target container.
[0054] The above technical solution determines the liquid volume in the target container based on the liquid level height, and compares the difference between the liquid volume and the target volume with the volume threshold. This can more accurately determine whether the liquid volume in the target container meets the requirements, thus helping to accurately determine whether the liquid level in the target container is qualified.
[0055] For example, the target container includes multiple container segments arranged sequentially along the height direction, with each container segment corresponding to a multiple conversion relationship, which is used to indicate the relationship between liquid level height and liquid volume.
[0056] Determining the liquid volume in a target container based on the liquid level can include the following steps: based on the liquid level, determining a target conversion relationship among multiple conversion relationships, wherein the target conversion relationship is the conversion relationship corresponding to the current container segment in which the liquid in the target container is located, and the current container segment in the target container corresponds to the liquid level; calculating the liquid volume based on the liquid level and the target conversion relationship.
[0057] Optionally, multiple container segments can be pre-divided by the user according to their needs. For example, the user can divide the target container into different container segments based on its overall appearance characteristics and different shapes.
[0058] Optionally, the one-to-one correspondence between multiple container segments and multiple conversion relationships can be predetermined. In some embodiments, the conversion relationship corresponding to each container segment can be predetermined before liquid level detection of the target container. For example, when multiple container segments are designated as the first container segment, the second container segment, and the third container segment from top to bottom, the conversion relationships corresponding to the three container segments can be predetermined as conversion relationship A, conversion relationship B, and conversion relationship C, respectively.
[0059] For example, multiple container segments correspond one-to-one with multiple height ranges. Based on the liquid level height, determining the target transformation relationship among multiple transformation relationships may include the following steps: determining whether the liquid level height falls within any of the multiple height ranges; when the liquid level height falls within a specific height range among the multiple height ranges, determining that the current container segment is the container segment corresponding to the specific height range. Here, the specific height range is any range among the multiple height ranges.
[0060] In some embodiments, the multiple container segments are, from top to bottom, a first container segment, a second container segment, and a third container segment. The conversion relationships corresponding to the three container segments are, respectively, conversion relationship A, conversion relationship B, and conversion relationship C. The height range corresponding to the first container segment is (0, 20 mm), the height range corresponding to the second container segment is (20, 40 mm), and the height range corresponding to the third container segment is (40, 80 mm). If the liquid level height determined in step S120 is 35 mm, then the current container segment can be determined to be the second container segment. At this time, the liquid level height can be substituted into conversion relationship B to calculate the liquid volume.
[0061] In the above technical solution, firstly, based on the liquid level height, a target conversion relationship is determined among multiple conversion relationships. Then, the liquid volume is calculated using the target conversion relationship and the liquid level height. This solution helps to determine the liquid volume more accurately, thus providing a more accurate basis for determining whether the liquid level of the target container is qualified in subsequent steps.
[0062] For example, method 100 may further include the following steps: for each of a plurality of container segments, determining the transformation relationship corresponding to the container segment based on the appearance characteristics of the container segment.
[0063] Optionally, before determining the transformation relationship corresponding to the container segment based on its appearance features, method 100 may further include the following step: determining the appearance features corresponding to each of the multiple container segments. In this embodiment, the appearance features of each container segment can be determined manually. Alternatively, a grayscale-based image segmentation method can be used to process the image of the target container to determine the contour of each container segment, and the appearance features of the container segment can be determined based on the contour of each container segment. The image of the target container can be pre-acquired before liquid level detection, or it can be an image of the liquid level to be detected acquired during the liquid level detection process.
[0064] In some embodiments, volume calculation formulas corresponding to container segments with different appearance features can be preset. Then, the conversion relationship corresponding to the current container segment can be determined based on the volume calculation formulas corresponding to the current container segment and the container segments below it. In a specific embodiment, multiple container segments are arranged from top to bottom as a first container segment, a second container segment, and a third container segment, and the conversion relationships corresponding to the three container segments are conversion relationship A, conversion relationship B, and conversion relationship C, respectively. If the volume calculation formula corresponding to the first container segment is formula D, the volume calculation formula corresponding to the second container segment is formula E, and the volume calculation formula corresponding to the third container segment is formula F, then conversion relationship A can be determined based on formulas D, E, and F; conversion relationship B can be determined based on formulas E and F; and conversion relationship C can be determined based on formula F.
[0065] The above technical solution can determine the corresponding conversion relationship of each container segment based on the appearance characteristics of each segment. Therefore, this solution can provide a more accurate basis for the subsequent step of determining the liquid level volume based on the liquid level height, which helps to ensure the accuracy of the determined liquid level volume and thus improves the accuracy of the liquid level detection results.
[0066] For example, the multiple container segments include cylindrical segments and conical segments; the conical segments correspond to a first transformation relationship, and the cylindrical segments correspond to a second transformation relationship.
[0067] Optionally, the first and second conversion relationships can be obtained through prior testing. In some embodiments, the volume calculation formulas for the cylindrical and conical segments can be determined based on their respective appearance characteristics. Then, the first and second conversion relationships are determined based on the volume calculation formulas and the relative positional relationship between the cylindrical and conical segments. In one embodiment, the volume calculation formula for the conical segment is formula D, and the volume calculation formula for the cylindrical segment is formula E. If the conical segment is located above the cylindrical segment, the first conversion relationship can be determined based on formulas D and E, and the second conversion relationship can be determined based on formula E. If the conical segment is located below the cylindrical segment, the first conversion relationship can be determined based on formula D, and the second conversion relationship can be determined based on formulas D and E.
[0068] In the above technical solution, the multiple container segments include cylindrical segments and conical segments; the conical segments correspond to the first transformation relationship, and the cylindrical segments correspond to the second transformation relationship. Therefore, the corresponding target transformation relationship can be selected based on the container segment where the current liquid level is located. This solution helps improve the accuracy of liquid volume calculation.
[0069] For example, the cylindrical segment is located above the conical segment, and the first transformation relationship is expressed by the following formula:
[0070] V = 1 / 3 * π * r1 * r1 * h1;
[0071] Where h1≤h2; where V represents the liquid volume, r1 represents the radius of the plane containing the upper edge of the liquid in the target container, h1 represents the liquid level height, and h2 represents the height of the conical segment.
[0072] In this example, the cone apex of the conical segment is positioned downwards, and the cone ground of the conical segment connects with the cylindrical segment.
[0073] Optionally, the height of the conical segment can be obtained through prior testing. For example, when manually determining the appearance characteristics of each container segment as described above, the height of each container segment can be further measured after determining its appearance characteristics. Alternatively, the positions of the top and bottom of each container segment within the target container can be determined based on an image of the target container, and then the height of each container segment can be determined based on these positions. The image of the target container can be an image of the liquid level to be measured or other images including the target container. The method for determining the positions of the top and bottom of each container segment within the target container is similar to the method for determining the position of the bottom of the target container in the image of the liquid level to be measured, and will not be elaborated further.
[0074] Optionally, the radius of the plane containing the upper edge of the liquid in the target container can be determined by: determining the position of the upper edge of the liquid in the target container in the liquid level image based on the liquid level image to be measured; and determining the radius of the plane containing the upper edge of the liquid in the target container based on the contour of the target container corresponding to the position of the upper edge of the liquid. Figure 2 A schematic diagram of a target container according to an embodiment of this application is shown. Figure 2 As shown, after determining the upper edge of the liquid level, the radius of the plane containing the upper edge of the liquid can be determined based on the distance between points A and B, the intersections of the upper edge of the liquid with the contour of the target container. For example, if the distance between A and B is 10 mm, then r1 = 5 mm.
[0075] In the above technical solution, when the liquid level is less than or equal to the height of the conical segment, the liquid volume can be determined based on the first conversion relationship. This solution is simple to calculate and helps improve the accuracy and efficiency of liquid volume calculation.
[0076] For example, the cylindrical segment is located above the conical segment, and the diameter of the cylindrical segment is the same as the diameter of the base of the conical segment; the second transformation relationship is expressed by the following formula:
[0077] V=1 / 3*π*r2*r2*h2+(h3-h2)*π*r2*r2;
[0078] Where h3 > h2; where V represents the liquid volume, r2 represents the radius of the bottom surface of the conical segment, h3 represents the liquid level height, and h2 represents the height of the conical segment.
[0079] Optionally, the base radius of the conical segment can be obtained through prior testing. For example, when manually determining the appearance characteristics of each container segment as described above, the base radius of the conical segment can be further measured after determining the appearance characteristics of each container segment. Alternatively, the base radius of the conical segment can be determined based on information such as the model and parameters of the target container.
[0080] In the above technical solution, when the liquid level is greater than the height of the conical section, the liquid volume can be determined based on the second conversion relationship. This solution is simple to calculate and helps improve the accuracy and efficiency of liquid volume calculation.
[0081] For example, determining the liquid level height of a target container based on a liquid level image to be measured may include the following steps: detecting the upper edge of the liquid inside the target container in the liquid level image to be measured based on the pixel values of each pixel in the liquid level image to be measured, so as to determine the liquid level of the target container; and determining the liquid level height of the target container based on the position of the liquid level and the position of the bottom of the target container in the liquid level image to be measured.
[0082] Optionally, the pixel value can be the grayscale value or color value of a pixel. It is understood that the pixel values of areas containing liquid and areas without liquid in the target container differ. Therefore, the upper edge of the liquid in the target container can be detected based on the pixel values of each pixel in the image of the liquid level to be measured.
[0083] Optionally, based on the pixel values of each pixel in the image of the liquid level to be measured, detecting the upper edge of the liquid in the target container in the image of the liquid level to be measured to determine the liquid level of the target container may include the following steps: For each pixel in the image of the liquid level to be measured, determine whether the pixel value of the pixel is greater than a target pixel value. If the pixel value of the pixel is greater than the target pixel value, determine that the pixel belongs to the region where the liquid is located in the target container; determine that the position corresponding to the uppermost pixel in the region where the liquid is located in the target container is the upper edge of the liquid in the target container.
[0084] Optionally, the target pixel value can be a test value or an empirical value obtained through prior testing. For example, the average pixel value of each pixel corresponding to the liquid in the target container can be tested in advance and used as the target pixel value.
[0085] In the above technical solution, by using the pixel values of each pixel in the image of the liquid level to be measured, the location of the upper edge of the liquid can be determined relatively accurately, thereby allowing for a relatively accurate determination of the liquid level height. This solution helps to provide a more accurate basis for subsequent steps (such as step S130).
[0086] For example, before determining the liquid level height of the target container based on the position of the liquid level and the position of the bottom of the target container in the liquid level image to be measured, the method may further include the following step: identifying the position of the bottom of the target container in the liquid level image to be measured based on the reference features of the pixels corresponding to the bottom of the target container in the reference liquid level image.
[0087] Optionally, the reference liquid level image may be an image of the target container acquired in advance before performing the liquid level detection method. In some embodiments, the position of the bottom of the target container in the reference liquid level image may be determined using manual annotation or a pre-trained neural network model.
[0088] Optionally, after obtaining the position of the bottom of the target container in the reference liquid level image, the features of each pixel corresponding to the position of the bottom of the target container can be statistically analyzed to determine the reference features. In some embodiments, the pixel values of each pixel corresponding to the position of the bottom of the target container can be statistically analyzed, and then the average of the pixel values of each pixel can be calculated to determine the reference pixel value. This reference pixel value is the reference feature. In this embodiment, identifying the position of the bottom of the target container in the liquid level image based on the reference features of the pixels corresponding to the bottom of the target container in the reference liquid level image can include the following steps: for each pixel in the liquid level image to be tested, calculate the difference between the pixel value of the pixel and the reference pixel value. When the difference is less than the difference threshold, determine that the pixel belongs to the region where the bottom of the target container is located; determine the position of the bottom of the target container in the liquid level image to be tested based on each pixel in the liquid level image to be tested that belongs to the region where the bottom of the target container is located. In this embodiment, the region corresponding to each pixel in the liquid level image to be tested that belongs to the region where the bottom of the target container is located is the position of the bottom of the target container in the liquid level image to be tested.
[0089] Optionally, the difference threshold can be set as needed. For example, the position of the bottom of the target container can be determined based on the recognition accuracy of the position of the bottom of the target container in the image of the liquid level to be tested.
[0090] The above technical solution can determine the position of the bottom of the target container in each frame of the liquid level image to be measured. As a result, the position of the bottom of the target container can be determined more accurately, which helps to further improve the accuracy of the determined liquid level height.
[0091] For example, after determining the liquid level height of the target container based on the image of the liquid level to be measured, the method may further include the following step: when the liquid level height of the target container is 0, determine that the liquid level of the target container is unqualified. It can be understood that when the liquid level height of the target container is 0, it indicates that there is no liquid in the target container, and at this time, it can be directly determined that the liquid level detection is unqualified.
[0092] In the above embodiments, when the liquid level in the target container is 0, there is no need to perform subsequent calculation steps (such as the step of determining the liquid volume based on the liquid level). It can be directly determined that the liquid level in the target container is unqualified. This scheme helps to improve calculation efficiency and liquid level detection efficiency.
[0093] For example, the liquid level image to be tested can be multiple frames of images continuously acquired at a preset frequency during the filling process of the target container. In this embodiment, the liquid level image to be tested can be continuously acquired during the filling process of the target container, and the liquid level detection method described above can be executed based on each frame of the liquid level image to be tested. In this embodiment, when the detection result corresponding to the current frame of the liquid level image to be tested is qualified, the liquid level detection device used to execute the liquid level detection method can send a stop signal to the filling equipment to control the filling equipment to stop filling. This scheme detects the qualified liquid level in real time during the filling process of the target container, thereby providing a more accurate basis for the filling control of the filling equipment, thus helping to ensure that every liquid product produced is a qualified product.
[0094] According to another aspect of this application, a liquid level detection device is provided. Figure 3 A schematic block diagram of a liquid level detection device according to one embodiment of this application is shown. Figure 3 As shown, the liquid level detection device 300 includes an acquisition module 310, a first determination module 320, and a second determination module 330.
[0095] The acquisition module 310 is used to acquire the image of the liquid level to be measured in the target container, which is a transparent container.
[0096] The first determining module 320 is used to determine the liquid level height of the target container based on the image of the liquid level to be measured. The liquid level height represents the distance between the liquid surface in the target container and the bottom of the target container.
[0097] The second determining module 330 is used to determine whether the liquid level of the target container is qualified based on the liquid level height.
[0098] According to another aspect of this application, an electronic device is provided. Figure 4 A schematic block diagram of an electronic device according to one embodiment of this application is shown. Figure 4 As shown, the control device 400 includes a processor 410 and a memory 420. The memory 420 stores a computer program. The processor 410 executes the computer program to implement method 100.
[0099] Optionally, the processor may include any suitable processing device with data processing and / or instruction execution capabilities. For example, the processor may be implemented using one or a combination of programmable logic controllers (PLCs), digital signal processors (DSPs), field-programmable gate arrays (FPGAs), programmable logic arrays (PLAs), central processing units (CPUs), application-specific integrated circuits (ASICs), microcontroller units (MCUs), and other forms of processing units.
[0100] According to another aspect of the embodiments of this application, a storage medium is also provided. This storage medium stores a computer program / instructions that, when executed by a processor, implement the method 100 described above. The storage medium may, for example, include a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disc read-only memory (CD-ROM), a USB memory, or any combination of the above storage media. A computer-readable storage medium may be any combination of one or more computer-readable storage media.
[0101] Those skilled in the art can understand the specific implementation schemes of the above-mentioned liquid level detection device, electronic device, and storage medium by reading the relevant description of method 100 above, and will not be described in detail here for the sake of brevity.
[0102] Although exemplary embodiments have been described herein with reference to the accompanying drawings, it should be understood that the above exemplary embodiments are merely illustrative and are not intended to limit the scope of this application. Various changes and modifications can be made therein by those skilled in the art without departing from the scope and spirit of this application. All such changes and modifications are intended to be included within the scope of this application as claimed in the appended claims.
[0103] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0104] It should be noted that the above embodiments are illustrative of this application and not restrictive, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. This application can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.
[0105] The above description is merely a specific embodiment or illustration of the embodiments of this application. The scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. The scope of protection of this application shall be determined by the scope of the claims.
Claims
1. A liquid level detection method, characterized in that, include: Acquire a liquid level image of a target container, wherein the target container is a transparent container and includes multiple container segments arranged sequentially along the height direction. Each of the multiple container segments corresponds to a multiple conversion relationship, which is used to indicate the relationship between the liquid level height and the liquid volume. Based on the image of the liquid level to be measured, the liquid level height of the target container is determined, whereby the liquid level height represents the distance between the liquid surface in the target container and the bottom of the target container. Based on the liquid level height, a target conversion relationship is determined among the plurality of conversion relationships, wherein the target conversion relationship is a conversion relationship corresponding to the current container segment in which the liquid in the target container is located, and the current container segment in which the liquid in the target container is located corresponds to the liquid level height; The liquid volume is calculated based on the liquid level height and the target conversion relationship; The liquid level in the target container is determined based on the liquid volume to determine whether it is within acceptable limits.
2. The liquid level detection method according to claim 1, characterized in that, The step of determining whether the liquid level in the target container is qualified based on the liquid volume includes: Determine whether the difference between the liquid volume and the target volume is less than a volume threshold; When the difference between the liquid volume and the target volume is less than the volume threshold, the liquid level of the target container is determined to be qualified. The difference between the liquid volume and the target volume is the absolute value of the liquid volume minus the target volume.
3. The liquid level detection method according to claim 1, characterized in that, The method further includes: For each of the plurality of container segments Based on the appearance characteristics of the container segment, the corresponding transformation relationship of the container segment is determined.
4. The liquid level detection method according to claim 3, characterized in that, The plurality of container segments include cylindrical segments and conical segments; the conical segments correspond to a first transformation relationship, and the cylindrical segments correspond to a second transformation relationship.
5. The liquid level detection method according to claim 4, characterized in that, The cylindrical segment is located above the conical segment, and the first transformation relationship is expressed by the following formula: V = 1 / 3 * π * r1 * r1 * h1; Where h1≤h2; Wherein, V represents the volume of the liquid, r1 represents the radius of the plane containing the upper edge of the liquid in the target container, h1 represents the liquid level height, and h2 represents the height of the conical segment.
6. The liquid level detection method according to claim 4, characterized in that, The cylindrical segment is located above the conical segment, and the diameter of the cylindrical segment is the same as the diameter of the base of the conical segment; the second conversion relationship is expressed by the following formula: V=1 / 3*π*r2*r2*h2+(h3-h2)*π*r2*r2; Where h3 > h2; Wherein, V represents the liquid volume, r2 represents the bottom radius of the conical segment, h3 represents the liquid level height, and h2 represents the height of the conical segment.
7. The liquid level detection method according to any one of claims 1-6, characterized in that, Determining the liquid level height of the target container based on the image of the liquid level to be measured includes: Based on the pixel values of each pixel in the image of the liquid level to be tested, the upper edge of the liquid in the target container is detected in the image of the liquid level to be tested to determine the liquid level of the target container; The liquid level height of the target container is determined based on the position of the liquid level and the position of the bottom of the target container in the liquid level image to be measured.
8. The liquid level detection method according to claim 7, characterized in that, Before determining the liquid level height of the target container based on the position of the liquid level and the position of the bottom of the target container in the image of the liquid level to be measured, the method further includes: Based on the reference features of the pixels corresponding to the bottom of the target container in the reference liquid level image, the position of the bottom of the target container is identified in the liquid level image to be measured.
9. The liquid level detection method according to any one of claims 1-6, characterized in that, After determining the liquid level height of the target container based on the image of the liquid level to be measured, the method further includes: When the liquid level in the target container is 0, the liquid level in the target container is determined to be unqualified.
10. A liquid level detection device, characterized in that, include: The acquisition module is used to acquire the image of the liquid level to be measured in the target container. The target container is a transparent container and includes multiple container segments arranged sequentially along the height direction. The multiple container segments correspond one-to-one with multiple conversion relationships. The conversion relationships are used to indicate the relationship between the liquid level height and the liquid volume. The first determining module is used to determine the liquid level height of the target container based on the liquid level image to be measured, wherein the liquid level height represents the distance between the liquid surface in the target container and the bottom of the target container; The second determining module is configured to determine a target conversion relationship among the plurality of conversion relationships based on the liquid level height, wherein the target conversion relationship is a conversion relationship corresponding to the current container segment of the liquid in the target container, and the current container segment of the liquid in the target container corresponds to the liquid level height; it is also configured to calculate the liquid volume based on the liquid level height and the target conversion relationship; and it is also configured to determine whether the liquid level of the target container is qualified based on the liquid volume.
11. An electronic device comprising a processor and a memory, wherein, The memory stores computer program instructions, which, when executed by the processor, are used to perform the method as described in any one of claims 1-9.
12. A storage medium on which program instructions are stored, the program instructions being configured to perform the method as claimed in any one of claims 1-9 when executed.