WO2022174541A1 - Garbage detection method and apparatus, device, storage medium, and program product - Google Patents

Garbage detection method and apparatus, device, storage medium, and program product Download PDF

Info

Publication number
WO2022174541A1
WO2022174541A1 PCT/CN2021/103078 CN2021103078W WO2022174541A1 WO 2022174541 A1 WO2022174541 A1 WO 2022174541A1 CN 2021103078 W CN2021103078 W CN 2021103078W WO 2022174541 A1 WO2022174541 A1 WO 2022174541A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
detected
garbage
target
target object
Prior art date
Application number
PCT/CN2021/103078
Other languages
French (fr)
Chinese (zh)
Inventor
窦浩轩
王意如
甘伟豪
Original Assignee
北京市商汤科技开发有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 北京市商汤科技开发有限公司 filed Critical 北京市商汤科技开发有限公司
Publication of WO2022174541A1 publication Critical patent/WO2022174541A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/40Scenes; Scene-specific elements in video content
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/25Determination of region of interest [ROI] or a volume of interest [VOI]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/50Context or environment of the image
    • G06V20/52Surveillance or monitoring of activities, e.g. for recognising suspicious objects

Definitions

  • the corresponding terminal or cleaning robot is determined according to the location of the garbage, and then the garbage alarm is sent to the terminal or robot, so that the cleaner holding the terminal can clean up the garbage in time or the cleaning robot can dispose of the garbage in time.
  • the scene information here may include scene attributes, and the scene information also includes at least one of scene time information and the like.
  • scene attributes can be amusement parks, stations, schools, hospitals, shopping malls, industrial parks, office buildings, canteens, restaurants, etc.
  • scene time information refers to the time or season corresponding to the current scene, etc. If the scene attribute is canteen, the scene time The information can be the peak and off-peak hours of dining; if the scene attribute is shopping malls, amusement parks, the scene time information can be business hours or non-business hours, etc.; if the scene attribute is school, the scene time information can be holidays or semesters, or It can be during school hours or after school hours.
  • the first image to be detected is obtained from an online video stream.
  • the online video stream can be obtained by using a camera device installed in a place where suspected garbage needs to be determined.
  • the first image to be detected is acquired from an online video stream, and the acquisition time of the second image to be detected is earlier than the acquisition time of the first image to be detected.
  • the attribute information of the object includes at least one of the following: the shape, material, size, and location of the object.
  • the second detection result indicates that the same target object exists in the second image to be detected as in the first image to be detected, that is, within the same viewing angle range, the same object exists for a period of time, it can be determined that the target object exists in the second image to be detected.
  • Objects are unmanaged, ie, garbage.
  • the garbage has some specific shapes, materials, sizes, and locations, it can be directly determined whether the target object is garbage according to the attribute information of the object. In this way, the efficiency and accuracy of garbage determination are greatly improved.
  • the garbage cleaning in an area can correspond to the terminal or robot that manages the area
  • a mapping relationship can be established between the location of the garbage and the terminal or cleaning robot of the location object, according to the mapping relationship and the location of the garbage.
  • the position of the corresponding terminal or cleaning robot is determined.
  • multi-frame logic is used to effectively exclude everyday objects that are similar in shape to garbage but not belonging to the type of garbage, improve the performance of the target garbage detection model in real scenes, and solve the problem that the existing technology only uses single-frame images
  • multi-frame garbage confirmation logic is added to the real scene detection to exclude easily confused items and further improve the performance of the garbage detection framework. From the user's point of view, the user can use this garbage detection method to quickly and iteratively improve the potential target detection applications in intelligent video analysis or intelligent management online under limited labor and computing resources. The computing cost quickly reaches the performance requirements required by the business, and can continue to improve the model performance after that.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Multimedia (AREA)
  • General Engineering & Computer Science (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Computation (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Health & Medical Sciences (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Evolutionary Biology (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Image Analysis (AREA)

Abstract

A garbage detection method and apparatus, a device, a storage medium, and a program product. The method comprises: obtaining a first image to be detected (S101); when it is determined that a target object exists in the first image to be detected, obtaining a second image to be detected, wherein an overlapping ratio between an acquisition region of the first image to be detected and an acquisition region of the second image to be detected is greater than a preset threshold, and acquisition time of the first image to be detected and acquisition time of the second image to be detected have a preset time interval (S102); and when it is determined that the target object exists in the second image to be detected, determining that the target object is garbage (S103).

Description

一种垃圾检测方法、装置、设备、存储介质及程序产品A garbage detection method, device, equipment, storage medium and program product
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本申请基于申请号为202110193692.6、申请日为2021年02月20日、申请名称为“垃圾检测方法、装置、设备及计算机存储介质”的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此以引入方式并入本申请。This application is based on the Chinese patent application with the application number of 202110193692.6, the application date of February 20, 2021, and the application name of "garbage detection method, device, equipment and computer storage medium", and claims the priority of the Chinese patent application, The entire contents of this Chinese patent application are hereby incorporated by reference into this application.
技术领域technical field
本申请涉及但不限于智能管理领域,尤其涉及一种垃圾检测方法、装置、设备、存储介质及程序产品。The present application relates to, but is not limited to, the field of intelligent management, and in particular, relates to a method, apparatus, device, storage medium and program product for garbage detection.
背景技术Background technique
通过图像来对垃圾检测有非常重要的作用。现有技术主要通过大量人力来对未标注数据进行标注,耗费人力以及计算资源。利用单帧图像无法有效排除与垃圾形态类似易混淆的日常物品。It has a very important role in garbage detection through images. The prior art mainly uses a lot of manpower to label unlabeled data, which consumes manpower and computing resources. Using a single frame of image cannot effectively exclude everyday objects that are confusingly similar to garbage.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供一种垃圾检测方法、装置、设备、存储介质及程序产品。Embodiments of the present application provide a garbage detection method, apparatus, device, storage medium, and program product.
第一方面,提供一种垃圾检测方法,所述方法包括:A first aspect provides a method for detecting garbage, the method comprising:
获取第一待检测图像;在确定所述第一待检测图像中存在目标对象的情况下,获取第二待检测图像,其中,所述第一待检测图像的采集区域与所述第二待检测图像的采集区域之间的重叠比例大于预设阈值,且所述第一待检测图像与所述第二待检测图像的采集时间相距预设的时间间隔;在确定所述第二待检测图像中存在所述目标对象的情况下,确定所述目标对象为垃圾。Acquire a first image to be detected; in the case where it is determined that a target object exists in the first image to be detected, acquire a second image to be detected, wherein the acquisition area of the first image to be detected is the same as the second image to be detected The overlap ratio between the image acquisition areas is greater than a preset threshold, and the acquisition time of the first to-be-detected image and the second to-be-detected image is separated by a preset time interval; in determining the second to-be-detected image When the target object exists, it is determined that the target object is garbage.
在一些实施方式中,所述方法还包括:分析所述第一待检测图像中的场景信息;根据所述第一待检测图像中的场景信息,确定所述目标对象。In some embodiments, the method further includes: analyzing scene information in the first image to be detected; and determining the target object according to the scene information in the first image to be detected.
这样,根据第一待检测图像中的场景信息来确定目标对象,可以有效提升确定目标对象的效率和准确率。In this way, determining the target object according to the scene information in the first image to be detected can effectively improve the efficiency and accuracy of determining the target object.
在一些实施例中,所述方法还包括:根据所述第一待检测图像的属性参数和/或所述目标对象的属性参数,确定所述时间间隔;其中,所述第一待检测图像的属性参数至少包括以下之一:所述第一待检测图像的场景信息、所述第一待检测图像的采集时间所属的时段或季节。In some embodiments, the method further includes: determining the time interval according to attribute parameters of the first image to be detected and/or attribute parameters of the target object; wherein the first image to be detected The attribute parameter includes at least one of the following: scene information of the first image to be detected, and a time period or season to which the acquisition time of the first image to be detected belongs.
这样,根据第一待检测图像的属性参数和/或目标对象的属性参数,确定的时间间隔能够进一步提升垃圾检测效率,以使得疑似垃圾尽快得到确认。In this way, the time interval determined according to the attribute parameters of the first image to be detected and/or the attribute parameters of the target object can further improve the efficiency of garbage detection, so that the suspected garbage can be confirmed as soon as possible.
在一些实施例中,所述方法还包括:利用目标垃圾检测模型对从所述在线视频流中提取的第一待检测图像进行检测,得到第一检测结果;所述在确定所述第一待检测图像中存在目标对象的情况下,获取第二待检测图像,包括:在根据所述第一检测结果确定所述第一待检测图像中存在所述目标对象的情况下,从存储的视频库中获取所述第二待检测图像;对应地,所述方法还包括:利用目标垃圾检测模型对从所述第二待检测图像进行检测,得到第二检测结果;所述在确定所述第二待检测图像中存在所述目标对象的情况下,确定所述目标对象为垃圾,包括:在根据所述第二检测结果确定所述第二待检测图像中存在所述目标对象的情况下,确定所述目标对象为垃圾。In some embodiments, the method further includes: using a target garbage detection model to detect the first image to be detected extracted from the online video stream to obtain a first detection result; In the case where the target object exists in the detected image, acquiring the second image to be detected includes: in the case that the target object exists in the first image to be detected according to the first detection result, from a stored video library Obtaining the second image to be detected in ; correspondingly, the method further includes: using a target garbage detection model to detect from the second image to be detected to obtain a second detection result; In the case that the target object exists in the to-be-detected image, determining that the target object is garbage includes: in the case of determining that the target object exists in the second to-be-detected image according to the second detection result, determining The target object is garbage.
这样,利用数据挖掘方法针对真实场景中的在线视频流和存储的视频库数据进行挖掘,快速确定目标垃圾检测模型难以检测识别的困难样本,解决传统方法无法全面收集数据的问题。In this way, the data mining method is used to mine the online video stream and the stored video database data in the real scene, to quickly determine the difficult samples that are difficult to detect and identify by the target garbage detection model, and solve the problem that the traditional method cannot comprehensively collect data.
在一些实施例中,所述利用目标垃圾检测模型对从所述在线视频流中提取的第一待检测图像进行检测,得到第一检测结果,包括:利用所述目标垃圾检测模型分析所述第一待检测图像中对象的属性信息;根据所述第一待检测图像中对象的属性信息确定对应对象属于所述目标对象还是属于垃圾,得到第一检测结果;所述利用所述目标垃圾检测模型对从所述第二待检测图像进行检测,得到第二检测结果,包括:利用所述目标垃圾检测模型分析所述第二待检测图像中对象的属性信息;根据所述第二待检测图像中对象的属性信息,确定对应对象属于所述目标对象还是属于垃圾,得到第二检测结果。所述对象的属性信息包括以下至少之一:所述对象的形态、材质、大小、所处的位置。In some embodiments, the detecting the first to-be-detected image extracted from the online video stream by using the target garbage detection model to obtain a first detection result includes: using the target garbage detection model to analyze the first image to be detected attribute information of the object in the image to be detected; determine whether the corresponding object belongs to the target object or garbage according to the attribute information of the object in the first image to be detected, and obtain a first detection result; the use of the target garbage detection model Detecting the second to-be-detected image to obtain a second detection result includes: using the target garbage detection model to analyze the attribute information of the object in the second to-be-detected image; The attribute information of the object is used to determine whether the corresponding object belongs to the target object or the garbage, and a second detection result is obtained. The attribute information of the object includes at least one of the following: the shape, material, size, and location of the object.
这样,因为垃圾具有一些特定形态、材质、大小和所处的位置,所以可以根据对象的属性信息直接确定目标对象是否为垃圾。这样,极大提升了确定垃圾的效率和准确性。In this way, because the garbage has some specific shape, material, size and location, it can be directly determined whether the target object is garbage according to the attribute information of the object. In this way, the efficiency and accuracy of garbage determination are greatly improved.
在一些实施例中,在所述第一检测结果为所述对象属于垃圾的情况下,所述方法还包括:根据所述对象的属性信息确定所述垃圾所属的垃圾类别和所述垃圾所处的位置;根据所述垃圾类别和所述垃圾所处的位置,确定垃圾告警对应的内容;将所述垃圾告警对应的内容发送给垃圾管理平台。In some embodiments, when the first detection result is that the object belongs to garbage, the method further includes: determining, according to attribute information of the object, a garbage category to which the garbage belongs and where the garbage is located. the location of the garbage alarm; determine the content corresponding to the garbage alarm according to the garbage category and the location of the garbage; send the content corresponding to the garbage alarm to the garbage management platform.
这样,在确定有垃圾的情况下,可以及时将垃圾信息(垃圾类别、所处位置)发送给垃圾管理平台,以实现及时根据垃圾类别和所处位置对垃圾进行合理的处理。In this way, when it is determined that there is garbage, the garbage information (garbage category, location) can be sent to the garbage management platform in time, so as to realize timely and reasonable disposal of garbage according to the garbage category and location.
在一些实施例中,所述利用目标垃圾检测模型对从所述在线视频流中提取的第一待检测图像进行检测,得到第一检测结果,还包括:对所述第一待检测图像进行检测,确定所述第一待检测图像对应的目标对象和目标框;根据所述第一待检测图像对应的目标对象和所述目标框,确定第一交并比;对应地,在根据所述第二检测结果确定所述第二待检测图像中存在所述目标对象的情况下,确定所述目标对象为垃圾,包括:在确定所述第二待检测图像对应的目标对象的情况下,根据所述目标框和所述第二待检测图像对应的目标对象确定第二交并比;在所述第一交并比与所述第二交并比同时大于预设交并比阈值的情况下,确定所述目标对象为垃圾。In some embodiments, the detecting the first image to be detected extracted from the online video stream by using a target garbage detection model to obtain a first detection result further includes: detecting the first image to be detected , determine the target object and the target frame corresponding to the first image to be detected; determine the first intersection ratio according to the target object and the target frame corresponding to the first image to be detected; In the case where the second detection result determines that the target object exists in the second to-be-detected image, determining that the target object is garbage includes: in the case of determining the target object corresponding to the second to-be-detected image, according to the The target frame and the target object corresponding to the second to-be-detected image determine a second intersection ratio; under the condition that the first intersection ratio and the second intersection ratio are greater than the preset intersection ratio threshold at the same time, The target object is determined to be garbage.
这样,采用评估不同时间帧上目标框的交并比是否连续超过某一个阈值的方法,来确定是否检测出来的垃圾在画面中一段时间内长时出现。可以有效排除形态与垃圾相似,但是不属于垃圾种类的日常物品,提升本申请实施例在真实场景中的性能。In this way, a method of evaluating whether the intersection ratio of target frames on different time frames continuously exceeds a certain threshold is used to determine whether the detected garbage appears in the picture for a long time in a period of time. The daily objects that are similar in shape to garbage but do not belong to the garbage type can be effectively excluded, and the performance of the embodiment of the present application in real scenes can be improved.
这样,根据所述垃圾所处的位置确定对应的终端或清洁机器人,然后将所述垃圾告警发送给终端或机器人,可以使得持有所述终端的保洁员及时清理垃圾或者清洁机器人及时处理垃圾。In this way, the corresponding terminal or cleaning robot is determined according to the location of the garbage, and then the garbage alarm is sent to the terminal or robot, so that the cleaner holding the terminal can clean up the garbage in time or the cleaning robot can dispose of the garbage in time.
在一些实施例中,所述目标垃圾检测模型是采用下面的步骤得到的,包括:获取至少一张目标图像;所述目标图像是将从视频流中截取的待检测图像输入至初始垃圾检测模型,根据所述初始垃圾检测模型输出的检测结果确定的;所述初始垃圾检测模型是采用第一数据集进行训练的;其中,所述第一数据集为至少部分样本图像具有标注信息的数据集;获取对所述至少一张目标图像的人工标注结果,将标注后的所述至少一张目标图像作为训练样本合并到所述第一数据集,得到第二数据集;利用所述第二数据集对所述初始垃圾检测模型进行训练,得到所述目标垃圾检测模型。In some embodiments, the target garbage detection model is obtained by adopting the following steps, including: acquiring at least one target image; the target image is inputting the image to be detected intercepted from the video stream to the initial garbage detection model , determined according to the detection result output by the initial garbage detection model; the initial garbage detection model is trained by using a first data set; wherein, the first data set is a data set in which at least some sample images have annotation information ; Obtain the manual labeling result for the at least one target image, and merge the labeled at least one target image into the first data set as a training sample to obtain a second data set; Utilize the second data The initial garbage detection model is trained to obtain the target garbage detection model.
这样,由于采用初始垃圾检测模型从包括大量待检测图像的待检测图像集中,确定出对初始垃圾检测模型的训练具有高价值的至少一张目标图像,从而将标注后的至少一张目标图像合并到第一数据集,得到第二数据集,并采用第二数据集对初始垃圾检测模型进行训练,进而不仅使得训练后,得到的目标垃圾检测模型在检测目标时的检测结果更加准确,还能够通过有限的标注后的至少一张目标图像来有效提升目标垃圾检测模型性能,有效降低深度学习时的计算成本。In this way, since the initial garbage detection model is used to determine at least one target image with high value for the training of the initial garbage detection model from the to-be-detected image set including a large number of to-be-detected images, the labeled at least one target image is merged Go to the first data set, obtain the second data set, and use the second data set to train the initial garbage detection model, which not only makes the target garbage detection model obtained after training more accurate when detecting the target, but also can The performance of the target garbage detection model can be effectively improved by using at least one target image after a limited number of annotations, and the computational cost of deep learning can be effectively reduced.
在一些实施例中,所述获取至少一张目标图像,包括:将所述待检测图像输入所述初始垃圾检测模型,得到每一帧所述待检测图像的后验概率;在确定所述后验概率大于第一概率阈值且小于第二概率阈值的情况下,将与所述后验概率对应的待检测图像确定为所述目标图像,其中,所述第一概率阈值小于所述第二概率阈值。In some embodiments, the acquiring at least one target image includes: inputting the image to be detected into the initial garbage detection model to obtain a posteriori probability of the image to be detected for each frame; When the posterior probability is greater than the first probability threshold and less than the second probability threshold, the image to be detected corresponding to the posterior probability is determined as the target image, wherein the first probability threshold is less than the second probability threshold.
这样,利用第一概率阈值和第二概率阈值可以从待检测图像中筛选出困难样例。将困难样例确定为目标图像,可以使得利用困难样例训练得到的目标垃圾检测模型,有效提升对困难样例的检测准确性。In this way, by using the first probability threshold and the second probability threshold, difficult samples can be selected from the image to be detected. Determining difficult examples as target images can effectively improve the detection accuracy of difficult examples by using the target garbage detection model trained with difficult examples.
第二方面,提供一种垃圾检测装置,包括:第一获取模块,配置为获取第一待检测图像;第二获取模块,配置为在确定所述第一待检测图像中存在目标对象的情况下,获取第二待检测图像,其中,所述第一待检测图像的采集区域与所述第二待检测图像的采集区域之间的重叠比例大于预设阈值,且所述第一待检测图像与所述第二待检测图像的采集时间相距预设的时间间隔;第一确定模块,配置为在确定所述第二待检测图像中存在所述目标对象的情况下,确定所述目标对象为垃圾。In a second aspect, a garbage detection device is provided, comprising: a first acquisition module configured to acquire a first image to be detected; a second acquisition module configured to, when it is determined that a target object exists in the first image to be detected , obtain a second image to be detected, wherein the overlap ratio between the acquisition area of the first image to be detected and the acquisition area of the second image to be detected is greater than a preset threshold, and the first image to be detected is the same as the The collection time of the second to-be-detected image is separated from a preset time interval; the first determination module is configured to determine that the target object is garbage when it is determined that the target object exists in the second to-be-detected image .
第三方面,提供一种电子设备,包括:存储器和处理器,所述存储器存储有可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述方法中的步骤。In a third aspect, an electronic device is provided, comprising: a memory and a processor, wherein the memory stores a computer program that can be executed on the processor, and the processor implements the steps in the above method when the processor executes the computer program .
第四方面,提供一种计算机存储介质,所述计算机存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现上述方法中的步骤。In a fourth aspect, a computer storage medium is provided, the computer storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the above method.
第五方面,本申请还提供了一种计算机程序产品,所述计算机程序产品包括计算机程序或指令,在所述计算机程序或指令在计算机上运行的情况下,使得所述计算机执行上述方法中的步骤。In a fifth aspect, the present application also provides a computer program product, the computer program product includes a computer program or instructions, and when the computer program or instructions are run on a computer, the computer is caused to execute the above method. step.
在本申请实施例中,首选获取第一待检测图像,然后在确定第一待检测图像中存在目标对象的情况下,获取第二待检测图像,最后在确定第二待检测图像中存在目标对象的情况下,确定目标对象为垃圾。这样,利用多帧逻辑,可以有效排除形态与垃圾相似,但是不属于垃圾种类的日常物品,同时确定长时间位置未发生较大改变的物体为垃圾。In the embodiment of the present application, the first image to be detected is firstly acquired, then the second image to be detected is acquired when it is determined that there is a target object in the first image to be detected, and finally it is determined that there is a target object in the second image to be detected In the case of , determine that the target object is garbage. In this way, by using multi-frame logic, everyday objects that are similar in shape to garbage but not classified as garbage can be effectively excluded, and objects whose positions have not changed significantly for a long time are determined to be garbage.
附图说明Description of drawings
图1为本申请实施例提供的一种垃圾检测方法的流程示意图;FIG. 1 is a schematic flowchart of a garbage detection method according to an embodiment of the present application;
图2A为本申请实施例提供的另一种垃圾检测方法的流程示意图;2A is a schematic flowchart of another garbage detection method provided by an embodiment of the present application;
图2B为本申请实施例提供的一张待检测图像的示意图;2B is a schematic diagram of an image to be detected provided by an embodiment of the present application;
图2C为本申请实施例提供的另一张待检测图像的示意图;2C is a schematic diagram of another to-be-detected image provided by an embodiment of the present application;
图3为本申请实施例提供的又一种垃圾检测方法的流程示意图;3 is a schematic flowchart of another garbage detection method provided by an embodiment of the present application;
图4A为本申请实施例提供的一种目标检测模型的架构示意图;4A is a schematic diagram of the architecture of a target detection model provided by an embodiment of the present application;
图4B为本申请实施例提供的一种垃圾检测方法的流程示意图;4B is a schematic flowchart of a garbage detection method provided by an embodiment of the present application;
图4C为本申请实施例提供的一种垃圾检测方法的流程示意图;4C is a schematic flowchart of a garbage detection method provided by an embodiment of the present application;
图5为本申请实施例提供的一种垃圾检测装置的组成结构示意图;FIG. 5 is a schematic diagram of the composition and structure of a garbage detection device provided by an embodiment of the present application;
图6为本申请实施例提供的一种电子设备的硬件实体示意图。FIG. 6 is a schematic diagram of a hardware entity of an electronic device according to an embodiment of the present application.
实施方式Implementation
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对发明的技术方案做进一步详细描述。以下实施例用于说明本申请,但不用来限制本申请的范围。In order to make the purposes, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions of the invention will be described in further detail below with reference to the accompanying drawings in the embodiments of the present application. The following examples are used to illustrate the present application, but are not intended to limit the scope of the present application.
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application.
应当理解,此处所描述的一些实施例仅仅用以解释本申请的技术方案,并不用于限定本申请的技术范围。It should be understood that some embodiments described herein are only used to explain the technical solutions of the present application, and are not used to limit the technical scope of the present application.
本实施例提出一种垃圾检测方法,应用于电子设备,该方法所实现的功能可以通过电子设备中的处理器调用程序代码来实现,当然程序代码可以保存在计算机存储介质中,可见,该电子设备至少包括处理器和存储介质。This embodiment proposes a garbage detection method, which is applied to an electronic device. The functions implemented by the method can be realized by calling a program code by a processor in the electronic device. Of course, the program code can be stored in a computer storage medium. It can be seen that the electronic device The device includes at least a processor and a storage medium.
图1为本申请实施例提供的一种垃圾检测方法的实现流程示意图,如图1所示,该方法包括:FIG. 1 is a schematic diagram of the implementation flow of a garbage detection method provided by an embodiment of the present application. As shown in FIG. 1 , the method includes:
步骤S101、获取第一待检测图像;Step S101, acquiring a first image to be detected;
第一待检测图像可以是从在线视频流中获取的。在一些实施例中,可以按照设定时长从在线视频流中截取第一待检测图像。设定时长可以是一个固定的时长,或者,设定时长可以根据用户需求进行改变。例如,设定时长可以是1秒钟至30分钟的任一时长,例如,设定时长可以为1秒、5秒、1分钟、10分钟或30分钟等。在另一些实施例中,可以根据实际情况(例如,第一视频流的属性信息)确定截取时间间隔,并根据该截取时间间隔从在线视频流中截取第一待检测图像。The first image to be detected may be obtained from an online video stream. In some embodiments, the first image to be detected may be intercepted from the online video stream according to a set duration. The set duration may be a fixed duration, or the set duration may be changed according to user requirements. For example, the set duration may be any duration from 1 second to 30 minutes, for example, the set duration may be 1 second, 5 seconds, 1 minute, 10 minutes, or 30 minutes. In other embodiments, the interception time interval may be determined according to the actual situation (for example, attribute information of the first video stream), and the first image to be detected is intercepted from the online video stream according to the interception time interval.
在一些实施例中,可以根据在线视频流的属性参数,确定截取时间间隔。在线视频流的属性参数可以是环境参数、位置,还可以是在线视频流获取图像的所属时段。例如,可以将获取在线视频流的摄像装置所在的环境参数和位置信息作为属性参数,环境参数可以是商城、幼儿园或地铁站,位置可以以经纬度描述,所属时段为获取图像的时段。在实施的过程中,一种情况是获取的在线视频流为上下班高峰期的地铁站(属于人流高峰期),则截取时间间隔可以设置一个较小的时长,例如5分钟;另一种情况是获取的在线视频流为已经放学后的幼儿园(属于低峰期),则截取时间间隔可 以设置一个较长的时长,例如30分钟。In some embodiments, the interception time interval may be determined according to attribute parameters of the online video stream. The attribute parameters of the online video stream may be environmental parameters, locations, and may also be the time period in which images of the online video stream are obtained. For example, the environmental parameters and location information of the camera that obtains the online video stream can be used as attribute parameters. The environmental parameters can be shopping malls, kindergartens, or subway stations. In the process of implementation, in one case, the obtained online video stream is a subway station during the rush hour (belonging to the peak flow of people), then the interception time interval can be set to a smaller duration, such as 5 minutes; in another case If the obtained online video stream is a kindergarten after school (belonging to a low peak period), the interception time interval can be set to a longer duration, such as 30 minutes.
步骤S102、在确定所述第一待检测图像中存在目标对象的情况下,获取第二待检测图像,其中,所述第一待检测图像的采集区域与所述第二待检测图像的采集区域之间的重叠比例大于预设阈值,且所述第一待检测图像与所述第二待检测图像的采集时间相距预设的时间间隔;Step S102: In the case where it is determined that there is a target object in the first image to be detected, acquire a second image to be detected, wherein a collection area of the first image to be detected and a collection area of the second image to be detected The overlap ratio between them is greater than a preset threshold, and the acquisition times of the first to-be-detected image and the second to-be-detected image are separated by a preset time interval;
在一些实施例中,在一些特定的场景和时间段,目标对象才可以被确定为垃圾。例如,家门口放置的一个长时间不动的塑料盆、球场上的矿泉水瓶,食堂餐桌上长时间没有发生改变的实物。所以可以使用目标垃圾检测模型或者目标检测模块确定第一待检测图像中存在目标对象,这里,确定的目标对象是疑似垃圾,即,可能是长时间没有挪动的物体。In some embodiments, the target object can be determined to be garbage only in some specific scenarios and time periods. For example, a plastic basin that has not been moved for a long time at the door of the house, the mineral water bottle on the court, and the real object that has not changed for a long time on the dining room table. Therefore, a target garbage detection model or a target detection module can be used to determine that a target object exists in the first image to be detected. Here, the determined target object is suspected garbage, that is, it may be an object that has not been moved for a long time.
在确定第一待检测图像中存在疑似垃圾的情况下,需要再获取第二待检测图像。由于第一待检测图像与第二待检测图像需要采集到同一个目标对象,所以需要对第一待检测图像的采集区域与第二待检测图像的采集区域做限定,例如,第一待检测图像与第二待检测图像可以来自同一摄像设备采集的同一区域的图像,也可以是不同摄像设备,但第一待检测图像与第二待检测图像的采集区域之间的重叠比例大于预设阈值,即,重叠采集的区域足够覆盖到目标对象。When it is determined that there is suspected garbage in the first image to be detected, the second image to be detected needs to be acquired again. Since the first to-be-detected image and the second to-be-detected image need to be collected from the same target object, it is necessary to define the acquisition area of the first to-be-detected image and the second to-be-detected image acquisition area, for example, the first to-be-detected image The second to-be-detected image and the second to-be-detected image may be from the same area of the image collected by the same camera device, or from different camera devices, but the overlap ratio between the first to-be-detected image and the second to-be-detected image collection area is greater than a preset threshold, That is, the area of overlapping acquisitions is sufficient to cover the target object.
在一些实施例中,预设的时间间隔是可以根据实际应用场景进行设置的。例如,食堂里的食物如果30分钟还没有动,说明可能用户已经用餐结束了,需要作为垃圾进行清理;家门口的塑料盆如果几天例如2天没有动,说明可能是用户不要的塑料盆。在不同的场景下,第一待检测图像与第二待检测图像的采集时间是可以设置的,以满足不同场景下确定目标对象是否为垃圾的需求。In some embodiments, the preset time interval may be set according to actual application scenarios. For example, if the food in the cafeteria has not been moved for 30 minutes, it means that the user may have finished the meal and needs to be cleaned up as garbage; if the plastic pot at the door of the house has not been moved for several days, such as 2 days, it may be a plastic pot that the user does not want. In different scenarios, the acquisition time of the first to-be-detected image and the second to-be-detected image can be set to meet the requirements of determining whether the target object is garbage in different scenarios.
步骤S103、在确定所述第二待检测图像中存在所述目标对象的情况下,确定所述目标对象为垃圾。Step S103 , in the case that it is determined that the target object exists in the second image to be detected, determine that the target object is garbage.
垃圾的定义是模糊的,取决于与周边环境的关系(例如放在路边的塑料小盆可能是被遗弃的垃圾,也可能是暂时放置的他人物品),而这种与环境的关系往往随着地点改变而大幅变化。这种定义模糊的另一种体现方式为一个物品在一段时间内的位置与形态变化,而垃圾往往不会(例如一个拿在手中的塑料袋会随着时间推移而改变位置与形状,放置在地上的废弃塑料袋往往会在一段时间中位置固定),这种体现方式导致识别某些垃圾往往需要关注一段时间的视频变化。The definition of garbage is ambiguous and depends on the relationship with the surrounding environment (for example, a small plastic tub placed on the side of the road may be abandoned garbage, or it may be temporarily placed by others), and this relationship with the environment often varies with the environment. changes significantly depending on the location. Another manifestation of this vague definition is the change of position and shape of an item over a period of time, while garbage often does not (for example, a plastic bag in hand will change position and shape over time, placed in The discarded plastic bags on the ground tend to be fixed for a period of time), which leads to the identification of certain garbage that often requires attention to video changes over a period of time.
如果第一待检测图像与第二待检测图像都存在相同的目标对象,则确定为垃圾。这里,目标对象可以不在第一待检测图像与第二待检测图像同一位置,但是目标对象在一段时间内,即在第一待检测图像与第二待检测图像的画面中都出现,也可以确定为垃圾。例如,一个塑料瓶被移动了一段距离,但还是长时间出现在画面中,可以确定为垃圾。If both the first to-be-detected image and the second to-be-detected image have the same target object, it is determined to be garbage. Here, the target object may not be in the same position as the first image to be detected and the second image to be detected, but the target object appears within a period of time, that is, in both the images of the first image to be detected and the second image to be detected, or it can be determined for garbage. For example, a plastic bottle that has been moved a certain distance, but still appears in the picture for a long time, can be determined to be garbage.
在本申请实施例中,首选获取第一待检测图像,然后在确定第一待检测图像中存在目标对象的情况下,获取第二待检测图像,最后在确定第二待检测图像中存在目标对象的情况下,确定目标对象为垃圾。这样,利用多帧逻辑,可以有效排除形态与垃圾相似,但是不属于垃圾种类的日常物品,同时确定长时间位置未发生较大改变的物体为垃圾。In the embodiment of the present application, the first image to be detected is firstly acquired, then the second image to be detected is acquired when it is determined that there is a target object in the first image to be detected, and finally it is determined that there is a target object in the second image to be detected In the case of , determine that the target object is garbage. In this way, by using multi-frame logic, everyday objects that are similar in shape to garbage but not classified as garbage can be effectively excluded, and objects whose positions have not changed significantly for a long time are determined to be garbage.
图2A为本申请实施例提供的另一种垃圾检测方法的流程示意图,如图2A所示,该方法包括:FIG. 2A is a schematic flowchart of another garbage detection method provided by an embodiment of the present application. As shown in FIG. 2A , the method includes:
步骤S201、获取第一待检测图像;Step S201, acquiring a first image to be detected;
步骤S202、分析所述第一待检测图像中的场景信息;Step S202, analyzing scene information in the first image to be detected;
这里的场景信息可以包括场景属性,场景信息还包括场景时间信息等至少之一。例如:场景属性可以是游乐园、车站、学校、医院、商场、工业园区、写字楼、食堂、餐厅等;场景时间信息是指当前场景所对应的时间或季节等,如果场景属性是食堂,场景时间信息可以是就餐的高峰期和非高峰期;如果场景属性是商场、游乐园,场景时间信息可以是营业时间或非营业时间等;如果场景属性是学校,场景时间信息可以是假期或学期,还可以是上学时段或放学时段。The scene information here may include scene attributes, and the scene information also includes at least one of scene time information and the like. For example: scene attributes can be amusement parks, stations, schools, hospitals, shopping malls, industrial parks, office buildings, canteens, restaurants, etc.; scene time information refers to the time or season corresponding to the current scene, etc. If the scene attribute is canteen, the scene time The information can be the peak and off-peak hours of dining; if the scene attribute is shopping malls, amusement parks, the scene time information can be business hours or non-business hours, etc.; if the scene attribute is school, the scene time information can be holidays or semesters, or It can be during school hours or after school hours.
步骤S203、根据所述第一待检测图像中的场景信息,确定目标对象;Step S203, determining the target object according to the scene information in the first to-be-detected image;
这里,根据所述第一待检测图像中的场景属性,确定目标对象;也可以根据所述第一待检测图像中的场景属性和场景时间信息,确定目标对象。在实施过程中,可以根据场景属性设置目标对象的列表,通过识别出第一待检测图像中的场景信息,根据场景信息查询列表,得到目标对象。Here, the target object is determined according to the scene attribute in the first image to be detected; the target object may also be determined according to the scene attribute and scene time information in the first image to be detected. In the implementation process, a list of target objects may be set according to scene attributes, and the target objects are obtained by identifying the scene information in the first image to be detected, and querying the list according to the scene information.
场景信息可以包括场景属性和场景时间信息,例如场景信息为白天或晚上有人运动的操场,操场上可能有篮球、足球、羽毛球、乒乓球、衣服、饮料瓶、水杯、矿泉水瓶等物品,那么可以将所有的物品都作为目标对象,也可以将其中的一部分物品例如羽毛球、乒乓球、衣服、饮料瓶、矿泉水瓶作为目标对象,还可以确定打开未喝完的矿泉水瓶或饮料瓶为目标对象,而将饮料空瓶作为垃圾;如果是晚上没有人运动的操场,那么羽毛球、乒乓球、饮料瓶或矿泉水瓶(喝剩下的或空瓶或没打开的)都可以作为目标对象。The scene information can include scene attributes and scene time information. For example, the scene information is a playground where people are exercising during the day or night. There may be basketball, football, badminton, table tennis, clothes, beverage bottles, water glasses, mineral water bottles and other items on the playground. All items are used as the target object, and some of the items such as badminton, table tennis, clothes, beverage bottles, mineral water bottles can also be used as the target object, and the unfinished mineral water bottle or beverage bottle can also be determined as the target object. And treat empty beverage bottles as garbage; if it is a playground where no one is exercising at night, then badminton, table tennis, beverage bottles or mineral water bottles (drinking leftovers or empty bottles or unopened ones) can be used as targets.
场景信息可以仅包括场景属性,例如场景信息是餐厅,那么纸巾、报纸、使用过的一次性碗筷都可以作为目标对象。再如场景信息为高峰期的车站的情况下,可以确定地面上的物体,例如报纸、包装袋为目标对象;场景信息为食堂用餐环境的情况下,可以确定餐桌上的食物为目标对象。The scene information may only include scene attributes. For example, if the scene information is a restaurant, then paper towels, newspapers, and used disposable tableware can all be used as target objects. For another example, when the scene information is a station during peak hours, objects on the ground, such as newspapers and packaging bags, can be determined as the target objects; when the scene information is the dining environment of a canteen, the food on the table can be determined as the target object.
步骤S204、在确定所述第一待检测图像中存在所述目标对象的情况下,获取第二待检测图像,其中,所述第一待检测图像的采集区域与所述第二待检测图像的采集区域之间的重叠比例大于预设阈值,且所述第一待检测图像与所述第二待检测图像的采集时间相距预设的时间间隔;Step S204, in the case of determining that the target object exists in the first image to be detected, obtain a second image to be detected, wherein the acquisition area of the first image to be detected and the area of the second image to be detected are obtained. The overlap ratio between the acquisition areas is greater than a preset threshold, and the acquisition times of the first to-be-detected image and the second to-be-detected image are separated by a preset time interval;
在一些实施例中,该方法还包括:可以根据所述第一待检测图像的属性参数和/或所述目标对象的属性参数,确定所述时间间隔;其中,所述第一待检测图像的属性参数至少包括以下之一:所述第一待检测图像的场景信息、所述第一待检测图像的采集时间所属的时段或季节。In some embodiments, the method further includes: determining the time interval according to attribute parameters of the first image to be detected and/or attribute parameters of the target object; wherein the first image to be detected The attribute parameter includes at least one of the following: scene information of the first image to be detected, and a time period or season to which the acquisition time of the first image to be detected belongs.
在实施过程中,夜晚的操场的场景下对应的时间间隔可以设置的比白天的操场的场景下对应的时间间隔更长;在放寒暑假的校园场景下对应的时间间隔可以设置的比正在上课的校园对应的时间间隔更长;非用餐时间的食堂场景下对应的时间间隔可以设置的比用餐高峰期的食堂对应的时间间隔更长。During the implementation process, the corresponding time interval in the playground scene at night can be set to be longer than the corresponding time interval in the daytime playground scene; the corresponding time interval in the campus scene during winter and summer vacations can be set longer than that in class The corresponding time interval of the campus is longer; the corresponding time interval in the non-meal time canteen scene can be set to be longer than the time interval corresponding to the canteen in the dining peak period.
目标对象的属性参数可以是目标对象出现的时间或目标对象出现的位置。在实施过程中,在食堂场景下,食物碗筷等位于餐桌上的场景下,时间间隔可以设置的比位于地上对应的时间间隔更长。The attribute parameter of the target object can be the time when the target object appears or the location where the target object appears. In the implementation process, in the canteen scene, in the scene where the food tableware and chopsticks are located on the dining table, the time interval can be set to be longer than the corresponding time interval on the ground.
步骤S205、在确定所述第二待检测图像中存在所述目标对象的情况下,确定所述目标对象为垃圾。Step S205 , in the case where it is determined that the target object exists in the second image to be detected, determine that the target object is garbage.
在一些实施例中,例如场景信息为白天有人运动的操场,操场上可能有篮球、足球、羽毛球、乒乓球、衣服、饮料瓶、水杯、矿泉水瓶等物品,将矿泉水瓶或饮料瓶为目标对象。在确定第一待检测图像(如图2B)中存在矿泉水瓶21、矿泉水瓶22和矿泉水瓶23的情况下,如果确定第二待检 测图像(如图2C)中存在矿泉水瓶21和矿泉水瓶22与图2B中矿泉水瓶21和矿泉水瓶22放置的位置近似的2个矿泉水瓶,则可以确定分别在图2B和图2C中放置位置近似的矿泉水瓶21和矿泉水瓶22为垃圾。同样,可以确定图2B中新增的矿泉水瓶23可能是有人新放置在操场上的。In some embodiments, for example, the scene information is a playground where people are exercising during the day. There may be basketball, football, badminton, table tennis, clothes, beverage bottles, water glasses, mineral water bottles and other items on the playground, and the mineral water bottle or beverage bottle is the target object. . In the case where it is determined that there are mineral water bottles 21, 22 and 23 in the first image to be detected (as shown in FIG. 2B ), if it is determined that there are mineral water bottles 21 and 22 in the second image to be detected (as shown in FIG. 2C ) For two mineral water bottles placed in similar positions to the mineral water bottles 21 and 22 in FIG. 2B , it can be determined that the mineral water bottles 21 and 22 placed in similar positions in FIG. 2B and FIG. 2C respectively are garbage. Likewise, it can be determined that the newly added mineral water bottle 23 in FIG. 2B may be newly placed on the playground by someone.
本申请实施例中,根据第一待检测图像中的场景信息确定目标对象,可以实现对应不同的场景信息设置确定最疑似的垃圾,提升垃圾检测效率;根据第一待检测图像的属性参数和/或所述目标对象的属性参数,确定时间间隔,这样,确定的时间间隔能够进一步提升垃圾检测效率,以使得疑似垃圾尽快得到确认。In the embodiment of the present application, the target object is determined according to the scene information in the first image to be detected, so that the most suspected garbage can be determined according to different scene information settings, and the efficiency of garbage detection is improved; according to the attribute parameters of the first image to be detected and/or Or the attribute parameter of the target object, determine the time interval, in this way, the determined time interval can further improve the efficiency of garbage detection, so that the suspected garbage can be confirmed as soon as possible.
本申请实施例提供的一种垃圾检测方法,该方法包括:A method for detecting garbage provided by the embodiment of the present application, the method includes:
步骤S211、获取第一待检测图像;Step S211, acquiring a first image to be detected;
所述第一待检测图像是从在线视频流中获取的。在一些实施例中,可以利用摄像装置获取在线视频流,摄像装置安装在需要确定疑似垃圾的场所。The first image to be detected is obtained from an online video stream. In some embodiments, the online video stream can be obtained by using a camera device installed in a place where suspected garbage needs to be determined.
在一些实施例中,步骤S211包括:从在线视频流中提取或截取第一待检测图像。在另一实施例中,在步骤S211之前,该方法还包括:从在线视频流中截取待检测图像,将待检测图像存储至图像库或图像集合,对应地,步骤S211从图像库或图像集合中获取第一待检测图像。In some embodiments, step S211 includes: extracting or intercepting the first image to be detected from the online video stream. In another embodiment, before step S211, the method further includes: intercepting the image to be detected from the online video stream, and storing the image to be detected in an image library or image set, correspondingly, step S211 extracts the image from the image library or image set to obtain the first image to be detected.
步骤S212、利用目标垃圾检测模型对所述第一待检测图像进行检测,得到第一检测结果;Step S212, using a target garbage detection model to detect the first image to be detected to obtain a first detection result;
在一些实施例中,目标垃圾检测模型可以是训练好的特定目标检测模型,配置为检测在特定场景下的疑似垃圾。利用目标垃圾检测模型可以从在线视频流中经过判断,提取出可能包括有目标对象(疑似垃圾)的第一待检测图像,即,第一检测结果为第一待检测图像中包括目标对象或不包括目标对象。在一些实施例中,步骤S212包括:利用目标垃圾检测模型对从所述在线视频流中提取的第一待检测图像进行检测,得到第一检测结果。In some embodiments, the target garbage detection model may be a trained specific target detection model configured to detect suspected garbage in a specific scenario. Using the target garbage detection model, the online video stream can be judged to extract the first image to be detected that may include the target object (suspected garbage), that is, the first detection result is that the first image to be detected includes the target object or does not Include the target object. In some embodiments, step S212 includes: using a target garbage detection model to detect the first image to be detected extracted from the online video stream to obtain a first detection result.
步骤S213、在根据所述第一检测结果确定所述第一待检测图像中存在所述目标对象的情况下,从存储的视频库中获取第二待检测图像;Step S213, in the case of determining that the target object exists in the first image to be detected according to the first detection result, obtain a second image to be detected from a stored video library;
这里,所述第一待检测图像是从在线视频流中获取的,所述第二待检测图像的采集时间早于所述第一待检测图像的采集时间。Here, the first image to be detected is acquired from an online video stream, and the acquisition time of the second image to be detected is earlier than the acquisition time of the first image to be detected.
利用目标垃圾检测模型确定第一待检测图像中存在目标对象的情况下,需要从存储的视频库中获取第二检测对象。这里是因为在线视频流中检测到的是当前拍摄到的图像,如果当前图像中有疑似垃圾,那么就需要确定该疑似垃圾出现在同一拍摄位置中的时间。例如,在线视频流中检测到门口有一个塑料盆,那么就需要从存储的视频库中再获取第二待检测图像,以确定这个塑料盆放置在门口多长时间。When it is determined by using the target garbage detection model that there is a target object in the first image to be detected, the second detection object needs to be acquired from the stored video library. This is because the currently captured image is detected in the online video stream. If there is suspected garbage in the current image, it is necessary to determine the time when the suspected garbage appears in the same shooting location. For example, if a plastic basin is detected at the door in the online video stream, a second image to be detected needs to be obtained from the stored video library to determine how long the plastic basin has been placed at the door.
步骤S214、利用所述目标垃圾检测模型对从所述第二待检测图像进行检测,得到第二检测结果;Step S214, using the target garbage detection model to detect the second to-be-detected image to obtain a second detection result;
步骤S215、在根据所述第二检测结果确定所述第二待检测图像中存在所述目标对象的情况下,确定所述目标对象为垃圾。Step S215 , in the case that the target object exists in the second to-be-detected image according to the second detection result, determine that the target object is garbage.
这里,根据第二检测结果确定第二待检测图像中存在目标对象,目标对象在两个检测图像中可以是同一位置,也可以是满足距离要求的同一疑似对象,还可以不考虑位置限制,只要目标对象在两个检测图像中存在即可。在实施过程中,因为饮料瓶或易拉罐会存在被人踢了一小段距离,或者 纸袋、包装袋被风吹发生了位置变化的场景,所以只需要确定第二待检测图像中也存在与第一待检测图像中存在的目标即可。Here, according to the second detection result, it is determined that there is a target object in the second to-be-detected image, and the target object may be at the same position in the two detection images, or may be the same suspected object that meets the distance requirement, and the position restriction may not be considered, as long as It is sufficient that the target object exists in both detection images. In the implementation process, because the beverage bottle or can is kicked for a short distance, or the position of the paper bag or packaging bag is changed by the wind, it is only necessary to confirm that the second image to be detected also exists in the second image to be detected. The target existing in the image to be detected is sufficient.
本申请实施例中,首先从在线视频流中获取第一待检测图像,在确定第一待检测图像中存在目标对象的情况下,再从存储的视频库中获取第二待检测图像,在确定第二待检测图像中也存在目标对象的情况下,确定目标对象为垃圾。这样,利用数据挖掘方法针对真实场景中的在线视频流和存储的视频库数据进行挖掘,快速确定目标垃圾检测模型难以检测识别的困难样本,解决传统方法无法全面收集数据的问题。In the embodiment of the present application, the first image to be detected is obtained from the online video stream, and when it is determined that there is a target object in the first image to be detected, the second image to be detected is obtained from the stored video library, and the second image to be detected is obtained after determining When the target object also exists in the second image to be detected, it is determined that the target object is garbage. In this way, the data mining method is used to mine the online video stream and the stored video database data in the real scene, to quickly determine the difficult samples that are difficult to detect and identify by the target garbage detection model, and solve the problem that the traditional method cannot comprehensively collect data.
本申请实施例提供的一种垃圾检测方法,该方法包括:A method for detecting garbage provided by the embodiment of the present application, the method includes:
步骤S301、获取第一待检测图像;Step S301, acquiring a first image to be detected;
所述第一待检测图像是从在线视频流中获取的。The first image to be detected is obtained from an online video stream.
步骤S302、利用目标垃圾检测模型分析所述第一待检测图像中对象的属性信息;Step S302, using the target garbage detection model to analyze the attribute information of the object in the first to-be-detected image;
步骤S303、根据所述第一待检测图像中对象的属性信息确定对应对象属于目标对象还是属于垃圾,得到第一检测结果;Step S303, determining whether the corresponding object belongs to the target object or belongs to garbage according to the attribute information of the object in the first to-be-detected image, and obtains a first detection result;
所述对象的属性信息包括以下至少之一:所述对象的形态、材质、大小、所处的位置。The attribute information of the object includes at least one of the following: the shape, material, size, and location of the object.
在一些实施例中,可以根据第一待检测图像中对象的形态直接确定对应对象属于目标对象还是属于垃圾。例如,对象为塑料盆,如果塑料盆的形态显示塑料盆是一个已经变形的塑料盆,则可以确定对象为垃圾;对象为踩扁了的饮料瓶,可以确定对象为垃圾。在其他情况下,可将对象确定为目标对象。在一些实施例中,可以根据第一待检测图像中对象的材质确定对应对象属于目标对象还是属于垃圾。例如:对象的材质为变质或脏了的食物,可以确定对象为垃圾。在其他情况下,可将对象确定为目标对象。在一些实施例中,可以根据第一待检测图像中对象的大小确定对应对象属于目标对象还是属于垃圾。例如:对象为剩下一半的水果或者不完整的纸制品,都可以确定对象为垃圾。在其他情况下,可将对象确定为目标对象。在一些实施例中,可以根据第一待检测图像中对象的所处的位置确定对应对象属于目标对象还是属于垃圾。例如:目标对象为食材,食材放置在食堂的地面,可以确定对象为垃圾。在其他情况下,可将对象确定为目标对象。In some embodiments, whether the corresponding object belongs to the target object or the garbage can be directly determined according to the shape of the object in the first image to be detected. For example, if the object is a plastic basin, if the shape of the plastic basin shows that the plastic basin is a deformed plastic basin, the object can be determined to be garbage; the object is a crushed beverage bottle, and the object can be determined to be garbage. In other cases, the object may be determined as the target object. In some embodiments, whether the corresponding object belongs to the target object or the garbage can be determined according to the material of the object in the first image to be detected. For example, if the material of the object is spoiled or dirty food, it can be determined that the object is garbage. In other cases, the object may be determined as the target object. In some embodiments, whether the corresponding object belongs to the target object or the garbage can be determined according to the size of the object in the first image to be detected. For example, if the object is half leftover fruit or incomplete paper products, it can be determined that the object is garbage. In other cases, the object may be determined as the target object. In some embodiments, whether the corresponding object belongs to the target object or the garbage can be determined according to the position of the object in the first image to be detected. For example, if the target object is food, and the food is placed on the ground of the canteen, it can be determined that the object is garbage. In other cases, the object may be determined as the target object.
步骤S304、在根据所述第一检测结果确定所述第一待检测图像中存在所述目标对象的情况下,从存储的视频库中获取第二待检测图像;Step S304, in the case where it is determined according to the first detection result that the target object exists in the first image to be detected, obtain a second image to be detected from a stored video library;
所述第一待检测图像是从在线视频流中获取的,所述第二待检测图像的采集时间早于所述第一待检测图像的采集时间。The first image to be detected is acquired from an online video stream, and the acquisition time of the second image to be detected is earlier than the acquisition time of the first image to be detected.
步骤S305、利用所述目标垃圾检测模型分析所述第二待检测图像中对象的属性信息;Step S305, using the target garbage detection model to analyze the attribute information of the object in the second to-be-detected image;
步骤S306、根据所述第二待检测图像中对象的属性信息,确定对应对象属于所述目标对象还是属于垃圾,得到第二检测结果;Step S306, according to the attribute information of the object in the second to-be-detected image, determine whether the corresponding object belongs to the target object or belongs to garbage, and obtain a second detection result;
这里,第二待检测图像中对象的属性信息可以是与第一待检测图像中的属性信息相同的,即,第二待检测图像中对象的属性信息可以是所述对象的形态、材质、大小、所处的位置。利用目标垃圾检测模型分析从存储的视频库中获取第二待检测图像,第二待检测图像中也有存在垃圾的可能,如步骤S303确定垃圾的方法,根据第二待检测图像中对象的属性信息,确定对应对象属于目标对象 还是属于垃圾,得到第二检测结果。Here, the attribute information of the object in the second image to be detected may be the same as the attribute information of the first image to be detected, that is, the attribute information of the object in the second image to be detected may be the shape, material, size of the object , the location. The second to-be-detected image is obtained from the stored video library by analyzing the target garbage detection model. There is also the possibility of garbage in the second to-be-detected image. As shown in step S303, the method for determining garbage is based on the attribute information of the object in the second to-be-detected image. , determine whether the corresponding object belongs to the target object or belongs to garbage, and obtain the second detection result.
步骤S307、在根据所述第二检测结果确定所述第二待检测图像中存在所述目标对象的情况下,确定所述目标对象为垃圾。Step S307 , in the case that the target object exists in the second to-be-detected image according to the second detection result, determine that the target object is garbage.
在一些实施例中,第二检测结果表征述第二待检测图像中存在与第一待检测图像中相同的目标对象,即,在同一视角范围内,一段时间存在了相同的对象,可以确定该对象无人管理,即,为垃圾。In some embodiments, the second detection result indicates that the same target object exists in the second image to be detected as in the first image to be detected, that is, within the same viewing angle range, the same object exists for a period of time, it can be determined that the target object exists in the second image to be detected. Objects are unmanaged, ie, garbage.
本申请实施例中,因为垃圾具有一些特定形态、材质、大小和所处的位置,所以可以根据对象的属性信息直接确定目标对象是否为垃圾。这样,极大提升了确定垃圾的效率和准确性。In the embodiment of the present application, because the garbage has some specific shapes, materials, sizes, and locations, it can be directly determined whether the target object is garbage according to the attribute information of the object. In this way, the efficiency and accuracy of garbage determination are greatly improved.
本申请实施例提供的一种垃圾检测方法,该方法包括:A method for detecting garbage provided by the embodiment of the present application, the method includes:
步骤S311、获取第一待检测图像;Step S311, acquiring a first image to be detected;
所述第一待检测图像是从在线视频流中获取的。The first image to be detected is obtained from an online video stream.
步骤S312、利用目标垃圾检测模型分析所述第一待检测图像中对象的属性信息;根据所述第一待检测图像中对象的属性信息确定对应对象属于目标对象还是属于垃圾,得到第一检测结果;Step S312, using the target garbage detection model to analyze the attribute information of the object in the first image to be detected; determine whether the corresponding object belongs to the target object or garbage according to the attribute information of the object in the first image to be detected, and obtain a first detection result ;
所述对象的属性信息包括以下至少之一:所述对象的形态、材质、大小、所处的位置。The attribute information of the object includes at least one of the following: the shape, material, size, and location of the object.
步骤S313、在所述第一检测结果为所述对象属于垃圾的情况下,根据所述对象的属性信息确定所述垃圾所属的垃圾类别和所述垃圾所处的位置;Step S313, when the first detection result is that the object belongs to garbage, determine the garbage category to which the garbage belongs and the location of the garbage according to the attribute information of the object;
垃圾类别包括可回收物、其他垃圾、厨余垃圾和有害垃圾。其中,可回收物主要包括废纸、塑料、玻璃、金属和布料五大类;其他垃圾(干垃圾)包括除上述几类垃圾之外的砖瓦陶瓷、渣土、卫生间废纸、纸巾等难以回收的废弃物及尘土、食品袋(盒);厨余垃圾(湿垃圾)包括剩菜剩饭、骨头、菜根菜叶、果皮等食品类废物;有害垃圾指含有对人体健康有害的重金属、有毒的物质或者对环境造成现实危害或者潜在危害的废弃物。在一些实施例中,可以根据对象的形态确定对应对象属于的垃圾类别。例如:对象的形态为电池可以确定对象为有害垃圾。在一些实施例中,可以根据对象的材质确定对应对象属于的垃圾类别。例如:对象的材质为变质的食物、剩菜剩饭、骨头、菜根菜叶或果皮,可以确定对象为厨余垃圾。在一些实施例中,可以根据对象的大小和材质确定对应对象属于的垃圾类别。例如:对象为不完整的纸制品,可以确定对象为可回收垃圾。根据对象所处的位置可以确定垃圾所处的位置。Waste categories include recyclables, other waste, kitchen waste and hazardous waste. Among them, recyclables mainly include five categories of waste paper, plastic, glass, metal and cloth; other garbage (dry garbage) includes bricks, ceramics, muck, toilet waste paper, paper towels, etc. waste and dust, food bags (boxes); kitchen waste (wet waste) includes food waste such as leftovers, bones, vegetable roots and leaves, peels; hazardous waste refers to heavy metals that are harmful to human health, toxic Substances or wastes that cause actual or potential harm to the environment. In some embodiments, the garbage category to which the corresponding object belongs may be determined according to the form of the object. For example, if the object is in the form of a battery, it can be determined that the object is hazardous waste. In some embodiments, the garbage category to which the corresponding object belongs may be determined according to the material of the object. For example, if the material of the object is spoiled food, leftovers, bones, vegetable roots or peels, it can be determined that the object is kitchen waste. In some embodiments, the garbage category to which the corresponding object belongs may be determined according to the size and material of the object. For example, if the object is an incomplete paper product, it can be determined that the object is recyclable garbage. The location of the garbage can be determined based on the location of the object.
步骤S314、根据所述垃圾类别和所述垃圾所处的位置,确定垃圾告警对应的内容;Step S314: Determine the content corresponding to the garbage alarm according to the garbage category and the location of the garbage;
在一些实施例中,垃圾告警的内容可以包括垃圾的类别和垃圾所处的位置。例如,告警内容可以为在食堂地面发现厨余垃圾,或在学校操场发现可回收垃圾。这样,用户可以根据垃圾的类别和垃圾所处的位置确定处理垃圾的紧急程度。In some embodiments, the content of the spam alert may include the category of the spam and the location of the spam. For example, the content of the alert can be the discovery of kitchen waste on the canteen floor, or the discovery of recyclable waste on the school playground. In this way, the user can determine the urgency to dispose of the garbage according to the type of garbage and the location of the garbage.
步骤S315、将所述垃圾告警对应的内容发送给垃圾管理平台;Step S315, sending the content corresponding to the garbage alarm to the garbage management platform;
垃圾管理平台连接了管理垃圾的终端和拍摄垃圾的摄像装置,配置为接收摄像装置的处理系统发送的垃圾告警,并将告警发送给管理垃圾的终端,这里,管理垃圾的终端可以是保洁员使用的终端设备,也可以是清洁机器人。The garbage management platform is connected with the terminal for managing garbage and the camera device for photographing garbage, and is configured to receive garbage alarms sent by the processing system of the camera device, and send the alarm to the terminal for garbage management. Here, the terminal for garbage management can be used by cleaners The terminal equipment can also be a cleaning robot.
步骤S316、在确定所述第一待检测图像中存在目标对象的情况下,获取第二待检测图像,其中, 所述第一待检测图像的采集区域与所述第二待检测图像的采集区域之间的重叠比例大于预设阈值,且所述第一待检测图像与所述第二待检测图像的采集时间相距预设的时间间隔;Step S316: In the case where it is determined that there is a target object in the first image to be detected, acquire a second image to be detected, wherein the collection area of the first image to be detected and the collection area of the second image to be detected The overlap ratio between them is greater than a preset threshold, and the acquisition times of the first to-be-detected image and the second to-be-detected image are separated by a preset time interval;
步骤S317、在确定所述第二待检测图像中存在所述目标对象的情况下,确定所述目标对象为垃圾。Step S317 , in the case that it is determined that the target object exists in the second image to be detected, determine that the target object is garbage.
本申请实施例,首先根据对象的属性信息确定垃圾所属的垃圾类别和垃圾所处的位置;然后,根据垃圾类别和垃圾所处的位置,确定垃圾告警对应的内容;最后,将垃圾告警对应的内容发送给垃圾管理平台。这样,在确定有垃圾的情况下,可以及时将垃圾信息(垃圾类别、所处位置)发送给垃圾管理平台,以实现及时根据垃圾类别和所处位置对垃圾进行合理的处理。In this embodiment of the present application, firstly determine the garbage category to which the garbage belongs and the location of the garbage according to the attribute information of the object; then, determine the content corresponding to the garbage alarm according to the garbage category and the location of the garbage; finally, determine the content corresponding to the garbage alarm; Content sent to spam management platforms. In this way, when it is determined that there is garbage, the garbage information (garbage category, location) can be sent to the garbage management platform in time, so as to realize timely and reasonable disposal of garbage according to the garbage category and location.
图3为本申请实施例提供的又一种垃圾检测方法,如图3所示,该方法包括:Fig. 3 is another garbage detection method provided by the embodiment of the present application. As shown in Fig. 3, the method includes:
步骤S321、获取第一待检测图像;Step S321, acquiring a first image to be detected;
步骤S322、对所述第一待检测图像进行检测,确定所述第一待检测图像对应的目标对象和目标框;根据所述第一待检测图像对应的目标对象和所述目标框,确定第一交并比;Step S322: Detect the first image to be detected, and determine the target object and the target frame corresponding to the first image to be detected; determine the first target object and the target frame corresponding to the first image to be detected. A cross-comparison;
在一些实施例中,步骤S322可以通过目标垃圾检测模型来实现,目标垃圾检测模型可以实现在图像中识别出物体,也可以实现标出物体的位置。利用目标垃圾检测模型可以确定第一待检测图像对应的目标对象和目标框。这里,目标对象即识别出的物体,目标框即标出的物体位置。交并比(Intersection-over-Union,IoU)是目标检测中使用的一个概念,计算的是预测边框和真实边框的交集和并集的比值,即它们的交集与并集的比值。最理想情况是完全重叠,即比值为1。这里,真实边框可以是每次大检测图像输入目标垃圾检测模型,经过检测后确定的目标框,而预测边框可以是第一待检测图像出入目标垃圾检测模型,经过检测后确定的目标框,也就是说根据垃圾在第一待检测图像中出现的位置标注出的预测边框。In some embodiments, step S322 can be implemented by a target garbage detection model, and the target garbage detection model can realize the identification of objects in the image, and can also realize the marking of the positions of the objects. The target object and target frame corresponding to the first image to be detected can be determined by using the target garbage detection model. Here, the target object is the recognized object, and the target frame is the marked position of the object. Intersection-over-Union (IoU) is a concept used in object detection, which calculates the ratio of the intersection and union of the predicted frame and the real frame, that is, the ratio of their intersection and union. The ideal situation is complete overlap, i.e. a ratio of 1. Here, the real frame can be the target frame determined after each large detection image is input to the target garbage detection model, and the predicted frame can be the target frame determined after the first image to be detected enters and exits the target garbage detection model. That is to say, the predicted frame marked according to the position where the garbage appears in the first image to be detected.
步骤S323、在确定所述第一待检测图像中存在所述目标对象的情况下,从存储的视频库中获取第二待检测图像;Step S323, when it is determined that the target object exists in the first image to be detected, obtain a second image to be detected from a stored video library;
所述第一待检测图像是从在线视频流中获取的,所述第二待检测图像的采集时间早于所述第一待检测图像的采集时间。The first image to be detected is acquired from an online video stream, and the acquisition time of the second image to be detected is earlier than the acquisition time of the first image to be detected.
步骤S324、利用所述目标垃圾检测模型分析所述第二待检测图像中对象的属性信息;根据所述第二待检测图像中对象的属性信息,确定对应对象属于所述目标对象还是属于垃圾,得到第二检测结果;Step S324, using the target garbage detection model to analyze the attribute information of the object in the second image to be detected; according to the attribute information of the object in the second image to be detected, determine whether the corresponding object belongs to the target object or belongs to garbage, obtain the second test result;
步骤S325、在确定所述第二待检测图像对应的目标对象的情况下,根据所述目标框和所述第二待检测图像对应的目标对象确定第二交并比;在所述第一交并比与所述第二交并比同时大于预设交并比阈值的情况下,确定所述目标对象为垃圾;在一些实施例中,因为第二交并比计算时使用的预测边框可以是第一待检测图像对象的目标框,所以第二交并比为第二待检测图像的目标框与第一待检测图像的目标框的交集和并集的比值。在第一交并比与第二交并比同时大于预设交并比阈值的情况下,即,目标对象在第一待检测图像中的位置与目标对象在第二待检测图像中的位置距离满足阈值要求的情况下,确定所述目标对象为垃圾。Step S325, in the case of determining the target object corresponding to the second image to be detected, determine a second intersection ratio according to the target frame and the target object corresponding to the second image to be detected; When the union ratio and the second intersection ratio are greater than the preset intersection ratio threshold at the same time, the target object is determined to be garbage; in some embodiments, because the predicted frame used in the calculation of the second intersection ratio can be The target frame of the first image object to be detected, so the second intersection ratio is the ratio of the intersection and union of the target frame of the second image to be detected and the target frame of the first image to be detected. In the case where the first intersection ratio and the second intersection ratio are greater than the preset intersection ratio threshold, that is, the distance between the position of the target object in the first image to be detected and the position of the target object in the second image to be detected When the threshold requirement is met, it is determined that the target object is garbage.
步骤S326、在确定所述目标对象为垃圾的情况下,根据所述第一待检测图像和/或所述第二待检 测图像确定所述垃圾所处的位置;Step S326, when it is determined that the target object is garbage, determine the location of the garbage according to the first image to be detected and/or the second image to be detected;
这里,因为拍摄目标对象的摄像装置的位置为固定的,可以将摄像装置的位置作为垃圾所处的位置。Here, since the position of the camera that captures the target object is fixed, the position of the camera can be used as the position where the garbage is located.
步骤S327、根据所述垃圾所处的位置确定对应的终端或清洁机器人;Step S327, determining the corresponding terminal or cleaning robot according to the location of the garbage;
这里,因为区域的垃圾清理可以对应管理该区域的终端或机器人,在实施过程中,可以将垃圾所处的位置和该位置对象的终端或清洁机器人建立映射关系,根据该映射关系和垃圾所处的位置确定对应的终端或清洁机器人。Here, because the garbage cleaning in an area can correspond to the terminal or robot that manages the area, during the implementation process, a mapping relationship can be established between the location of the garbage and the terminal or cleaning robot of the location object, according to the mapping relationship and the location of the garbage. The position of the corresponding terminal or cleaning robot is determined.
步骤S328、将所述垃圾告警发送给所述终端或所述机器人,以使得持有所述终端的保洁员清理所述垃圾或者所述清洁机器人处理所述垃圾。Step S328: Send the garbage alarm to the terminal or the robot, so that the cleaner holding the terminal cleans the garbage or the cleaning robot processes the garbage.
本申请实施例中,采用评估不同时间帧上目标框的交并比是否连续超过某一个阈值的方法,来确定是否检测出来的垃圾在画面中一段时间内长时出现。这样,可以有效排除形态与垃圾相似,但是不属于垃圾种类的日常物品,提升本申请实施例在真实场景中的性能。In the embodiment of the present application, a method of evaluating whether the intersection ratio of target frames on different time frames continuously exceeds a certain threshold is used to determine whether the detected garbage appears in the picture for a long time. In this way, everyday objects that are similar in shape to garbage but do not belong to the type of garbage can be effectively excluded, thereby improving the performance of the embodiment of the present application in a real scene.
本申请实施例中,首先,根据所述垃圾所处的位置确定对应的终端或清洁机器人,然后将所述垃圾告警发送给终端或机器人,可以使得持有所述终端的保洁员及时清理垃圾或者清洁机器人及时处理垃圾。In the embodiment of the present application, first, the corresponding terminal or cleaning robot is determined according to the location of the garbage, and then the garbage alarm is sent to the terminal or robot, so that the cleaner who holds the terminal can clean up the garbage in time or Cleaning robots dispose of garbage in a timely manner.
支撑视频流解析的垃圾检测在垃圾管理中有非常重要的作用,可以支持垃圾管理者高效检测识别未处理垃圾,使得垃圾可以快速被响应清除;在美化市容市貌,排除卫生和安全隐患,提高市民生活水平上有着重要的作用。因此,垃圾检测是一类重要问题。Garbage detection that supports video stream analysis plays a very important role in garbage management. It can support garbage managers to efficiently detect and identify untreated garbage, so that garbage can be quickly removed. It plays an important role in the living standard of citizens. Therefore, garbage detection is an important class of problems.
垃圾检测的难点包括两方面:The difficulties of garbage detection include two aspects:
一方面,垃圾本身形态非常多样,定义相对模糊并且持续变化。垃圾的形态多样,种类非常繁多(易拉罐,废弃塑料袋,废弃纸箱…),并且不同种类的垃圾大小不一,形状不一,颜色不一,距离摄像装置的距离不一。这导致垃圾检测任务中目标对象的大小形态的多样性非常巨大,并且难以被完全收集。On the one hand, the forms of garbage itself are very diverse, and the definitions are relatively vague and constantly changing. Garbage comes in a variety of shapes and types (cans, waste plastic bags, waste cartons...), and different types of waste come in different sizes, shapes, colors, and distances from the camera. This results in a huge diversity of size and morphology of target objects in garbage detection tasks, and it is difficult to collect them completely.
另一方面,垃圾的定义模糊并且持续变化。垃圾的种类可能随着政策,经济建设与市民文化的发展儿而变化(例如新种类的饮料可能产生新种类的塑料瓶垃圾)。同时垃圾的定义是模糊的,取决于与周边环境的关系(例如放在路边的塑料小盆可能是被遗弃的垃圾,也可能是暂时放置的他人物品),而这种与环境的关系往往随着地点改变而大幅变化。这种定义模糊的另一种体现方式为一个物品在一段时间内的位置与形态变化,而垃圾往往不会(例如一个拿在手中的塑料袋会随着时间推移而改变位置与形状,放置在地上的废弃塑料袋往往会在一段时间中位置固定),这种体现方式导致识别某些垃圾往往需要关注一段时间的视频变化,而只进行单帧图像的垃圾检测则可能产生误报。On the other hand, the definition of garbage is vague and constantly changing. The types of waste may change with the development of policies, economic construction and civic culture (for example, new types of beverages may generate new types of plastic bottle waste). At the same time, the definition of garbage is ambiguous and depends on the relationship with the surrounding environment (for example, the small plastic basin placed on the roadside may be abandoned garbage, or it may be temporarily placed by others), and this relationship with the environment is often Varies drastically with location. Another manifestation of this vague definition is the change of position and shape of an item over a period of time, while garbage often does not (for example, a plastic bag in hand will change position and shape over time, placed in The discarded plastic bags on the ground tend to be fixed for a period of time), which leads to the identification of certain garbage that often requires attention to video changes over a period of time, and garbage detection that only performs single-frame images may produce false positives.
这两方面的难点导致垃圾检测需要识别的目标形态种类是广大的,并且是变化的。这使得传统的基于深度学习的单帧垃圾检测方法,即收集大量数据并训练深度学习网络进行单帧图像检测的方法,不可行。因为收集的数据往往无法包含在真实场景中所能遇到的真实数据,同时基于单帧图像的垃圾检测无视物体在一段时间内的变化从而将正常物品识别为垃圾。因此传统深度学习方法得到的目标检测模型在真实环境中往往出现性能较低的问题。The difficulties in these two aspects lead to the wide variety of target morphologies that need to be identified for garbage detection. This makes traditional deep learning-based single-frame garbage detection methods, that is, methods that collect large amounts of data and train deep learning networks for single-frame image detection, infeasible. Because the collected data often cannot contain the real data that can be encountered in real scenes, and garbage detection based on a single frame image ignores the changes of objects over a period of time and recognizes normal items as garbage. Therefore, the target detection model obtained by the traditional deep learning method often has the problem of low performance in the real environment.
图4A为本申请实施例提供的一种目标检测模型的架构示意图,如图4A所示,本申请实施例中的目标检测模型可以为RetinaNet网络模型,RetinaNet网络模型可以包括一个骨干网(深度残差网络41和特征金字塔网络42)和N个包括分类子网和回归子网的网络43,其中,分类子网和回归子网可以简称为分类和回归子网,N可以如图4A所示取3,也可以根据实际需要取值。骨干网用于计算和输出整个输入图像的卷积特征图。分类子网对骨干网的输出进行分类,回归子网用于对骨干网的输出执行卷积边框回归任务。FIG. 4A is a schematic diagram of the architecture of a target detection model provided by an embodiment of the present application. As shown in FIG. 4A , the target detection model in the embodiment of the present application may be a RetinaNet network model, and the RetinaNet network model may include a backbone network (deep residual Difference network 41 and feature pyramid network 42) and N networks 43 including classification subnetworks and regression subnetworks, wherein the classification subnetworks and regression subnetworks can be referred to as classification and regression subnetworks for short, and N can be taken as shown in Figure 4A. 3. The value can also be set according to actual needs. The backbone network is used to compute and output the convolutional feature maps of the entire input image. The classification subnet classifies the output of the backbone network, and the regression subnet is used to perform the convolutional bounding box regression task on the output of the backbone network.
特征金字塔网络(Feature Pyramid Net,FPN)42作为骨干网,建立在标准的深度残差网络(ResNet)41之上。FPN通过自顶向下和横向连接扩展ResNet,生成丰富的多尺度卷积特征金字塔。ResNet的思想在于引入深度残差来解决梯度消失问题,即令卷积网络去学习残差映射。ResNet可以有2个最基本块(block),其中一个基本块是标识块(Identity Block),其输入和输出的维度保持相同,因此可以对该结构多次串联;另外一个基本块为卷积块(Conv Block),其输入和输出的维度是不相同的,因此不能进行连续串联,卷积块的目的是为了改变输出特征向量的维度。The Feature Pyramid Net (FPN) 42 is used as the backbone network, built on the standard deep Residual Network (ResNet) 41. FPN extends ResNet through top-down and lateral connections to generate rich multi-scale convolutional feature pyramids. The idea of ResNet is to introduce deep residual to solve the problem of gradient disappearance, that is, let the convolutional network learn the residual mapping. ResNet can have 2 most basic blocks, one of which is an identity block, whose input and output dimensions remain the same, so the structure can be concatenated multiple times; the other basic block is a convolution block (Conv Block), the dimensions of its input and output are not the same, so continuous concatenation cannot be performed. The purpose of the convolution block is to change the dimension of the output feature vector.
自下而上的路径(例如ResNet)可以用于特征提取,无论输入图像的大小如何,该路径会以不同的比例来计算特征图。自上而下的路径可以从较高的金字塔等级对空间上较粗糙的特征图进行上采样,并且横向连接将具有相同空间大小的自上而下的层和自下而上的层合并在一起。A bottom-up path such as ResNet can be used for feature extraction, which computes feature maps at different scales regardless of the size of the input image. Top-down paths can upsample spatially coarser feature maps from higher pyramid levels, and lateral connections merge top-down and bottom-up layers with the same spatial size .
分类子网是附加到FPN的每个层的小型全卷积网络。回归子网可以与分类子网络并行处理,其网络结构与分类子网几乎相同,但不共享参数。The classification subnet is a small fully convolutional network attached to each layer of the FPN. The regression subnet can be processed in parallel with the classification subnet, and its network structure is almost the same as the classification subnet, but does not share parameters.
回归子网能够获取图像中不同的检测框,分类子网能够获取不同的检测框中的物体类别,在分类子网确定某一检测框中的物体类别为目标对象的情况下,可以将该检测框作为该图像中目标对象的边界框。The regression subnet can obtain different detection frames in the image, and the classification subnet can obtain the object categories in different detection frames. When the classification subnet determines that the object category in a detection frame is the target object, the detection box as the bounding box of the target object in this image.
图4B本申请实施例提供的一种垃圾检测方法的流程示意图,如图4B所示,该方法包括:FIG. 4B is a schematic flowchart of a garbage detection method provided by an embodiment of the present application. As shown in FIG. 4B , the method includes:
步骤S401、对视频流进行截帧,得到至少一张图像;Step S401, cutting the video stream to obtain at least one image;
需要管理场景下的小部分垃圾检测冷启动数据,通常通过手动在视频流中截图并标注来采集得到,数据量级在千张即可,其中,该视频流可以利用摄像装置获取。在对视频流进行截帧的实施过程中,视频流通常包含几百至几千路摄像装置点位的实时视频,需要对其进行截帧操作,即每隔T时间从视频流中抽取一个视频帧。通常T设置为10分钟,也可按照实际需求设置。利用这种截帧操作可以从视频流得到至少一张图像数据供后续挖掘。A small part of garbage detection cold-start data in the management scenario is usually collected by manually taking screenshots and marking in the video stream. The data size is only one thousand pieces, and the video stream can be obtained by using a camera device. In the implementation process of framing the video stream, the video stream usually contains hundreds to thousands of real-time videos of camera points, and it is necessary to perform the framing operation, that is, extract a video from the video stream every T time frame. Usually T is set to 10 minutes, and it can also be set according to actual needs. Using this frame clipping operation, at least one piece of image data can be obtained from the video stream for subsequent mining.
步骤S402、将图像输入目标检测模型,得到图像的后验概率;Step S402, inputting the image into the target detection model to obtain the posterior probability of the image;
在一些实施例中,目标检测模型可以是如图4A所示的目标检测网络,所述目标检测模型可以为RetinaNet网络模型,RetinaNet网络模型可以包括一个骨干网和N个包括分类子网和回归子网的网络。将图像输入目标检测模型,可以得到图像的后验概率。这里,后验概率指的是,目标检测模型每输出一个感兴趣区域框,也会输出一个概率值,代表这个感兴趣区域框中是目标样本的概率。In some embodiments, the target detection model may be a target detection network as shown in FIG. 4A , the target detection model may be a RetinaNet network model, and the RetinaNet network model may include a backbone network and N sub-networks including classification and regression network of networks. Input the image into the target detection model, and the posterior probability of the image can be obtained. Here, the posterior probability means that each time the target detection model outputs a region of interest box, it also outputs a probability value, which represents the probability that the region of interest box is a target sample.
步骤S403、根据图像的后验概率确定挖掘数据;Step S403, determining the mining data according to the posterior probability of the image;
在挖掘数据的情况下,在获得的大量图像上运行垃圾监测模型并得到模型判断的后验概率,在后验概率大于阈值t 1并小于阈值t 2的情况下,此图像数据被认定为需要挖掘标注的数据。例如,在 实际使用的情况下,可以设置阈值t 1为20%,t 2为80%,那么,当后验概率大于20%并小于80%的情况下,此图像数据被认定为需要挖掘标注的数据。 In the case of mining data, the garbage monitoring model is run on a large number of images obtained and the posterior probability of model judgment is obtained. When the posterior probability is greater than the threshold t 1 and less than the threshold t 2 , the image data is deemed to be required. Mining labeled data. For example, in the case of actual use, the threshold t 1 can be set to 20%, and t 2 can be set to 80%, then, when the posterior probability is greater than 20% and less than 80%, the image data is identified as requiring mining annotations The data.
步骤S404、将挖掘数据合并到冷启动数据集;Step S404, merging the mining data into the cold start data set;
对所有的需要挖掘标注的数据进行人工标注,并且合并到冷启动数据集中。此过程会采集较多真实场景正样例图像,也可能产生较多负样例误报,负样例误报加入模型训练有助于优化模型在真实场景下对误报的抑制,正样例有助于模型快速适应目前场景的垃圾形态与种类。All data that needs to be mined and labeled are manually labeled and merged into the cold-start dataset. This process will collect more positive sample images of real scenes, and may also generate more negative sample false positives. Adding negative sample false positives to model training can help optimize the model’s suppression of false positives in real scenarios. Positive samples It helps the model to quickly adapt to the garbage shape and type of the current scene.
步骤S405、利用冷启动数据集训练目标检测模型。Step S405, using the cold start data set to train the target detection model.
每隔一段时间,累积了足够的挖掘合并图像后,如图4A所示,将冷启动数据集输入目标检测模型来进行目标检测模型训练,经过训练的目标检测模型会更加适应目前真实场景中的垃圾种类与形态,并快速提高性能。Every once in a while, after accumulating enough mining and merged images, as shown in Figure 4A, input the cold start data set into the target detection model to train the target detection model. The trained target detection model will be more suitable for the current real scene. Garbage types and shapes, and quickly improve performance.
本申请实施例中,利用数据挖掘方法针对真实场景中的在线视频流进行挖掘,快速得到现阶段模型难以检测识别的困难样本,通过挖掘出的数据评估模型现阶段在真实环境中的能力边界,解决传统方法无法全面收集数据的问题。引入人工标注对于上一步得到的困难样本进行标注并加入训练集进行重新训练,从而通过人类的先验知识来纠正模型的错误,扩展模型的能力边界,使得模型适应现阶段真实环境中垃圾形态,解决传统方法模型在真实场景中性能较低的问题。利用数据挖掘方法,可在巨量视频流中挖掘对于模型提升有帮助的潜在高价值样本,可在有限的标注与计算资源环境下有效提升模型性能,大量节省深度学习模型应用新的业务上所需的人力以及计算成本。用户可以使用本框架在有限的人工以及计算资源下,在线上对于垃圾管理系统中潜在的垃圾检测应用进行快速迭代提升,用较小的人力和计算成本快速达到业务所需的性能要求,并能在之后继续持续提升模型性能。解决了现有技术主要通过大量人力来对未标注数据进行标注,比较耗费人力以及计算资源的问题。In the embodiment of the present application, the data mining method is used to mine the online video stream in the real scene, and the difficult samples that are difficult to be detected and identified by the current model are quickly obtained. Solve the problem that traditional methods cannot comprehensively collect data. Introduce manual annotation to label the difficult samples obtained in the previous step and add them to the training set for retraining, so as to correct the errors of the model through human prior knowledge, expand the capability boundary of the model, and make the model adapt to the garbage form in the real environment at this stage. Solve the problem of low performance of traditional method models in real scenes. Using data mining methods, potential high-value samples that are helpful for model improvement can be mined in huge video streams, which can effectively improve model performance in the environment of limited annotation and computing resources, and save a lot of new business costs for deep learning models. manpower and computational cost. Users can use this framework to quickly and iteratively improve the potential garbage detection applications in the garbage management system online under limited labor and computing resources, and quickly meet the performance requirements required by the business with less labor and computing costs. Continue to improve the model performance after that. It solves the problem that the prior art mainly uses a lot of manpower to mark the unlabeled data, which consumes manpower and computing resources.
本申请实施例提供一种垃圾检测方法,由垃圾检测系统完成,垃圾检测系统包括采集模块、检测模块和告警模块。图4C为本申请实施例提供的一种垃圾检测方法的流程示意图,如图4C示,工作流程描述如下:The embodiment of the present application provides a method for detecting garbage, which is completed by a garbage detection system, and the garbage detection system includes a collection module, a detection module, and an alarm module. FIG. 4C is a schematic flowchart of a garbage detection method provided by an embodiment of the present application. As shown in FIG. 4C , the workflow is described as follows:
步骤S410、采集模块获取同一摄像装置的至少一帧图像;Step S410, the acquisition module acquires at least one frame of image of the same camera;
同一摄像装置获取到的图像可以是拍摄的同一角度范围内的图像,也可以使用可以拍摄同一范围图像的两个摄像装置。这里,主要是获取同一角度范围内的图像,对摄像装置不做限制。The images acquired by the same camera device may be images captured within the same angle range, or two camera devices that can capture images in the same range may be used. Here, images within the same angle range are mainly acquired, and the imaging device is not limited.
步骤S411、检测模块对输入图像运行垃圾检测;Step S411, the detection module performs garbage detection on the input image;
将所述同一摄像装置的至少一帧图像输入目标检测模型,确定每一图像中是否存在疑似垃圾。Inputting at least one frame of images of the same camera device into a target detection model to determine whether there is suspected garbage in each image.
在一些实施例中,可以使用如图4A所示的目标检测模型,确定每一图像中是否存在疑似垃圾。In some embodiments, the object detection model shown in FIG. 4A may be used to determine whether there is suspected garbage in each image.
步骤S412、检测模块确定是否检测到疑似垃圾;Step S412, the detection module determines whether suspected garbage is detected;
这里,如果使用步骤S412的方法检测到疑似垃圾,则流转到步骤S413,如果没有检测到疑似垃圾则返回步骤S411再次进行疑似垃圾检测。Here, if suspected garbage is detected using the method of step S412, the flow goes to step S413, and if no suspected garbage is detected, the process returns to step S411 to perform suspected garbage detection again.
步骤S413、检测模块确定是否在过去连续S帧中同一位置检测到垃圾;Step S413, the detection module determines whether garbage is detected at the same position in the past continuous S frames;
首先,需要获取S帧图像,其中,所述S帧图像的采集时间需要早于检测到垃圾的图像的采集 时间;然后,可以利用不同时间帧上目标框的交并比是否连续超过某一个阈值的方法,来判断是否检测出来的垃圾在画面中一段时间内长时出现,即,确定是否在过去连续S帧中同一位置检测到垃圾。这样,如果垃圾检测结果和目标框的交并比小于阈值,则认为新的目标加入了图像;如果交并比大于阈值,则认为在相同的预测边框连续出现了相同的目标(垃圾)。First, it is necessary to acquire S frames of images, wherein the collection time of the S frames of images needs to be earlier than the collection time of the images in which garbage is detected; then, it can be used whether the intersection ratio of the target frame on different time frames continuously exceeds a certain threshold. method to determine whether the detected garbage appears in the picture for a long period of time, that is, to determine whether garbage was detected at the same position in the past S consecutive S frames. In this way, if the intersection ratio between the garbage detection result and the target frame is less than the threshold, it is considered that a new target has been added to the image; if the intersection ratio is greater than the threshold, it is considered that the same target (garbage) appears continuously in the same predicted frame.
这里,如果使用步骤S413的方法检测到疑似垃圾,则确定为垃圾,流转到步骤S414,如果没有检测到垃圾则返回步骤S411再次进行疑似垃圾检测。Here, if suspected garbage is detected using the method of step S413, it is determined to be garbage, and the flow goes to step S414, and if no garbage is detected, it returns to step S411 to perform suspected garbage detection again.
步骤S414、告警模块对外报警。Step S414, the alarming module sends an external alarm.
在确定所述S帧图像中每一图像的相同位置均存在垃圾的情况下,输出警告。In a case where it is determined that garbage exists in the same position of each of the S-frame images, a warning is output.
本申请实施例中,利用多帧逻辑,来有效排除形态与垃圾相似,但是不属于垃圾种类的日常物品,提升目标垃圾检测模型在真实场景中的性能,解决了现有技术仅利用单帧图像检测的局限性问题,以及针对与垃圾形态类似易混淆的日常物品一般无法有效排除的问题。同时在真实场景检测中加入多帧垃圾确认逻辑,来排除容易混淆的物品,进一步提升垃圾检测框架的性能。从用户的角度来看,用户可以使用本垃圾检测方法,在有限的人工以及计算资源下,在线上对于智能视频分析或者智能管理中潜在的目标检测应用进行快速迭代提升,用较小的人力和计算成本快速达到业务所需的性能要求,并能在之后继续持续提升模型性能。In the embodiment of the present application, multi-frame logic is used to effectively exclude everyday objects that are similar in shape to garbage but not belonging to the type of garbage, improve the performance of the target garbage detection model in real scenes, and solve the problem that the existing technology only uses single-frame images The limitations of detection, and the problems that cannot be effectively excluded for everyday objects that are similar to the form of garbage and are easily confused. At the same time, multi-frame garbage confirmation logic is added to the real scene detection to exclude easily confused items and further improve the performance of the garbage detection framework. From the user's point of view, the user can use this garbage detection method to quickly and iteratively improve the potential target detection applications in intelligent video analysis or intelligent management online under limited labor and computing resources. The computing cost quickly reaches the performance requirements required by the business, and can continue to improve the model performance after that.
基于前述的实施例,本申请实施例提供一种垃圾检测装置,该装置包括所包括的各模块,可以通过电子设备中的处理器来实现;当然也可通过逻辑电路实现。Based on the foregoing embodiments, the embodiments of the present application provide a garbage detection device, the device includes each of the modules included, and can be implemented by a processor in an electronic device; of course, it can also be implemented by a logic circuit.
图5为本申请实施例提供的一种垃圾检测装置的组成结构示意图,如图5所示,垃圾检测装置500包括:FIG. 5 is a schematic structural diagram of a garbage detection device provided by an embodiment of the present application. As shown in FIG. 5 , the garbage detection device 500 includes:
第一获取模块501,配置为获取第一待检测图像;a first acquisition module 501, configured to acquire a first image to be detected;
第二获取模块502,配置为在确定所述第一待检测图像中存在目标对象的情况下,获取第二待检测图像,其中,所述第一待检测图像的采集区域与所述第二待检测图像的采集区域之间的重叠比例大于预设阈值,且所述第一待检测图像与所述第二待检测图像的采集时间相距预设的时间间隔;The second acquisition module 502 is configured to acquire a second to-be-detected image when it is determined that a target object exists in the first to-be-detected image, wherein the acquisition area of the first to-be-detected image is the same as the second to-be-detected image. The overlap ratio between the acquisition areas of the detection images is greater than a preset threshold, and the acquisition times of the first to-be-detected image and the second to-be-detected image are separated by a preset time interval;
第一确定模块503,配置为在确定所述第二待检测图像中存在所述目标对象的情况下,确定所述目标对象为垃圾。The first determining module 503 is configured to determine that the target object is garbage when it is determined that the target object exists in the second to-be-detected image.
在一些实施例中,所述装置还包括分析模块和第二确定模块,其中,所述分析模块配置为分析所述第一待检测图像中的场景信息;所述第二确定模块,配置为根据所述第一待检测图像中的场景信息,确定所述目标对象。In some embodiments, the apparatus further includes an analysis module and a second determination module, wherein the analysis module is configured to analyze the scene information in the first image to be detected; the second determination module is configured to The scene information in the first image to be detected determines the target object.
在一些实施例中,所述装置还包括第三确定模块,配置为根据所述第一待检测图像的属性参数和/或所述目标对象的属性参数,确定所述时间间隔;其中,所述第一待检测图像的属性参数至少包括以下之一:所述第一待检测图像的场景信息、所述第一待检测图像的采集时间所属的时段或季节。In some embodiments, the apparatus further includes a third determination module configured to determine the time interval according to attribute parameters of the first image to be detected and/or attribute parameters of the target object; wherein the The attribute parameter of the first image to be detected includes at least one of the following: scene information of the first image to be detected, and the time period or season to which the acquisition time of the first image to be detected belongs.
在一些实施例中,所述第一待检测图像是从在线视频流中获取的,所述第二待检测图像的采集时间早于所述第一待检测图像的采集时间。In some embodiments, the first image to be detected is acquired from an online video stream, and the acquisition time of the second image to be detected is earlier than the acquisition time of the first image to be detected.
在一些实施例中,所述装置还包括第一检测模块和第二检测模块,其中,所述第一检测模块配置为利用目标垃圾检测模型对从所述在线视频流中提取的第一待检测图像进行检测,得到第一检测 结果;所述第二获取模块,还配置为在根据所述第一检测结果确定所述第一待检测图像中存在所述目标对象的情况下,从存储的视频库中获取所述第二待检测图像;所述第二检测模块,还配置为利用所述目标垃圾检测模型对从所述第二待检测图像进行检测,得到第二检测结果;所述第一确定模块还配置为在根据所述第二检测结果确定所述第二待检测图像中存在所述目标对象的情况下,确定所述目标对象为垃圾。In some embodiments, the apparatus further includes a first detection module and a second detection module, wherein the first detection module is configured to use a target garbage detection model to detect the first to-be-detected extracted from the online video stream The image is detected to obtain a first detection result; the second acquisition module is further configured to, when it is determined according to the first detection result that the target object exists in the first image to be detected, from the stored video The second to-be-detected image is obtained from a library; the second detection module is further configured to use the target garbage detection model to detect the second to-be-detected image to obtain a second detection result; the first The determining module is further configured to determine that the target object is garbage when it is determined according to the second detection result that the target object exists in the second image to be detected.
在一些实施例中,所述第一检测模块,还配置为利用所述目标垃圾检测模型分析所述第一待检测图像中对象的属性信息;根据所述第一待检测图像中对象的属性信息确定对应对象属于所述目标对象还是属于垃圾,得到第一检测结果;所述第二检测模块,配置为利用所述目标垃圾检测模型分析所述第二待检测图像中对象的属性信息;根据所述第二待检测图像中对象的属性信息,确定对应对象属于所述目标对象还是属于垃圾,得到第二检测结果。In some embodiments, the first detection module is further configured to analyze the attribute information of the object in the first image to be detected by using the target garbage detection model; according to the attribute information of the object in the first image to be detected Determine whether the corresponding object belongs to the target object or belongs to garbage, and obtain a first detection result; the second detection module is configured to analyze the attribute information of the object in the second to-be-detected image by using the target garbage detection model; The attribute information of the object in the second to-be-detected image is used to determine whether the corresponding object belongs to the target object or the garbage, and a second detection result is obtained.
在一些实施例中,所述对象的属性信息包括以下至少之一:所述对象的形态、材质、大小、所处的位置。In some embodiments, the attribute information of the object includes at least one of the following: shape, material, size, and location of the object.
在一些实施例中,在所述第一检测结果为所述对象属于垃圾的情况下,所述装置还包括第四确定模块、第五确定模块和第一发送模块,其中,所述第四确定模块,配置为根据所述对象的属性信息确定所述垃圾所属的垃圾类别和所述垃圾所处的位置;所述第五确定模块,配置为根据所述垃圾类别和所述垃圾所处的位置,确定垃圾告警对应的内容;所述第一发送模块,配置为将所述垃圾告警对应的内容发送给垃圾管理平台。In some embodiments, when the first detection result is that the object belongs to garbage, the apparatus further includes a fourth determining module, a fifth determining module, and a first sending module, wherein the fourth determining module a module configured to determine the garbage category to which the garbage belongs and the location of the garbage according to the attribute information of the object; the fifth determination module is configured to determine the garbage category and the location of the garbage according to the garbage category , determine the content corresponding to the garbage alarm; the first sending module is configured to send the content corresponding to the garbage alarm to the garbage management platform.
在一些实施例中,所述第一检测模块,还配置为对所述第一待检测图像进行检测,确定所述第一待检测图像对应的目标对象和目标框;根据所述第一待检测图像对应的目标对象和所述目标框,确定第一交并比;第一确定模块,还配置为在确定所述第二待检测图像对应的目标对象的情况下,根据所述目标框和所述第一待检测图像对应的目标框确定第二交并比;在所述第一交并比与所述第二交并比同时大于预设交并比阈值的情况下,确定所述目标对象为垃圾。In some embodiments, the first detection module is further configured to detect the first image to be detected, and determine a target object and a target frame corresponding to the first image to be detected; The target object corresponding to the image and the target frame determine a first intersection ratio; the first determination module is further configured to determine the target object corresponding to the second image to be detected, according to the target frame and the target frame. The target frame corresponding to the first to-be-detected image determines a second intersection ratio; when the first intersection ratio and the second intersection ratio are greater than a preset intersection ratio threshold at the same time, determine the target object for garbage.
在一些实施例中,所述装置还包括第六确定模块、第七确定模块和第二发送模块,其中,第六确定模块,用于在确定所述目标对象为垃圾的情况下,根据所述第一待检测图像和/或所述第二待检测图像确定所述垃圾所处的位置;第七确定模块,用于根据所述垃圾所处的位置确定对应的终端或清洁机器人;第二发送模块,用于将所述垃圾告警发送给所述终端或所述机器人,以使得持有所述终端的保洁员清理所述垃圾或者所述清洁机器人处理所述垃圾。In some embodiments, the apparatus further includes a sixth determination module, a seventh determination module, and a second sending module, wherein the sixth determination module is configured to, in the case of determining that the target object is garbage, according to the The first image to be detected and/or the second image to be detected determines the location of the garbage; a seventh determination module is used to determine the corresponding terminal or cleaning robot according to the location of the garbage; the second sending The module is configured to send the garbage alarm to the terminal or the robot, so that the cleaner holding the terminal cleans the garbage or the cleaning robot processes the garbage.
在一些实施例中,所述装置还包括第三获取模块、第四获取模块和训练模块,其中,所述第三获取模块配置为获取至少一张目标图像;所述目标图像是将从视频流中截取的待检测图像输入至初始垃圾检测模型,根据所述初始的目标垃圾检测模型输出的检测结果确定的;所述初始垃圾检测模型是采用第一数据集进行训练的;其中,所述第一数据集为至少部分样本图像具有标注信息的数据集;所述第四获取模块,配置为获取对所述至少一张目标图像的人工标注结果,将标注后的所述至少一张目标图像作为训练样本合并到所述第一数据集,得到第二数据集;所述训练模块,配置为利用所述第二数据集对所述初始垃圾检测模型进行训练,得到所述目标垃圾检测模型。In some embodiments, the apparatus further includes a third acquisition module, a fourth acquisition module and a training module, wherein the third acquisition module is configured to acquire at least one target image; the target image is obtained from the video stream The to-be-detected image intercepted in the 2000 is input to the initial garbage detection model, and is determined according to the detection result output by the initial target garbage detection model; the initial garbage detection model is trained by using the first data set; wherein, the first A dataset is a dataset in which at least some sample images have annotation information; the fourth acquisition module is configured to acquire a manual annotation result for the at least one target image, and use the annotated at least one target image as a The training samples are merged into the first data set to obtain a second data set; the training module is configured to use the second data set to train the initial garbage detection model to obtain the target garbage detection model.
在一些实施例中,所述第三获取模块包括输入子模块和确定子模块,所述输入子模块配置为将 所述至少一帧待检测图像输入所述初始垃圾检测模型,得到每一帧所述待检测图像的后验概率;所述确定子模块配置为在确定所述后验概率大于第一概率阈值且小于第二概率阈值的情况下,将与所述后验概率对应的待检测图像确定为所述目标图像,其中,所述第一概率阈值小于所述第二概率阈值。In some embodiments, the third acquisition module includes an input sub-module and a determination sub-module, and the input sub-module is configured to input the at least one frame of the image to be detected into the initial garbage detection model, and obtain the information of each frame. the posterior probability of the image to be detected; the determining sub-module is configured to, when determining that the posterior probability is greater than the first probability threshold and less than the second probability threshold, determine the image to be detected corresponding to the posterior probability The target image is determined, wherein the first probability threshold is smaller than the second probability threshold.
以上装置实施例的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果。对于本申请装置实施例中未披露的技术细节,请参照本申请方法实施例的描述而理解。The descriptions of the above apparatus embodiments are similar to the descriptions of the above method embodiments, and have similar beneficial effects to the method embodiments. For technical details not disclosed in the device embodiments of the present application, please refer to the descriptions of the method embodiments of the present application for understanding.
需要说明的是,本申请实施例中,如果以软件功能模块的形式实现上述的垃圾检测方法,并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得电子设备(可以是手机、平板电脑、笔记本电脑、台式计算机、机器人、服务器等)执行本申请各个实施例所述方法的全部或部分。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的介质。这样,本申请实施例不限制于任何特定的硬件和软件结合。It should be noted that, in the embodiments of the present application, if the above garbage detection method is implemented in the form of a software function module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be embodied in the form of software products in essence or the parts that contribute to related technologies. The computer software products are stored in a storage medium and include several instructions to make An electronic device (which may be a mobile phone, a tablet computer, a notebook computer, a desktop computer, a robot, a server, etc.) executes all or part of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read only memory (Read Only Memory, ROM), a magnetic disk or an optical disk and other media that can store program codes. As such, the embodiments of the present application are not limited to any specific combination of hardware and software.
对应地,本申请实施例提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述实施例中提供的垃圾检测方法中的步骤。Correspondingly, the embodiments of the present application provide a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the steps in the garbage detection method provided in the foregoing embodiments.
对应地,本申请实施例提供一种电子设备,图6为本申请实施例提供的一种电子设备的硬件实体示意图,如图6所示,该设备600的硬件实体包括:包括存储器601和处理器602,所述存储器601存储有可在处理器602上运行的计算机程序,所述处理器602执行所述程序时实现上述实施例中提供的方法中的步骤。Correspondingly, an embodiment of the present application provides an electronic device, and FIG. 6 is a schematic diagram of a hardware entity of an electronic device provided by an embodiment of the present application. As shown in FIG. 6 , the hardware entity of the device 600 includes: a memory 601 and a processing The memory 601 stores a computer program that can be executed on the processor 602, and the processor 602 implements the steps in the methods provided in the above embodiments when the processor 602 executes the program.
存储器601配置为存储由处理器602可执行的指令和应用,还可以缓存待处理器602以及电子设备600中各模块待处理或已经处理的数据(例如,图像数据、音频数据、语音通信数据和视频通信数据),可以通过闪存(FLASH)或随机访问存储器(Random Access Memory,RAM)实现。The memory 601 is configured to store instructions and applications executable by the processor 602, and can also cache data to be processed or processed by the processor 602 and various modules in the electronic device 600 (eg, image data, audio data, voice communication data and Video communication data), which can be realized by flash memory (FLASH) or random access memory (Random Access Memory, RAM).
这里需要指出的是:以上存储介质和设备实施例的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果。对于本申请存储介质和设备实施例中未披露的技术细节,请参照本申请方法实施例的描述而理解。It should be pointed out here that the descriptions of the above storage medium and device embodiments are similar to the descriptions of the above method embodiments, and have similar beneficial effects to the method embodiments. For technical details not disclosed in the embodiments of the storage medium and device of the present application, please refer to the description of the method embodiments of the present application to understand.
应理解,说明书通篇中提到的“一个实施例”或“一实施例”意味着与实施例有关的特定特征、结构或特性包括在本申请的至少一个实施例中。因此,在整个说明书各处出现的“在一个实施例中”或“在一实施例中”未必一定指相同的实施例。此外,这些特定的特征、结构或特性可以任意适合的方式结合在一个或多个实施例中。应理解,在本申请的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。It is to be understood that reference throughout the specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic associated with the embodiment is included in at least one embodiment of the present application. Thus, appearances of "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily necessarily referring to the same embodiment. Furthermore, the particular features, structures or characteristics may be combined in any suitable manner in one or more embodiments. It should be understood that, in various embodiments of the present application, the size of the sequence numbers of the above-mentioned processes does not mean the sequence of execution, and the execution sequence of each process should be determined by its functions and internal logic, and should not be dealt with in the embodiments of the present application. implementation constitutes any limitation. The above-mentioned serial numbers of the embodiments of the present application are only for description, and do not represent the advantages or disadvantages of the embodiments.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或 者装置中还存在另外的相同要素。It should be noted that, herein, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements, It also includes other elements not expressly listed or inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element.
在本申请所提供的几个实施例中,应该理解到,所揭露的设备和方法,可以通过其它的方式实现。以上所描述的设备实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个单元或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的耦合、或直接耦合、或通信连接可以是通过一些接口,设备或单元的间接耦合或通信连接,可以是电性的、机械的或其它形式的。In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined, or Can be integrated into another system, or some features can be ignored, or not implemented. In addition, the coupling, or direct coupling, or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be electrical, mechanical or other forms. of.
上述作为分离部件说明的单元可以是、或也可以不是物理上分开的,作为单元显示的部件可以是、或也可以不是物理单元;既可以位于一个地方,也可以分布到多个网络单元上;可以根据实际的需要选择其中的部分或全部单元来实现本实施例方案的目的。The unit described above as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit; it may be located in one place or distributed to multiple network units; Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本申请各实施例中的各功能单元可以全部集成在一个处理单元中,也可以是各单元分别单独作为一个单元,也可以两个或两个以上单元集成在一个单元中;上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may all be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above integration The unit can be implemented either in the form of hardware or in the form of hardware plus software functional units.
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、只读存储器(Read Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by program instructions related to hardware, the aforementioned program can be stored in a computer-readable storage medium, and when the program is executed, the execution includes: The steps of the above method embodiments; and the aforementioned storage medium includes: a removable storage device, a read only memory (Read Only Memory, ROM), a magnetic disk or an optical disk and other media that can store program codes.
或者,本申请上述集成的单元如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得电子设备(可以是手机、平板电脑、笔记本电脑、台式计算机、机器人、服务器等)执行本申请各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、磁碟或者光盘等各种可以存储程序代码的介质。Alternatively, if the above-mentioned integrated units of the present application are implemented in the form of software function modules and sold or used as independent products, they may also be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be embodied in the form of software products in essence or the parts that contribute to related technologies. The computer software products are stored in a storage medium and include several instructions to make An electronic device (which may be a mobile phone, a tablet computer, a notebook computer, a desktop computer, a robot, a server, etc.) executes all or part of the methods described in the various embodiments of the present application. The aforementioned storage medium includes various media that can store program codes, such as a removable storage device, a ROM, a magnetic disk, or an optical disk.
本申请所提供的几个方法或设备实施例中所揭露的特征,在不冲突的情况下可以任意组合,得到新的方法实施例或设备实施例。The features disclosed in several method or device embodiments provided in this application can be combined arbitrarily without conflict to obtain new method embodiments or device embodiments.
以上所述,仅为本申请的实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above is only the embodiment of the present application, but the protection scope of the present application is not limited to this. Covered within the scope of protection of this application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
工业实用性Industrial Applicability
本申请实施例中,首选获取第一待检测图像,然后在确定第一待检测图像中存在目标对象的情况下,获取第二待检测图像,最后在确定第二待检测图像中存在目标对象的情况下,确定目标对象为垃圾。利用多帧逻辑,可以有效排除形态与垃圾相似,但是不属于垃圾种类的日常物品,同时确定长时间位置未发生较大改变的物体为垃圾。In the embodiment of the present application, the first image to be detected is firstly acquired, then the second image to be detected is acquired when it is determined that there is a target object in the first image to be detected, and finally it is determined that there is a target object in the second image to be detected In this case, the target object is determined to be garbage. Using multi-frame logic, it is possible to effectively exclude everyday objects that are similar in shape to garbage, but do not belong to the type of garbage, and at the same time determine that objects whose position has not changed significantly for a long time are garbage.

Claims (20)

  1. 一种垃圾检测方法,所述方法由电子设备执行,所述方法包括:A garbage detection method, the method is performed by an electronic device, and the method includes:
    获取第一待检测图像;obtaining the first image to be detected;
    在确定所述第一待检测图像中存在目标对象的情况下,获取第二待检测图像,其中,所述第一待检测图像的采集区域与所述第二待检测图像的采集区域之间的重叠比例大于预设阈值,且所述第一待检测图像与所述第二待检测图像的采集时间相距预设的时间间隔;In the case where it is determined that there is a target object in the first image to be detected, a second image to be detected is acquired, wherein the distance between the acquisition area of the first image to be detected and the acquisition area of the second image to be detected is The overlap ratio is greater than a preset threshold, and the acquisition times of the first to-be-detected image and the second to-be-detected image are separated by a preset time interval;
    在确定所述第二待检测图像中存在所述目标对象的情况下,确定所述目标对象为垃圾。When it is determined that the target object exists in the second image to be detected, it is determined that the target object is garbage.
  2. 如权利要求1所述的方法,其中,所述方法还包括:The method of claim 1, wherein the method further comprises:
    分析所述第一待检测图像中的场景信息;analyzing scene information in the first image to be detected;
    根据所述第一待检测图像中的场景信息,确定所述目标对象。The target object is determined according to scene information in the first image to be detected.
  3. 如权利要求1或2所述的方法,其中,所述方法还包括:The method of claim 1 or 2, wherein the method further comprises:
    根据所述第一待检测图像的属性参数和/或所述目标对象的属性参数,确定所述时间间隔;determining the time interval according to the attribute parameter of the first image to be detected and/or the attribute parameter of the target object;
    其中,所述第一待检测图像的属性参数至少包括以下之一:所述第一待检测图像的场景信息、所述第一待检测图像的采集时间所属的时段或季节。Wherein, the attribute parameter of the first image to be detected includes at least one of the following: scene information of the first image to be detected, and the time period or season to which the acquisition time of the first image to be detected belongs.
  4. 如权利要求1至3任一项所述的方法,其中,所述第一待检测图像是从在线视频流中获取的,所述第二待检测图像的时间早于所述第一待检测图像的采集时间。The method according to any one of claims 1 to 3, wherein the first image to be detected is obtained from an online video stream, and the time of the second image to be detected is earlier than the time of the first image to be detected collection time.
  5. 如权利要求4所述的方法,其中,所述方法还包括:利用目标垃圾检测模型对从所述在线视频流中提取的第一待检测图像进行检测,得到第一检测结果;The method of claim 4, wherein the method further comprises: using a target garbage detection model to detect the first image to be detected extracted from the online video stream to obtain a first detection result;
    所述在确定所述第一待检测图像中存在目标对象的情况下,获取第二待检测图像,包括:在根据所述第一检测结果确定所述第一待检测图像中存在所述目标对象的情况下,从存储的视频库中获取所述第二待检测图像;The acquiring a second image to be detected when it is determined that a target object exists in the first image to be detected includes: determining that the target object exists in the first image to be detected according to the first detection result In the case of , obtain the second to-be-detected image from the stored video library;
    对应地,所述方法还包括:利用所述目标垃圾检测模型对从所述第二待检测图像进行检测,得到第二检测结果;Correspondingly, the method further includes: using the target garbage detection model to detect the second to-be-detected image to obtain a second detection result;
    所述在确定所述第二待检测图像中存在所述目标对象的情况下,确定所述目标对象为垃圾,包括:在根据所述第二检测结果确定所述第二待检测图像中存在所述目标对象的情况下,确定所述目标对象为垃圾。The determining that the target object is garbage when it is determined that the target object exists in the second image to be detected includes: determining that the target object exists in the second image to be detected according to the second detection result; In the case of the target object, it is determined that the target object is garbage.
  6. 如权利要求5所述的方法,其中,所述利用目标垃圾检测模型对从所述在线视频流中提取的第一待检测图像进行检测,得到第一检测结果,包括:The method of claim 5, wherein the detecting the first to-be-detected image extracted from the online video stream by using a target garbage detection model to obtain a first detection result comprises:
    利用所述目标垃圾检测模型分析所述第一待检测图像中对象的属性信息;根据所述第一待检测图像中对象的属性信息确定对应对象属于所述目标对象还是属于垃圾,得到第一检测结果;Use the target garbage detection model to analyze the attribute information of the object in the first image to be detected; determine whether the corresponding object belongs to the target object or garbage according to the attribute information of the object in the first image to be detected, and obtain the first detection result;
    所述利用所述目标垃圾检测模型对从所述第二待检测图像进行检测,得到第二检测结果,包括:The use of the target garbage detection model to detect the second to-be-detected image to obtain a second detection result includes:
    利用所述目标垃圾检测模型分析所述第二待检测图像中对象的属性信息;根据所述第二待检测图像中对象的属性信息,确定对应对象属于所述目标对象还是属于垃圾,得到第二检测结果。Use the target garbage detection model to analyze the attribute information of the object in the second image to be detected; according to the attribute information of the object in the second image to be detected, determine whether the corresponding object belongs to the target object or belongs to garbage, and obtain the second Test results.
  7. 如权利要求6所述的方法,其中,所述对象的属性信息包括以下至少之一:所述对象的形态、材质、大小、所处的位置。The method of claim 6, wherein the attribute information of the object includes at least one of the following: shape, material, size, and location of the object.
  8. 如权利要求6或7所述的方法,其中,在所述第一检测结果为所述对象属于垃圾的情况下,所述方法还包括:The method according to claim 6 or 7, wherein, when the first detection result is that the object belongs to garbage, the method further comprises:
    根据所述对象的属性信息确定所述垃圾所属的垃圾类别和所述垃圾所处的位置;Determine the garbage category to which the garbage belongs and the location of the garbage according to the attribute information of the object;
    根据所述垃圾类别和所述垃圾所处的位置,确定垃圾告警对应的内容;Determine the content corresponding to the garbage alarm according to the garbage category and the location of the garbage;
    将所述垃圾告警对应的内容发送给垃圾管理平台。Send the content corresponding to the garbage alarm to the garbage management platform.
  9. 如权利要求6至8任一项所述的方法,其中,所述利用目标垃圾检测模型对从所述在线视频流中提取的第一待检测图像进行检测,得到第一检测结果,还包括:对所述第一待检测图像进行检测,确定所述第一待检测图像对应的目标对象和目标框;根据所述第一待检测图像对应的目标对象和所述目标框,确定第一交并比;The method according to any one of claims 6 to 8, wherein the detecting the first image to be detected extracted from the online video stream by using a target garbage detection model to obtain a first detection result, further comprising: Detecting the first to-be-detected image to determine a target object and a target frame corresponding to the first to-be-detected image; determining a first intersection according to the target object and the target frame corresponding to the first to-be-detected image Compare;
    对应地,在根据所述第二检测结果确定所述第二待检测图像中存在所述目标对象的情况下,确定所述目标对象为垃圾,包括:Correspondingly, when it is determined according to the second detection result that the target object exists in the second to-be-detected image, determining that the target object is garbage includes:
    在确定所述第二待检测图像对应的目标对象的情况下,根据所述目标框和所述第二待检测图像对应的目标对象确定第二交并比;在所述第一交并比与所述第二交并比同时大于预设交并比阈值的情况下,确定所述目标对象为垃圾。In the case of determining the target object corresponding to the second image to be detected, a second intersection ratio is determined according to the target frame and the target object corresponding to the second image to be detected; in the first intersection ratio and When the second intersection ratio is greater than a preset intersection ratio threshold at the same time, it is determined that the target object is garbage.
  10. 如权利要求5至9任一项所述的方法,其中,所述目标垃圾检测模型是采用下面的步骤得到的,包括:The method according to any one of claims 5 to 9, wherein the target garbage detection model is obtained by adopting the following steps, including:
    获取至少一张目标图像;所述目标图像是将从视频流中截取的待检测图像输入至初始垃圾检测模型,根据所述初始垃圾检测模型输出的检测结果确定的;所述初始垃圾检测模型是采用第一数据集进行训练的;其中,所述第一数据集为至少部分样本图像具有标注信息的数据集;Obtain at least one target image; the target image is input to the initial garbage detection model from the image to be detected intercepted from the video stream, and determined according to the detection result output by the initial garbage detection model; the initial garbage detection model is The first data set is used for training; wherein, the first data set is a data set in which at least some of the sample images have annotation information;
    获取对所述至少一张目标图像的人工标注结果,将标注后的所述至少一张目标图像作为训练样本合并到所述第一数据集,得到第二数据集;Obtain the manual labeling result of the at least one target image, and merge the labelled at least one target image into the first data set as a training sample to obtain a second data set;
    利用所述第二数据集对所述初始垃圾检测模型进行训练,得到所述目标垃圾检测模型。The initial garbage detection model is trained by using the second data set to obtain the target garbage detection model.
  11. 如权利要求10所述的方法,其中,所述获取至少一张目标图像,包括:The method of claim 10, wherein the acquiring at least one target image comprises:
    将所述待检测图像输入所述初始垃圾检测模型,得到每一帧所述待检测图像的后验概率;Inputting the to-be-detected image into the initial garbage detection model to obtain the posterior probability of each frame of the to-be-detected image;
    在确定所述后验概率大于第一概率阈值且小于第二概率阈值的情况下,将与所述后验概率对应的待检测图像确定为所述目标图像,其中,所述第一概率阈值小于所述第二概率阈值。When it is determined that the posterior probability is greater than a first probability threshold and less than a second probability threshold, the image to be detected corresponding to the posterior probability is determined as the target image, wherein the first probability threshold is less than the second probability threshold.
  12. 一种垃圾检测装置,包括:A garbage detection device, comprising:
    第一获取模块,配置为获取第一待检测图像;a first acquisition module, configured to acquire a first image to be detected;
    第二获取模块,配置为在确定所述第一待检测图像中存在目标对象的情况下,获取第二待检测图像,其中,所述第一待检测图像的采集区域与所述第二待检测图像的采集区域之间的重叠比例大于预设阈值,且所述第一待检测图像与所述第二待检测图像的采集时间相距预设的时间间隔;The second acquisition module is configured to acquire a second image to be detected when it is determined that there is a target object in the first image to be detected, wherein the acquisition area of the first image to be detected is the same as the second image to be detected The overlap ratio between the image acquisition areas is greater than a preset threshold, and the acquisition times of the first to-be-detected image and the second to-be-detected image are separated by a preset time interval;
    第一确定模块,配置为在确定所述第二待检测图像中存在所述目标对象的情况下,确定所述目标对象为垃圾。The first determination module is configured to determine that the target object is garbage when it is determined that the target object exists in the second to-be-detected image.
  13. 如权利要求12所述的装置,其中,所述装置还包括:The apparatus of claim 12, wherein the apparatus further comprises:
    第三确定模块,配置为根据所述第一待检测图像的属性参数和/或所述目标对象的属性参数,确定所述时间间隔;其中,所述第一待检测图像的属性参数至少包括以下之一:所述第一待检测图像的场景信息、所述第一待检测图像的采集时间所属的时段或季节。A third determining module, configured to determine the time interval according to the attribute parameters of the first image to be detected and/or the attribute parameters of the target object; wherein the attribute parameters of the first image to be detected at least include the following One: the scene information of the first image to be detected, the time period or season to which the acquisition time of the first image to be detected belongs.
  14. 如权利要求13所述的装置,其中,所述装置还包括:The apparatus of claim 13, wherein the apparatus further comprises:
    第一检测模块配置为利用目标垃圾检测模型对从所述在线视频流中提取的第一待检测图像进行检测,得到第一检测结果;The first detection module is configured to use the target garbage detection model to detect the first image to be detected extracted from the online video stream to obtain a first detection result;
    所述第二获取模块,还配置为在根据所述第一检测结果确定所述第一待检测图像中存在所述目标对象的情况下,从存储的视频库中获取所述第二待检测图像;The second acquisition module is further configured to acquire the second to-be-detected image from a stored video library when it is determined according to the first detection result that the target object exists in the first to-be-detected image ;
    第二检测模块,还配置为利用所述目标垃圾检测模型对从所述第二待检测图像进行检测,得到第二检测结果;The second detection module is further configured to use the target garbage detection model to detect the second to-be-detected image to obtain a second detection result;
    所述第一确定模块,还配置为在根据所述第二检测结果确定所述第二待检测图像中存在所述目标对象的情况下,确定所述目标对象为垃圾。The first determining module is further configured to determine that the target object is garbage when it is determined according to the second detection result that the target object exists in the second image to be detected.
  15. 如权利要求14所述的装置,其中,The apparatus of claim 14, wherein,
    所述第一检测模块,还配置为利用所述目标垃圾检测模型分析所述第一待检测图像中对象的属性信息;根据所述第一待检测图像中对象的属性信息确定对应对象属于所述目标对象还是属于垃圾,得到第一检测结果;The first detection module is further configured to analyze the attribute information of the object in the first to-be-detected image by using the target garbage detection model; The target object is still garbage, and the first detection result is obtained;
    所述第二检测模块,配置为利用所述目标垃圾检测模型分析所述第二待检测图像中对象的属性信息;根据所述第二待检测图像中对象的属性信息,确定对应对象属于所述目标对象还是属于垃圾,得到第二检测结果。The second detection module is configured to analyze the attribute information of the object in the second to-be-detected image by using the target garbage detection model; according to the attribute information of the object in the second to-be-detected image, determine that the corresponding object belongs to the The target object still belongs to garbage, and a second detection result is obtained.
  16. 如权利要求15所述的装置,其中,The apparatus of claim 15, wherein,
    所述第一检测模块,还配置为对所述第一待检测图像进行检测,确定所述第一待检测图像对应的目标对象和目标框;根据所述第一待检测图像对应的目标对象和所述目标框,确定第一交并比;The first detection module is further configured to detect the first image to be detected, and to determine a target object and a target frame corresponding to the first image to be detected; the target frame, determine the first cross-union ratio;
    所述第一确定模块,还配置为在确定所述第二待检测图像对应的目标对象的情况下,根据所述目标框和所述第一待检测图像对应的目标框确定第二交并比;在所述第一交并比与所述第二交并比同时大于预设交并比阈值的情况下,确定所述目标对象为垃圾。The first determining module is further configured to determine a second intersection ratio according to the target frame and the target frame corresponding to the first image to be detected when the target object corresponding to the second image to be detected is determined. ; In the case that the first intersection ratio and the second intersection ratio are greater than a preset intersection ratio threshold at the same time, determine that the target object is garbage.
  17. 如权利要求14至16任一项所述的装置,其中,所述装置还包括:The apparatus of any one of claims 14 to 16, wherein the apparatus further comprises:
    第三获取模块,获取至少一张目标图像;所述目标图像是将从视频流中截取的待检测图像输入至初始垃圾检测模型,根据所述初始垃圾检测模型输出的检测结果确定的;所述初始垃圾检测模型是采用第一数据集进行训练的;其中,所述第一数据集为至少部分样本图像具有标注信息的数据集;The third acquisition module acquires at least one target image; the target image is input to the initial garbage detection model from the to-be-detected image intercepted from the video stream, and is determined according to the detection result output by the initial garbage detection model; the The initial garbage detection model is trained by using a first data set; wherein, the first data set is a data set in which at least part of the sample images have annotation information;
    第四获取模块,配置为获取对所述至少一张目标图像的人工标注结果,将标注后的所述至少一张目标图像作为训练样本合并到所述第一数据集,得到第二数据集;a fourth acquisition module, configured to acquire a result of manual annotation of the at least one target image, and merge the marked at least one target image into the first data set as a training sample to obtain a second data set;
    训练模块,配置为利用所述第二数据集对所述初始垃圾检测模型进行训练,得到所述目标垃圾检测模型。A training module configured to use the second data set to train the initial garbage detection model to obtain the target garbage detection model.
  18. 一种电子设备,包括:存储器和处理器,An electronic device comprising: a memory and a processor,
    所述存储器存储有可在所述处理器上运行的计算机程序,the memory stores a computer program executable on the processor,
    所述处理器执行所述计算机程序时实现权利要求1至11中任一项所述垃圾检测方法中的步骤。When the processor executes the computer program, the steps in the garbage detection method of any one of claims 1 to 11 are implemented.
  19. 一种计算机存储介质,所述计算机存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现权利要求1至11中任一项所述垃圾检测方法中的步骤。A computer storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to realize the garbage according to any one of claims 1 to 11 steps in the detection method.
  20. 一种计算机程序产品,所述计算机程序产品包括一条或多条指令,所述一条或多条指令适于由处理器加载并执行如权利要求1至11任一项所述垃圾检测方法中的步骤。A computer program product comprising one or more instructions adapted to be loaded by a processor and to perform the steps in the garbage detection method of any one of claims 1 to 11 .
PCT/CN2021/103078 2021-02-20 2021-06-29 Garbage detection method and apparatus, device, storage medium, and program product WO2022174541A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110193692.6A CN112926431A (en) 2021-02-20 2021-02-20 Garbage detection method, device, equipment and computer storage medium
CN202110193692.6 2021-02-20

Publications (1)

Publication Number Publication Date
WO2022174541A1 true WO2022174541A1 (en) 2022-08-25

Family

ID=76170019

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/103078 WO2022174541A1 (en) 2021-02-20 2021-06-29 Garbage detection method and apparatus, device, storage medium, and program product

Country Status (2)

Country Link
CN (1) CN112926431A (en)
WO (1) WO2022174541A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112926431A (en) * 2021-02-20 2021-06-08 北京市商汤科技开发有限公司 Garbage detection method, device, equipment and computer storage medium
CN113468976A (en) * 2021-06-10 2021-10-01 浙江大华技术股份有限公司 Garbage detection method, garbage detection system and computer readable storage medium
CN113743408A (en) * 2021-11-02 2021-12-03 阿里巴巴达摩院(杭州)科技有限公司 Waste treatment method, waste treatment device, storage medium, processor, and electronic apparatus
CN114444895A (en) * 2021-12-31 2022-05-06 深圳云天励飞技术股份有限公司 Cleaning quality evaluation method and related equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106444481A (en) * 2016-08-31 2017-02-22 苏州迈力电器有限公司 Garbage disposal monitoring system
CN108932510A (en) * 2018-08-20 2018-12-04 贵州宜行智通科技有限公司 A kind of rubbish detection method and device
US20190347485A1 (en) * 2016-11-08 2019-11-14 Hangzhou Hikvision Digital Technology Co., Ltd. Target detection method and device
CN110558902A (en) * 2019-09-12 2019-12-13 炬佑智能科技(苏州)有限公司 Mobile robot, specific object detection method and device thereof and electronic equipment
CN112173497A (en) * 2020-11-10 2021-01-05 珠海格力电器股份有限公司 Control method and device of garbage collection equipment
CN112926431A (en) * 2021-02-20 2021-06-08 北京市商汤科技开发有限公司 Garbage detection method, device, equipment and computer storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106851200A (en) * 2017-02-07 2017-06-13 广州视源电子科技股份有限公司 Adjust the method and device of the camera lens of classroom CCTV camera
EP3618427B1 (en) * 2017-04-28 2022-04-13 Hitachi Kokusai Electric Inc. Video monitoring system
CN109250342B (en) * 2018-08-03 2021-08-31 北京小米移动软件有限公司 Garbage collection method and device
CN109858331A (en) * 2018-12-17 2019-06-07 安徽酷哇机器人有限公司 Automatic Pilot cleans vehicle rubbish and identifies method for cleaning
CN110969267A (en) * 2019-12-18 2020-04-07 恒大智慧科技有限公司 Community garbage processing method, community server and computer readable storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106444481A (en) * 2016-08-31 2017-02-22 苏州迈力电器有限公司 Garbage disposal monitoring system
US20190347485A1 (en) * 2016-11-08 2019-11-14 Hangzhou Hikvision Digital Technology Co., Ltd. Target detection method and device
CN108932510A (en) * 2018-08-20 2018-12-04 贵州宜行智通科技有限公司 A kind of rubbish detection method and device
CN110558902A (en) * 2019-09-12 2019-12-13 炬佑智能科技(苏州)有限公司 Mobile robot, specific object detection method and device thereof and electronic equipment
CN112173497A (en) * 2020-11-10 2021-01-05 珠海格力电器股份有限公司 Control method and device of garbage collection equipment
CN112926431A (en) * 2021-02-20 2021-06-08 北京市商汤科技开发有限公司 Garbage detection method, device, equipment and computer storage medium

Also Published As

Publication number Publication date
CN112926431A (en) 2021-06-08

Similar Documents

Publication Publication Date Title
WO2022174541A1 (en) Garbage detection method and apparatus, device, storage medium, and program product
CN111126252B (en) Swing behavior detection method and related device
CN108932510A (en) A kind of rubbish detection method and device
CN102880873B (en) Personnel behavior identification implementation system and method based on image segmentation and semantic extraction
CN113158956A (en) Garbage detection and identification method based on improved yolov5 network
CN110087193A (en) Information uploading method, device, electronic equipment and the readable storage medium storing program for executing of dustbin
CN111017429B (en) Community garbage classification method and system based on multi-factor fusion
CN111611970A (en) Urban management monitoring video-based disposable garbage behavior detection method
CN105718912B (en) A kind of vehicle characteristics object detecting method based on deep learning
Pamintuan et al. i-BIN: An intelligent trash bin for automatic waste segregation and monitoring system
CN109426785A (en) A kind of human body target personal identification method and device
WO2020114116A1 (en) Pedestrian detection method based on dense crowds, and storage medium and processor
TW201140502A (en) System and method for monitoring objects
CN103077236A (en) System and method for realizing video knowledge acquisition and marking function of portable-type device
AU2021203869B2 (en) Methods, devices, electronic apparatuses and storage media of image processing
CN109522421A (en) A kind of product attribute recognition methods of the network equipment
CN107315823A (en) Data processing method and device based on ecommerce
CN113468976A (en) Garbage detection method, garbage detection system and computer readable storage medium
CN113255550B (en) Pedestrian garbage throwing frequency counting method based on video
CN112183460A (en) Method and device for intelligently identifying environmental sanitation
CN206472227U (en) A kind of video-unit
Albakour et al. SMART: An Open Source Framework for Searching the Physical World.
CN115346110A (en) Service plate identification method, service plate identification system, electronic equipment and storage medium
CN115471872A (en) Behavior detection method and device for distributing advertisement, electronic equipment and storage medium
CN204759089U (en) Control system of convenient for people garbage bin of wisdom

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21926257

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21926257

Country of ref document: EP

Kind code of ref document: A1