A method and device for detecting the remaining amount of objects in a container, an electronic device and a storage medium

By acquiring container images and calculating line information, a line image of the target contained object is generated, which solves the problem of low efficiency in manual detection of container remaining capacity in existing technologies and achieves accurate detection of the remaining capacity of the object contained in the container.

CN116245862BActive Publication Date: 2026-07-03XIAOPEI NETWORK TECH (SHANGHAI) CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
XIAOPEI NETWORK TECH (SHANGHAI) CO LTD
Filing Date
2023-03-16
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

In existing technologies, the detection of the remaining amount of objects in a container relies on manual patrols, which leads to a waste of manpower and resources and low detection accuracy and efficiency.

Method used

By acquiring the container image, the edge detection algorithm is used to calculate the line information to generate the line image of the target object to be contained, and the remaining amount of the object to be contained is determined based on the line length information.

Benefits of technology

It enables precise detection of the remaining amount of objects inside a container, improving the accuracy of the detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116245862B_ABST
    Figure CN116245862B_ABST
Patent Text Reader

Abstract

This invention discloses a method, apparatus, electronic device, and medium for detecting the remaining amount of an object contained in a container. The method includes: acquiring an image of the container to be detected; calculating line information in the image of the container to be detected to generate a line image of the target contained object; calculating line length information in the line image of the target contained object; and determining the remaining amount of the object contained in the container to be detected based on the line length information in the line image of the target contained object. This invention significantly improves the accuracy of detecting the remaining amount of an object contained in a container.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a method, apparatus, electronic device, and storage medium for detecting the remaining amount of an object contained in a container. Background Technology

[0002] To prevent empty containers from being left unfilled due to loss of contents, manual patrols and inspections are often necessary.

[0003] In the process of realizing this invention, the inventors discovered that the existing technology of manually detecting the remaining amount of objects in a container wastes a lot of manpower and resources, and the accuracy and efficiency of the detection are also not high. Summary of the Invention

[0004] This invention provides a method, apparatus, electronic device, and storage medium for detecting the remaining amount of objects contained in a container, thereby improving the accuracy of detecting the remaining amount of objects contained in a container.

[0005] According to one aspect of the present invention, a method for detecting the remaining amount of an object contained in a container is provided, comprising:

[0006] Obtain the image of the container to be detected;

[0007] Calculate the line information in the image of the container to be detected, and generate a line image of the target container object;

[0008] Calculate the line length information in the line image of the target contained object;

[0009] The remaining amount of the object to be detected in the container is determined based on the line length information in the line image of the target object.

[0010] According to another aspect of the present invention, a device for detecting the remaining amount of an object is provided, comprising:

[0011] The module for acquiring the image of the container to be detected is used to acquire the image of the container to be detected.

[0012] The target container line image generation module is used to calculate the line information in the image of the container to be detected and generate a target container line image;

[0013] The line length information calculation module is used to calculate the line length information in the line image of the target contained object;

[0014] The module for determining the remaining amount of the container is used to determine the remaining amount of the container to be detected based on the line length information in the line image of the target container.

[0015] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0016] At least one processor; and

[0017] A memory communicatively connected to the at least one processor; wherein,

[0018] The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the method for detecting the remaining amount of an object contained in a container as described in any embodiment of the present invention.

[0019] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the method for detecting the remaining amount of an object contained in a container as described in any embodiment of the present invention.

[0020] The technical solution of this invention involves acquiring an image of the container to be detected and calculating the line information in the image to generate a target object line image. Then, the line length information in the target object line image is calculated, and the remaining amount of the container to be detected is determined based on the line length information. This achieves accurate detection of the remaining amount of the container's contents, improving the accuracy of container content detection.

[0021] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 This is a flowchart of a method for detecting the remaining amount of an object contained in a container, provided in Embodiment 1 of the present invention;

[0024] Figure 2 This is a flowchart of another method for detecting the remaining amount of an object contained in a container, provided in Embodiment 2 of the present invention;

[0025] Figure 3This is a schematic diagram of an image of a container to be detected according to Embodiment 2 of the present invention;

[0026] Figure 4 This is a schematic diagram of a globally contained object line image provided in Embodiment 2 of the present invention;

[0027] Figure 5 This is a schematic diagram of a grayscale image provided in Embodiment 2 of the present invention;

[0028] Figure 6 This is a schematic diagram of a region mask image provided in Embodiment 2 of the present invention;

[0029] Figure 7 This is a schematic diagram of a partial containment of an object line image provided in Embodiment 2 of the present invention;

[0030] Figure 8 This is a schematic diagram of another container image to be detected provided in Embodiment 2 of the present invention;

[0031] Figure 9 This is a schematic diagram of another globally contained object line image provided in Embodiment 2 of the present invention;

[0032] Figure 10 This is a schematic diagram of another grayscale image provided in Embodiment 2 of the present invention;

[0033] Figure 11 This is a schematic diagram of a region mask image provided in Embodiment 2 of the present invention;

[0034] Figure 12 This is a schematic diagram of another partial containment of object line images provided in Embodiment 2 of the present invention;

[0035] Figure 13 This is a schematic diagram of an object-containing remaining capacity detection device provided in Embodiment 3 of the present invention;

[0036] Figure 14 This is a schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. Detailed Implementation

[0037] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0038] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0039] Example 1

[0040] Figure 1 This is a flowchart of a method for detecting the remaining amount of an object contained in a container, provided in Embodiment 1 of the present invention. This embodiment of the invention is applicable to situations where the remaining amount of an object contained in a container needs to be detected. This method can be executed by a device for detecting the remaining amount of an object, which can be implemented in software and / or hardware, and is generally integrated into an electronic device. This electronic device can be a terminal device or a server device; this embodiment of the invention does not limit the specific type of electronic device. Correspondingly, as... Figure 1 As shown, the method includes the following operations:

[0041] S110. Obtain the image of the container to be detected.

[0042] The container to be inspected can be a container for holding items, and can be made of different materials and in different shapes to meet different needs. The image of the container to be inspected can be an image captured by a camera.

[0043] In this embodiment of the invention, a camera can be installed on the container to be tested to capture images of the container. The camera can be a fixed camera. The container to be tested can include a food dish or a litter box, and can be of any material and shape to meet different needs. The object contained in the container can include food from the food dish or litter from the litter box, and can be any kind of object held in the container. This embodiment of the invention does not limit the type of container to be tested or the type of object contained within it.

[0044] S120. Calculate the line information in the image of the container to be detected, and generate a line image of the target container object.

[0045] Among these features, line information can be used to reflect the remaining amount of the object contained in the container being tested. The target object line image can be image data composed of all the lines of the container image being tested.

[0046] In this embodiment of the invention, an edge detection algorithm can be used to calculate the line information in the image of the container to be detected, and the line image of the target container can be obtained based on the line information in the image of the container to be detected. The edge detection algorithm can be either a differential edge detection method or a difference edge detection method; this embodiment of the invention does not limit the type of edge detection algorithm used to calculate the line information in the image of the container to be detected.

[0047] S130. Calculate the line length information in the line image of the target contained object.

[0048] Among them, the line length information can be an indicator used to represent the remaining amount of objects that can be contained in the container.

[0049] In this embodiment of the invention, the line length information in the target container line image can be obtained by summing all the line information in the image of the container to be detected, or by weighted summing of all the line information in the image of the container to be detected. In this embodiment of the invention, the method used to obtain the line length information in the target container line image is not limited.

[0050] S140. Determine the remaining amount of the container to be detected based on the line length information in the line image of the target container.

[0051] In this embodiment of the invention, a threshold can be set for the line length information in the target object line image calculated in the above steps, and the remaining amount of the object in the container to be detected can be determined according to the threshold size. Alternatively, the line length information in the target object line image calculated in the above steps can be divided proportionally and a threshold can be set, and the remaining amount of the object in the container to be detected can be determined according to the threshold size.

[0052] The technical solution of this invention involves acquiring an image of the container to be detected and calculating the line information in the image to generate a target object line image. Then, the line length information in the target object line image is calculated, and the remaining amount of the container to be detected is determined based on the line length information. This achieves accurate detection of the remaining amount of the container's contents, improving the accuracy of container content detection.

[0053] Example 2

[0054] Figure 2 This is a flowchart of another method for detecting the remaining amount of an object contained in a container, provided in Embodiment 2 of the present invention. This embodiment is a specific embodiment based on the above embodiment, and provides several specific optional implementation methods for determining the remaining amount of an object contained in the container to be detected. Accordingly, as... Figure 3 As shown, the method in this embodiment may include:

[0055] S210. Obtain the image of the container to be detected.

[0056] S220. Calculate the global line information in the image of the container to be detected, and generate a global image of the line of the contained object.

[0057] The global line information can be used to represent the global features of the container to be detected. The global object line image can be an image composed of global line features from the image of the container to be detected.

[0058] In this embodiment of the invention, an imaging device can be installed on the container to be inspected to acquire an image of the container. Then, an edge detection algorithm is used to perform edge detection processing on the image of the container to be inspected to obtain global line information in the container image, and a global image of the contained object's lines is generated.

[0059] In a specific example, the container to be tested is a food plate. Figure 3 This is a schematic diagram of an image of a container to be detected provided in Embodiment 2 of the present invention, as shown below. Figure 3 As shown, a fixed camera can be installed on the food plate to capture images of the container to be inspected. Figure 4 This is a schematic diagram of a globally contained object line image provided in Embodiment 2 of the present invention, as shown below. Figure 4 As shown, an edge detection algorithm can be used to perform edge detection processing on the image of the container to be detected to obtain global line information in the image of the container to be detected, and generate a global image of the line of the container. In this embodiment of the invention, the edge detection algorithm is not limited; any method that can perform edge detection processing on an image can be used as the edge detection algorithm in this embodiment of the invention.

[0060] S230. Generate a region mask image that matches the global object line image.

[0061] In this embodiment of the invention, generating the region mask image that matches the global object line image may include: generating a global grayscale image that matches the global object line image; and dividing the global grayscale image into a set number of region mask images based on the region grayscale values ​​of the global grayscale image.

[0062] The global grayscale image can be a grayscale image containing grayscale values ​​of multiple different regions. The region mask image can be an image obtained by dividing the global grayscale image into regions.

[0063] In this embodiment of the invention, a global grayscale image is obtained by matching the global object line image obtained in the above steps. Then, based on the grayscale values ​​of different regions in the global grayscale image, the global grayscale image is divided into region mask images. The grayscale values ​​of each region in the region mask image are different. The number of regions in the region mask image can be customized according to user needs. In this embodiment of the invention, the number of regions in the region mask image is not limited.

[0064] In a specific example, let's continue the explanation using a food plate as the container to be tested. Figure 5 This is a schematic diagram of a grayscale image provided in Embodiment 2 of the present invention, as shown below. Figure 5 As shown, the global grayscale image obtained by following the above steps matches the global object line image of the food plate. Clearly, the global grayscale image matching the global object line image of the food plate contains four different regions, each corresponding to a different grayscale value.

[0065] Figure 6 This is a schematic diagram of a region mask image provided in Embodiment 2 of the present invention, as shown below. Figure 6 As shown, based on the grayscale values ​​of different regions in the global grayscale image, the global grayscale image is divided to obtain the region mask images of the dining plate. Clearly, the global grayscale image matching the global object line image of the dining plate contains four different region grayscale values; therefore, the global grayscale image of the dining plate can be divided to obtain four region mask images of the dining plate.

[0066] S240. Divide the global object line image into local regions based on the region mask image to obtain a local object line image.

[0067] S250, The line images of each of the local contained objects are used as the line images of the target contained objects.

[0068] Among them, the local object line image can be obtained by dividing the global object line image using the gray values ​​of the region mask image.

[0069] In this embodiment of the invention, local regions are divided using region mask images of different areas to obtain local object line images corresponding to the regions where the region mask images are located. These local object line images are then used as the target object line images. The number of target object line images should be consistent with the number of region mask images.

[0070] In a specific example, let's continue the explanation using a food plate as the container to be tested. Figure 7 This is a schematic diagram of a partial containment of an object line image provided in Embodiment 2 of the present invention, as shown below. Figure 7 As shown, multiple region mask images are obtained according to the above steps. Each region mask image is used to divide the global object line image of the food plate into local regions, resulting in local object line images corresponding to the regions in the region mask images. These local object line images are then used as the target object line images. The number of local object line images of the food plate should be consistent with the number of region mask images. Obviously, four local object line images of the food plate, corresponding to the region mask images, can be generated.

[0071] S260. Calculate the line length information in the line image of the target contained object.

[0072] In this embodiment of the invention, the line image of the partially contained object is used as the line image of the target contained object, and the length information of all lines in the line image of the target contained object is statistically analyzed.

[0073] In a specific example, let's continue the explanation using a food plate as the container to be detected. The above steps yield line images of the objects contained within each part of the food plate. These line images are then used as the target object line images of the food plate, and the line length information in each target object line image is calculated.

[0074] S270. Determine the preset line number threshold for matching the line image of the target contained object.

[0075] S280. Calculate the relationship between the line length information in the line image of the target contained object and the preset line number threshold.

[0076] S290. Determine the remaining amount of local contained object corresponding to each target contained object line image based on the relationship between the line length information in the target contained object line image and the preset line quantity threshold.

[0077] In a specific example, the preset line quantity threshold may include a first line quantity threshold and a second line quantity threshold; determining the remaining amount of the local contained object corresponding to each target contained object line image based on the relationship between the line length information in the target contained object line image and the preset line quantity threshold may include: when the total line length in the target contained object line image is less than or equal to the first line quantity threshold, determining the remaining amount of the local contained object as a first preset remaining amount of contained object; when the total line length in the target contained object line image is greater than or equal to the second line quantity threshold, determining the remaining amount of the local contained object as a second preset remaining amount of contained object; when the total line length in the target contained object line image is greater than the first line quantity threshold and less than the second line quantity threshold, calculating the line ratio relationship between the total line length in the target contained object line image and the second line quantity threshold, and determining the value of the remaining amount of the local contained object based on the line ratio relationship.

[0078] The first line quantity threshold can be used as a reference indicator to represent the insufficient supply of objects. The second line quantity threshold can be used as a reference indicator to represent the sufficient supply of objects. Both the first and second line quantity thresholds can be customized according to the different line images of the target objects. The first setting of the remaining amount of objects can represent a fixed percentage of objects contained in the container when it is empty. The second setting of the remaining amount of objects can represent a fixed percentage of objects contained in the container when it is full.

[0079] In a specific example, let's continue the explanation using a food plate as an example. Assume that the first threshold for the number of lines in the target object's line image is 100, and the second threshold is 1000. The first setting for the remaining amount of the object can be 0%, and the second setting can be 100%. Then, when the total length of the lines in the target object's line image is 80, the remaining amount of the object locally is 0%; when the total length is 5000, the remaining amount is 100%; when the number of lines is 500, the total length is greater than the first threshold and less than the second threshold. Therefore, the remaining amount of the object locally can be calculated by comparing the total length with the second threshold. This calculated remaining amount could be 50%.

[0080] S2100. Calculate the sum of the remaining quantities of each of the local containers to obtain the remaining quantities of the containers to be detected.

[0081] In a specific example, the step of summing the remaining quantities of each of the local contained objects to obtain the remaining quantity of the contained objects in the container to be detected may include: determining the local proportion weight of the line image matching of each of the target contained objects; calculating the product of the remaining quantity of the local contained objects matched by the line image matching of each of the target contained objects and the local proportion weight to obtain the remaining quantity of the target local contained objects matched by the line image matching of each of the target contained objects; and summing the remaining quantities of each of the target local contained objects to obtain the remaining quantity of the contained objects in the container to be detected.

[0082] In this embodiment of the invention, the local proportion weight of the target containment object line image matching can be customized according to actual needs, and the remaining amount of the local containment object matched by the target containment object line image matching is multiplied by the local proportion weight to obtain the remaining amount of the target local containment object matched by the target containment object line image. Finally, the remaining amounts of the target local containment objects are summed to obtain the remaining amount of the containment object of the container to be detected.

[0083] In a specific example, let's continue the explanation using a food plate as the container to be detected. The weighting of the local proportions in the matching of the target object's line image on the food plate can be customized according to actual needs. The weighting of local region A in the matching of the target object's line image on the food plate can be 0.3, the weighting of local region B in the matching of the target object's line image on the food plate can be 0.25, the weighting of local region C in the matching of the target object's line image on the food plate can be 0.25, and the weighting of local region D in the matching of the target object's line image on the food plate can be 0.2. The remaining amount of the locally contained object obtained from the above steps can be 100%, 86%, 0, and 0, respectively. Furthermore, the remaining amount of the local contained object obtained from the matching of the line images of each target contained object obtained in the above steps is multiplied by the local proportion weight to obtain the remaining amount of the target local contained object matched by the line images of each target contained object. Finally, the remaining amounts of each target local contained object are summed to obtain the remaining amount of the contained object in the container to be detected. That is, 100% is multiplied by 0.3, 86% is multiplied by 0.25, 0 is multiplied by 0.25, and 0 is multiplied by 0.25. Finally, the remaining amount of the contained object in the plate is 51.5%.

[0084] In this embodiment of the invention, the container to be tested can also be a cat litter box. Figure 8 This is a schematic diagram of another container image to be detected provided in Embodiment 2 of the present invention, as shown below. Figure 8As shown, a fixed camera can be installed on the litter box to capture images of the container to be inspected.

[0085] Figure 9 This is a schematic diagram of another globally contained object line image provided in Embodiment 2 of the present invention, such as... Figure 9 As shown, edge detection algorithms can be used to perform edge detection processing on the image of the container to be detected to obtain global line information in the image of the container to be detected, and generate a global image of the line of the container.

[0086] Figure 10 This is a schematic diagram of another grayscale image provided in Embodiment 2 of the present invention, as shown below. Figure 10 As shown, the global grayscale image that matches the global object line image of the litter box is obtained according to the above steps. Obviously, the global grayscale image that matches the global object line image of the litter box contains 4 different regions, and each region corresponds to a different grayscale value.

[0087] Figure 11 This is a schematic diagram of a region mask image provided in Embodiment 2 of the present invention, as shown below. Figure 11 As shown, based on the grayscale values ​​of different regions in the global grayscale image, the global grayscale image is divided to obtain the region mask image of the cat litter box. Clearly, the global grayscale image matching the global object line image of the cat litter box contains four different region grayscale values; therefore, the global grayscale image of the cat litter box can be divided to obtain four region mask images of the cat litter box.

[0088] Figure 12 This is a schematic diagram of another partial containment of object line images provided in Embodiment 2 of the present invention, as shown below. Figure 12 As shown, multiple region mask images are obtained according to the above steps. Each region mask image is used to divide the global litter box's object line image into local regions, resulting in local object line images corresponding to the regions in the region mask images. These local object line images are then used as the target object line images. The number of local object line images of the litter box should match the number of region mask images. Obviously, four local object line images of the litter box, corresponding to the region mask images, can be generated. Each local object line image of the litter box is obtained through the above steps, and each local object line image is used as the target object line image of the litter box. Simultaneously, the line length information in each target object line image is calculated.

[0089] Furthermore, assuming the first threshold for the number of lines in the target litter box's line image is 100, and the second threshold is 1000, and the first set residual amount is 0%, and the second set residual amount is 100%, then: when the total length of the lines in the target litter box's line image is 80, the residual amount of the local litter box is determined to be 0%; when the total length of the lines in the target litter box's line image is 5000, the residual amount of the local litter box is determined to be 100%; when the number of lines in the target litter box's line image is 500, the total length of the lines in the target litter box's line image is greater than the first line number threshold and less than the second line number threshold. Therefore, by calculating the line ratio between the total length of the lines in the target litter box's line image and the second line number threshold, the value of the residual amount of the local litter box can be obtained, and the calculated value of the residual amount of the local litter box can be 50%.

[0090] The weighting of local proportions in the matching of the target object's line image in the litter box can be customized according to actual needs. The weighting of local region A in the matching image can be 0.3, local region B can be 0.25, local region C can be 0.25, and local region D can be 0.2. The remaining amount of the object in each region obtained from the above steps can be 100%, 100%, 85%, and 0, respectively. Furthermore, the remaining amount of the local contained object obtained from the matching of the line images of each target contained object obtained in the above steps is multiplied by the local proportion weight to obtain the remaining amount of the target local contained object matched by the line images of each target contained object. Finally, the remaining amounts of each target local contained object are summed to obtain the remaining amount of the contained object in the container to be detected. That is, 100% is multiplied by 0.3, 100% is multiplied by 0.25, 86% is multiplied by 0.25, and 0 is multiplied by 0.25. Finally, the remaining amount of the contained object in the cat litter tray is 76%.

[0091] The technical solution of this invention first acquires an image of the container to be detected, calculates global line information in the image, generates a global object-containing line image and a region mask image, divides the global object-containing line image into local regions based on the region mask image to obtain local object-containing line images, uses each local object-containing line image as a target object-containing line image, calculates the line length information in the target object-containing line image, determines a preset line number threshold for matching the target object-containing line image, calculates the relationship between the line length information in the target object-containing line image and the preset line number threshold, determines the remaining amount of the local object-containing line image corresponding to each target object-containing line image based on the relationship between the line length information in the target object-containing line image and the preset line number threshold, and finally sums the remaining amounts of each local object-containing line image to obtain the remaining amount of the container to be detected. By setting a preset line number threshold to calculate the remaining amount of the container, accurate detection of the remaining amount of the container-containing object is achieved, improving the accuracy of detecting the remaining amount of the container-containing object.

[0092] Example 3

[0093] Figure 13 This is a schematic diagram of a device for detecting the remaining amount of an object provided in Embodiment 3 of the present invention, as shown below. Figure 13 As shown, the device includes: a container image acquisition module 310, a target contained object line image generation module 320, a line length information calculation module 330, and a remaining amount of contained object determination module 340, wherein:

[0094] The image acquisition module 310 for the container to be detected is used to: acquire the image of the container to be detected;

[0095] The target container line image generation module 320 is used to: calculate the line information in the image of the container to be detected, and generate a target container line image;

[0096] The line length information calculation module 330 is used to: calculate the line length information in the line image of the target contained object;

[0097] The remaining quantity of the container is determined by module 340, which is used to determine the remaining quantity of the container to be detected based on the line length information in the line image of the target container.

[0098] The technical solution of this invention involves acquiring an image of the container to be detected and calculating the line information in the image to generate a target object line image. Then, the line length information in the target object line image is calculated, and the remaining amount of the container to be detected is determined based on the line length information. This achieves accurate detection of the remaining amount of the container's contents, improving the accuracy of container content detection.

[0099] Optionally, the target containment object line image generation module 320 is specifically used for: calculating global line information in the image of the container to be detected, generating a global containment object line image; generating a region mask image matching the global containment object line image; dividing the global containment object line image into local regions according to the region mask image to obtain local containment object line images; and using each of the local containment object line images as the target containment object line image.

[0100] Optionally, the target containment object line image generation module 320 is further specifically used to: generate a global grayscale image matching the global containment object line image; and divide the global grayscale image into a set number of region mask images according to the regional grayscale values ​​of the global grayscale image.

[0101] Optionally, the remaining quantity of the container is determined by module 340, which is specifically used to: determine a preset line number threshold for matching the line image of the target container; calculate the relationship between the line length information in the line image of the target container and the preset line number threshold; and determine the remaining quantity of the container to be detected based on the relationship between the line length information in the line image of the target container and the preset line number threshold.

[0102] Optionally, the number of target containment object line images is multiple, and the containment object remaining quantity determination module 340 is specifically used to: determine the local containment object remaining quantity corresponding to each target containment object line image based on the relationship between the line length information in the target containment object line image and the preset line quantity threshold; and calculate the sum of the local containment object remaining quantities to obtain the containment object remaining quantity of the container to be detected.

[0103] Optionally, the preset line quantity threshold includes a first line quantity threshold and a second line quantity threshold. The remaining amount of the object to be accommodated is determined by the following steps: when the total length of the lines in the target object to be accommodated line image is less than or equal to the first line quantity threshold, the remaining amount of the local object to be accommodated is determined as a first set remaining amount of the object to be accommodated; when the total length of the lines in the target object to be accommodated line image is greater than or equal to the second line quantity threshold, the remaining amount of the local object to be accommodated is determined as a second set remaining amount of the object to be accommodated; when the total length of the lines in the target object to be accommodated line image is greater than the first line quantity threshold and less than the second line quantity threshold, the line ratio relationship between the total length of the lines in the target object to be accommodated line image and the second line quantity threshold is calculated, and the value of the remaining amount of the local object to be accommodated is determined according to the line ratio relationship.

[0104] Optionally, the remaining quantity determination module 340 is specifically used for: determining the local proportion weight of the matching of the line images of each target object; calculating the product of the local remaining quantity of the matching of the line images of each target object and the local proportion weight to obtain the target local remaining quantity of the matching of the line images of each target object; and summing the total of the target local remaining quantities to obtain the remaining quantity of the object to be detected in the container.

[0105] The aforementioned object-containing remaining quantity detection device can execute the object-containing remaining quantity detection method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the object-containing remaining quantity detection method provided in any embodiment of the present invention.

[0106] Example 4

[0107] Figure 14 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0108] like Figure 14As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0109] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0110] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as the method for detecting the remaining volume of objects contained in a container.

[0111] In some embodiments, the method for detecting the remaining volume of an object contained in a container may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the method for detecting the remaining volume of an object contained in a container as described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the method for detecting the remaining volume of an object contained in a container by any other suitable means (e.g., by means of firmware).

[0112] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0113] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0114] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0115] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0116] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0117] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

Claims

1. A method for detecting the remaining amount of an object contained in a container, characterized in that, include: Obtain the image of the container to be detected; Calculate the line information in the image of the container to be detected to generate a line image of the target container; wherein, the line image of the target container is image data composed of all the lines of the image of the container to be detected; Calculate the line length information in the line image of the target contained object; The remaining amount of the object in the container to be detected is determined based on the line length information in the line image of the target object. The step of calculating the line information in the image of the container to be detected and generating a line image of the target container object includes: Calculate the global line information in the image of the container to be detected, and generate a global line image of the contained object; Generate a region mask image that matches the global object line image; the grayscale values ​​of each region in the region mask image are different. Based on the region mask image, the global object line image is divided into local regions to obtain a local object line image. Each of the local contained object line images is used as the target contained object line image; Determining the remaining amount of the container to be detected based on the line length information in the line image of the target contained object includes: Determine a preset threshold for the number of lines to match the line image of the target object; Calculate the relationship between the line length information in the line image of the target contained object and the preset line number threshold; The remaining amount of the object to be detected in the container is determined based on the relationship between the line length information in the line image of the target object and the preset line number threshold. The number of target-containing object line images is multiple; the step of determining the remaining amount of the container to be detected based on the relationship between the line length information in the target-containing object line images and the preset line number threshold includes: The remaining amount of local contained object corresponding to each target contained object line image is determined based on the relationship between the line length information in the target contained object line image and the preset line number threshold. The total amount of remaining objects in each of the aforementioned local containers is calculated to obtain the amount of remaining objects in the container to be detected. The preset line quantity threshold includes a first line quantity threshold and a second line quantity threshold; determining the remaining amount of the local contained object corresponding to each target contained object line image based on the relationship between the line length information in the target contained object line image and the preset line quantity threshold includes: If the total length of the lines in the target containment object line image is less than or equal to the first line number threshold, the remaining amount of the local containment object is determined to be the first set remaining amount of the containment object. If the total length of the lines in the target containment object line image is greater than or equal to the second line number threshold, the remaining amount of the local containment object is determined as the second set remaining amount of the containment object; If the total length of the lines in the target containment object line image is greater than the first line number threshold and less than the second line number threshold, calculate the line ratio relationship between the total length of the lines in the target containment object line image and the second line number threshold, and determine the value of the remaining amount of the locally containment object based on the line ratio relationship.

2. The method according to claim 1, characterized in that, The generation of the region mask image that globally accommodates the object line image includes: Generate a global grayscale image that matches the global object line image; Based on the regional grayscale values ​​of the global grayscale image, the global grayscale image is divided into a set number of regional mask images.

3. The method according to claim 1, characterized in that, The summation of the remaining quantities of the objects contained in each of the aforementioned local containers is used to obtain the remaining quantity of the objects contained in the container to be detected, including: Determine the local proportion weight of the line image matching of each target object; Calculate the product of the remaining amount of the local contained object matched with the local proportion weight of each of the target contained object line images to obtain the remaining amount of the target local contained object matched with each of the target contained object line images; The total amount of remaining objects contained in each of the target localities is calculated to obtain the amount of remaining objects contained in the container to be detected.

4. A device for detecting the remaining amount of an object, characterized in that, include: The module for acquiring the image of the container to be detected is used to acquire the image of the container to be detected. The target container line image generation module is used to calculate the line information in the image of the container to be detected and generate a target container line image; wherein, the target container line image is image data composed of all the lines of the image of the container to be detected; The line length information calculation module is used to calculate the line length information in the line image of the target contained object; The remaining quantity of the container is determined by a module for determining the remaining quantity of the container to be detected based on the line length information in the line image of the target container. Specifically, the target-containing object line image generation module is used for: Calculate global line information in the image of the container to be detected to generate a global object-containing line image; generate a region mask image that matches the global object-containing line image; the gray values ​​of each region in the region mask image are different; divide the global object-containing line image into local regions according to the region mask image to obtain local object-containing line images; use each of the local object-containing line images as the target object-containing line image. The remaining quantity determination module is specifically used for: determining a preset line number threshold for matching the line image of the target object; calculating the relationship between the line length information in the line image of the target object and the preset line number threshold; and determining the remaining quantity of the object to be detected in the container based on the relationship between the line length information in the line image of the target object and the preset line number threshold. The number of target containment object line images is multiple. The containment object remaining quantity determination module is specifically used to: determine the local containment object remaining quantity corresponding to each target containment object line image based on the relationship between the line length information in the target containment object line image and the preset line quantity threshold; and calculate the sum of the local containment object remaining quantities to obtain the containment object remaining quantity of the container to be detected. The preset line quantity threshold includes a first line quantity threshold and a second line quantity threshold. The remaining amount of the object to be accommodated is determined by the following modules: when the total length of the lines in the target object line image is less than or equal to the first line quantity threshold, the remaining amount of the local object to be accommodated is determined as a first set remaining amount of the object to be accommodated; when the total length of the lines in the target object line image is greater than or equal to the second line quantity threshold, the remaining amount of the local object to be accommodated is determined as a second set remaining amount of the object to be accommodated; when the total length of the lines in the target object line image is greater than the first line quantity threshold and less than the second line quantity threshold, the module calculates the line ratio relationship between the total length of the lines in the target object line image and the second line quantity threshold, and determines the value of the remaining amount of the local object to be accommodated based on the line ratio relationship.

5. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the object remaining quantity detection method according to any one of claims 1-3.

6. A computer storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the object remaining quantity detection method according to any one of claims 1-3.