[go: up one dir, main page]

CN112488118B - A target detection method and related device - Google Patents

A target detection method and related device Download PDF

Info

Publication number
CN112488118B
CN112488118B CN202011510824.5A CN202011510824A CN112488118B CN 112488118 B CN112488118 B CN 112488118B CN 202011510824 A CN202011510824 A CN 202011510824A CN 112488118 B CN112488118 B CN 112488118B
Authority
CN
China
Prior art keywords
bounding box
target area
minimum bounding
original image
density
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202011510824.5A
Other languages
Chinese (zh)
Other versions
CN112488118A (en
Inventor
段成真
王鸿鹏
张驰
魏志伟
屈思莹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Harbin Institute of Technology Shenzhen
Original Assignee
Harbin Institute of Technology Shenzhen
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 Harbin Institute of Technology Shenzhen filed Critical Harbin Institute of Technology Shenzhen
Priority to CN202011510824.5A priority Critical patent/CN112488118B/en
Publication of CN112488118A publication Critical patent/CN112488118A/en
Application granted granted Critical
Publication of CN112488118B publication Critical patent/CN112488118B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • G06V10/267Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion by performing operations on regions, e.g. growing, shrinking or watersheds
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20021Dividing image into blocks, subimages or windows
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V2201/00Indexing scheme relating to image or video recognition or understanding
    • G06V2201/07Target detection

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Geometry (AREA)
  • Image Analysis (AREA)

Abstract

The application provides a target detection method and a related device, and relates to the technical field of image recognition, wherein the target detection method comprises the following steps: extracting feature information of the original image to obtain feature information of the original image; based on the original image characteristic information, generating a corresponding density map and a segmentation map; determining a target area in the original image based on the segmentation map, and generating a target area density map based on the target area and the density map; based on the target area density map, cutting out a block image related to the target area density map from the original image; and respectively carrying out target detection on each segmented image so as to output a target detection result corresponding to each segmented image. Based on the technical scheme of the application, the accuracy of target detection can be effectively improved.

Description

一种目标检测方法及相关装置A target detection method and related device

技术领域technical field

本申请涉及图像识别技术领域,特别是涉及一种目标检测方法及相关装置。The present application relates to the technical field of image recognition, in particular to a target detection method and a related device.

背景技术Background technique

随着时代的发展,人们对于目标检测的准确率有了越来越高的要求,如何提高目标检测的准确率已成为本领域研究的重点。With the development of the times, people have higher and higher requirements for the accuracy of target detection. How to improve the accuracy of target detection has become the focus of research in this field.

现有技术中,原始图像存在大量的噪声,直接对原始图像进行目标检测容易被该噪声所干扰,从而忽略有用信息,降低目标检测的准确性。In the prior art, there is a large amount of noise in the original image, and the target detection directly performed on the original image is easily disturbed by the noise, thereby ignoring useful information and reducing the accuracy of target detection.

发明内容Contents of the invention

本申请提供一种目标检测方法及相关装置,有利于减少目标检测过程中的资源浪费。The present application provides an object detection method and a related device, which are beneficial to reducing waste of resources in the object detection process.

为了实现上述技术效果,本申请第一方面提供一种目标检测方法,包括:In order to achieve the above technical effects, the first aspect of the present application provides a target detection method, including:

对原始图像进行特征信息提取,得到原始图像特征信息;Extract feature information from the original image to obtain feature information of the original image;

基于上述原始图像特征信息,生成相应的密度图和分割图;Generate the corresponding density map and segmentation map based on the above original image feature information;

基于上述分割图,确定上述原始图像中的目标区域,并基于上述目标区域和上述密度图,生成目标区域密度图,其中,上述目标区域为上述分割图中亮度值大于第一预设值的点所构成的区域,上述目标区域密度图为仅包含上述目标区域的密度信息的密度图;Determine the target area in the original image based on the segmentation map, and generate a target area density map based on the target area and the density map, wherein the target area is a point with a brightness value greater than a first preset value in the segmentation map In the formed area, the density map of the above-mentioned target area is a density map that only includes the density information of the above-mentioned target area;

基于上述目标区域密度图,从上述原始图像中裁剪出与目标区域密度图相关的分块图像;Based on the above-mentioned target area density map, cutting out block images related to the target area density map from the above-mentioned original image;

分别对各上述分块图像进行目标检测,以输出各上述分块图像所对应的目标检测结果。Target detection is performed on each of the above-mentioned block images, so as to output a target detection result corresponding to each of the above-mentioned block images.

基于本申请第一方面,在第一种可能的实现方式中,上述基于上述目标区域密度图,从上述原始图像中裁剪出与目标区域密度图相关的分块图像包括:Based on the first aspect of the present application, in a first possible implementation manner, based on the above-mentioned target area density map, cutting out block images related to the target area density map from the above-mentioned original image includes:

基于上述目标区域密度图,生成用于包围上述目标区域密度图中的密度连通区域的最小包围框,其中,上述密度连通区域为密度值大于第二预设值的相连的点所构成的区域;Based on the above-mentioned target area density map, generate a minimum bounding box for enclosing the density-connected area in the above-mentioned target area density map, wherein the above-mentioned density-connected area is an area composed of connected points whose density value is greater than a second preset value;

基于各上述最小包围框、上述目标区域密度图和上述原始图像,得到各上述最小包围框所对应的预测目标面积占比,其中,上述预测目标面积占比为在相应最小包围框于上述原始图像上的映射区域内,各预测目标的面积占上述映射区域的总面积的比例的平均值;Based on each of the above-mentioned minimum bounding boxes, the above-mentioned target area density map, and the above-mentioned original image, the predicted target area ratio corresponding to each of the above-mentioned minimum bounding boxes is obtained. In the mapped area above, the average value of the ratio of the area of each predicted target to the total area of the above mapped area;

基于各上述预测目标面积占比与预设的标准占比的大小关系,对各上述最小包围框进行尺度调整,以使各调整后的最小包围框的预测目标面积占比相较于调整前更接近上述标准占比;Based on the size relationship between each of the above-mentioned predicted target area ratios and the preset standard ratio, the scale of each of the above-mentioned minimum bounding boxes is adjusted, so that the predicted target area ratio of each adjusted minimum bounding box is smaller than that before adjustment. Close to the above standard ratio;

基于各上述调整后的最小包围框映射在上述原始图像上的位置,对原始图像进行裁剪,以得到与各上述调整后的最小包围框一一对应的一个以上分块图像。Based on the position of each of the above-mentioned adjusted minimum bounding boxes mapped on the above-mentioned original image, the original image is cropped to obtain one or more block images corresponding to each of the above-mentioned adjusted minimum bounding boxes.

基于本申请第一方面的第一种可能的实现方式,在第二种可能的实现方式中,上述基于各上述预测目标面积占比与预设的标准占比的大小关系,对各上述最小包围框进行尺度调整,以使各调整后的最小包围框的预测目标面积占比相较于调整前更接近上述标准占比包括:Based on the first possible implementation of the first aspect of the present application, in the second possible implementation, based on the size relationship between each of the above-mentioned predicted target area ratios and the preset standard ratio, each of the above-mentioned minimum enclosing The scale of the frame is adjusted so that the proportion of the predicted target area of each adjusted minimum bounding box is closer to the above-mentioned standard proportion than before adjustment, including:

分别计算各上述最小包围框的预测目标面积占比与上述标准占比的比值;Calculate the ratio of the predicted target area ratio of each of the above minimum bounding boxes to the above standard ratio;

若存在第一类包围框,则增大上述第一类包围框的尺度,以使各调整后的第一类包围框的预测目标面积占比相较于调整前更接近上述标准占比,其中,上述第一类包围框为各上述最小包围框中上述比值大于第三预设值的最小包围框;If there is a first-type bounding box, increase the scale of the above-mentioned first-type bounding box, so that the predicted target area ratio of each adjusted first-type bounding box is closer to the above-mentioned standard ratio than before adjustment, where , the above-mentioned first type of bounding box is the smallest bounding box with the above-mentioned ratio greater than the third preset value among the above-mentioned minimum bounding boxes;

若存在第二类包围框,则减小上述第二类包围框的尺度,和/或,将上述第二类包围框分割为两个以上最小包围框,以使各调整后的第二类包围框的预测目标面积占比相较于调整前更接近上述标准占比,其中,上述第二类包围框为各上述最小包围框中上述比值小于第四预设值的最小包围框;If there is a second-type bounding box, reduce the size of the second-type bounding box, and/or, divide the second-type bounding box into two or more minimum bounding boxes, so that each adjusted second-type bounding box The proportion of the predicted target area of the frame is closer to the above-mentioned standard proportion than before adjustment, wherein the above-mentioned second type of bounding box is the smallest bounding box with the above-mentioned ratio smaller than the fourth preset value in each of the above-mentioned smallest bounding boxes;

其中,上述第三预设值不小于上述第四预设值。Wherein, the above-mentioned third preset value is not less than the above-mentioned fourth preset value.

基于本申请第一方面的第一种或第二种可能的实现方式,在第三种可能的实现方式中,在上述基于上述目标区域密度图,生成用于包围上述目标区域密度图中的密度连通区域的最小包围框后,上述目标检测方法还包括:Based on the first or second possible implementation of the first aspect of the present application, in the third possible implementation, based on the above-mentioned target area density map, generate the density used to enclose the above-mentioned target area density map After the minimum bounding box of the connected area, the above target detection method also includes:

将各上述最小包围框中相距距离小于预设距离的两个最小包围框进行合并,以合并成用于包围上述相距距离小于预设距离的两个最小包围框的密度连通区域的最小包围框。Merging two minimum bounding boxes whose distance is less than a preset distance among the above minimum bounding boxes to form a minimum bounding box for enclosing the density-connected area of the two minimum bounding boxes whose distance is less than a preset distance.

基于本申请第一方面或本申请第一方面的第一种或第二种可能的实现方式,在第四种可能的实现方式中,在上述分别对各上述分块图像进行目标检测后,上述目标检测方法还包括:Based on the first aspect of the present application or the first or second possible implementation of the first aspect of the present application, in the fourth possible implementation, after performing target detection on each of the above-mentioned block images, the above-mentioned Object detection methods also include:

基于非极大值抑制算法,对各上述目标检测结果进行合并,以得到上述原始图像的目标检测结果。Based on the non-maximum value suppression algorithm, the above-mentioned target detection results are combined to obtain the target detection result of the above-mentioned original image.

基于本申请第一方面或本申请第一方面的第一种或第二种可能的实现方式,在第五种可能的实现方式中,上述对原始图像进行特征信息提取,得到原始图像特征信息,基于上述原始图像特征信息,生成相应的密度图和分割图包括:Based on the first aspect of the present application or the first or second possible implementation of the first aspect of the present application, in the fifth possible implementation, the feature information of the original image is extracted to obtain the feature information of the original image, Based on the above original image feature information, generating the corresponding density map and segmentation map includes:

基于第一预设模型,对原始图像进行特征信息提取,并生成相应的密度图和分割图。Based on the first preset model, feature information is extracted from the original image, and a corresponding density map and segmentation map are generated.

基于本申请第一方面的第一种或第二种可能的实现方式,在第六种可能的实现方式中,上述基于各上述最小包围框、上述目标区域密度图和上述原始图像,得到各上述最小包围框所对应的预测目标面积占比包括:Based on the first or second possible implementation of the first aspect of the present application, in the sixth possible implementation, each of the above-mentioned The proportion of predicted target area corresponding to the smallest bounding box includes:

基于上述目标区域密度图和各上述最小包围框,确定各上述最小包围框的面积、各上述最小包围框内的密度值之和、各上述最小包围框中的密度连通区域的面积;Based on the above-mentioned target area density map and each of the above-mentioned minimum enclosing boxes, determine the area of each of the above-mentioned minimum enclosing boxes, the sum of the density values in each of the above-mentioned minimum enclosing boxes, and the area of the density connected region in each of the above-mentioned minimum enclosing boxes;

基于第二预设模型、各上述最小包围框的面积、各上述最小包围框内的密度值之和、各上述最小包围框中的密度连通区域的面积和上述原始图像的总面积,得到各上述最小包围框所对应的预测目标面积占比。Based on the second preset model, the area of each of the aforementioned smallest bounding boxes, the sum of the density values in each of the aforementioned smallest bounding boxes, the area of the density-connected regions in each of the aforementioned smallest bounding boxes, and the total area of the aforementioned original image, each of the aforementioned The proportion of the predicted target area corresponding to the smallest bounding box.

基于本申请第一方面或本申请第一方面的第一种或第二种可能的实现方式,在第七种可能的实现方式中,上述分别对各上述分块图像进行目标检测包括:Based on the first aspect of the present application or the first or second possible implementation of the first aspect of the present application, in a seventh possible implementation, the above-mentioned target detection for each of the above-mentioned block images includes:

基于第三预设模型,分别对各上述分块图像进行目标检测。Based on the third preset model, target detection is performed on each of the aforementioned block images.

本申请第二方面提供一种目标检测装置,包括:The second aspect of the present application provides a target detection device, including:

提取单元,用于对原始图像进行特征信息提取,得到原始图像特征信息;The extraction unit is used to extract feature information from the original image to obtain feature information of the original image;

第一生成单元,用于基于上述原始图像特征信息,生成相应的密度图和分割图;The first generation unit is used to generate a corresponding density map and segmentation map based on the above-mentioned original image feature information;

第二生成单元,用于基于上述分割图,确定上述原始图像中的目标区域,并基于上述目标区域和上述密度图,生成目标区域密度图,其中,上述目标区域为上述分割图中亮度值大于第一预设值的点所构成的区域,上述目标区域密度图为仅包含上述目标区域的密度信息的密度图;The second generation unit is configured to determine the target area in the original image based on the segmentation map, and generate a density map of the target area based on the target area and the density map, wherein the target area has a brightness value greater than The area formed by the points of the first preset value, the above-mentioned target area density map is a density map that only includes the density information of the above-mentioned target area;

裁剪单元,用于基于上述目标区域密度图,从上述原始图像中裁剪出与目标区域密度图相关的分块图像;A cropping unit, configured to cut out block images related to the target area density map from the above-mentioned original image based on the above-mentioned target area density map;

目标检测单元,用于分别对各上述分块图像进行目标检测,以输出各上述分块图像所对应的目标检测结果。The target detection unit is configured to perform target detection on each of the above-mentioned block images, so as to output a target detection result corresponding to each of the above-mentioned block images.

本申请第三方面提供一种目标检测装置,包括存储器和处理器,上述存储器存储有计算机程序,上述处理器执行上述计算机程序时实现上述第一方面或上述第一方面的任一种可能的实现方式中提及的目标检测方法的步骤。The third aspect of the present application provides a target detection device, including a memory and a processor, the memory stores a computer program, and the processor implements the first aspect or any possible implementation of the first aspect when executing the computer program The steps of the target detection method mentioned in the way.

由上可见,本申请的技术方案包括对原始图像进行特征信息提取,得到原始图像特征信息;基于原始图像特征信息,生成相应的密度图和分割图;基于分割图,确定原始图像中的目标区域,并基于目标区域和密度图,生成目标区域密度图;基于目标区域密度图,从原始图像中裁剪出与目标区域密度图相关的分块图像;分别对各分块图像进行目标检测,以输出各分块图像所对应的目标检测结果。基于本申请的技术方案,可先提取原始图像的分割图和密度图,并基于分割图对密度图作进一步删减,以提高目标区域密度图对原始图像中的目标的针对性,再基于目标区域密度图对原始图像进行裁剪,最后对各裁剪得到的分块图像进行目标检测以得到各目标检测结果,由于只对于目标区域密度图相关的分块图像进行目标检测,可有效排除原始图像中的噪声干扰,提高目标检测的准确性。It can be seen from the above that the technical solution of the present application includes extracting the feature information of the original image to obtain the feature information of the original image; generating the corresponding density map and segmentation map based on the feature information of the original image; determining the target area in the original image based on the segmentation map , and based on the target area and the density map, the target area density map is generated; based on the target area density map, the block images related to the target area density map are cut out from the original image; the target detection is performed on each block image to output The target detection results corresponding to each block image. Based on the technical solution of this application, the segmentation map and density map of the original image can be extracted first, and the density map can be further deleted based on the segmentation map to improve the pertinence of the target area density map to the target in the original image, and then based on the target The area density map cuts the original image, and finally performs target detection on each cropped block image to obtain each target detection result. Since the target detection is only performed on block images related to the target area density map, it can effectively exclude the original image. Noise interference, improve the accuracy of target detection.

附图说明Description of drawings

为了更清楚地说明本申请实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the accompanying drawings that need to be used in the descriptions of the embodiments or the prior art will be briefly introduced below. Obviously, the accompanying drawings in the following description are only for the present application For some embodiments, those skilled in the art can also obtain other drawings according to these drawings without paying creative efforts.

图1为本申请提供的目标检测方法一实施例流程示意图;FIG. 1 is a schematic flow chart of an embodiment of a target detection method provided by the present application;

图2为本申请提供的目标检测装置一实施例结构示意图;FIG. 2 is a schematic structural diagram of an embodiment of a target detection device provided by the present application;

图3为本申请提供的目标检测装置另一实施例结构示意图。Fig. 3 is a schematic structural diagram of another embodiment of the target detection device provided by the present application.

具体实施方式Detailed ways

以下描述中,为了说明而不是为了限定,提出了诸如特定系统结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其他实施例中也可以实现本申请。在其它情况下,省略对众所周知的系统、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, specific details such as specific system structures and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be practiced in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.

应当理解,当在本说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It should be understood that when used in this specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and/or components, but does not exclude one or more other features. , whole, step, operation, element, component and/or the presence or addition of a collection thereof.

还应当理解,在本申请说明书中所使用的术语仅仅是出于描述特定实施例的目的而并不意在限制本申请。如在本申请说明书和所附权利要求书中所使用的那样,除非上下文清楚地指明其它情况,否则单数形式的“一”、“一个”及“该”意在包括复数形式。It should also be understood that the terminology used in the specification of the present application is for the purpose of describing specific embodiments only and is not intended to limit the present application. As used in this specification and the appended claims, the singular forms "a", "an" and "the" are intended to include plural referents unless the context clearly dictates otherwise.

下面结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请的一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application are clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.

在下面的描述中阐述了很多具体细节以便于充分理解本申请,但是本申请还可以采用其它不同于在此描述的其它方式来实施,本领域技术人员可以在不违背本申请内涵的情况下做类似推广,因此本申请不受下面公开的具体实施例的限制。In the following description, a lot of specific details are set forth in order to fully understand the application, but the application can also be implemented in other ways different from those described here, and those skilled in the art can do it without violating the content of the application. By analogy, the present application is therefore not limited by the specific embodiments disclosed below.

实施例一Embodiment one

本申请提供一种目标检测,如图1所示,包括:This application provides a target detection, as shown in Figure 1, including:

步骤101,对原始图像进行特征信息提取,得到原始图像特征信息;Step 101, extracting feature information from the original image to obtain feature information of the original image;

本申请实施例中,可先获取需要进行目标检测的原始图像,再对该原始图像进行特征信息的提取,得到原始图像特征信息,也即原始图像的特征信息,以备后续使用。In the embodiment of the present application, the original image that needs to be detected can be obtained first, and then the feature information of the original image is extracted to obtain the feature information of the original image, that is, the feature information of the original image, for subsequent use.

步骤102,基于上述原始图像特征信息,生成相应的密度图和分割图;Step 102, generating a corresponding density map and segmentation map based on the above-mentioned original image feature information;

本申请实施例中,密度图为,密度图中的每个点的密度值用于表示原始图像中相应区域的目标密度值;分割图为基于预设的图像分割法和原始图像特征信息所获取的图,该图像分割法可以是目标与背景二分类法、阈值分割法、最大间类方差法和其它图像分割法中的任一种。In the embodiment of the present application, the density map is that the density value of each point in the density map is used to represent the target density value of the corresponding area in the original image; the segmentation map is obtained based on the preset image segmentation method and original image feature information The image segmentation method can be any one of target and background binary classification method, threshold segmentation method, maximum inter-class variance method and other image segmentation methods.

具体的,采用目标与背景二分类法对原始图像进行图像分割,以得到上述分割图的具体流程如下:Specifically, the target and background binary classification method is used to segment the original image to obtain the above segmentation map. The specific process is as follows:

基于训练好的神经网络和原始图像,生成相应的目标概率图和相应的背景概率图,其中,上述目标概率图和上述背景概率图的分辨率相同,上述目标概率图和上述背景概率图中的每一个点的值分别代表该点为目标或背景的概率值;Based on the trained neural network and the original image, the corresponding target probability map and the corresponding background probability map are generated, wherein the above target probability map and the above background probability map have the same resolution, and the above target probability map and the above background probability map have the same The value of each point represents the probability value of the point being the target or the background;

将上述目标概率图和上述背景概率图上相互映射的点进行一一对应的大小比较,将为目标的概率大于为背景的概率的点确定为目标点,将为目标的概率不大于为背景的概率的点确定为背景点;Compare the size of the points mapped to each other on the above target probability map and the above background probability map one by one, the point whose probability of the target is greater than the probability of the background is determined as the target point, and the probability of the target is not greater than that of the background The point of probability is determined as the background point;

基于上述目标概率图和上述背景概率图,以将背景点赋值为0并将目标点赋值为某一预设值的方式,得到上述分割图。Based on the above-mentioned target probability map and the above-mentioned background probability map, the above-mentioned segmentation map is obtained by assigning the background point to 0 and the target point to a preset value.

可选的,上述对原始图像进行特征信息提取,得到原始图像特征信息,基于上述原始图像特征信息,生成相应的密度图和分割图包括:Optionally, the feature information extraction of the original image is carried out above to obtain the feature information of the original image, and based on the feature information of the original image, generating a corresponding density map and a segmentation map includes:

基于第一预设模型,对原始图像进行特征信息提取,并生成相应的密度图和分割图。Based on the first preset model, feature information is extracted from the original image, and a corresponding density map and segmentation map are generated.

具体的,上述第一预设模型可以是第一预设神经网络,在训练上述第一预设神经网络时,训练样本为一张以上的所属领域多元化的样本图,与各上述样本图相对应的训练标签包括:粗粒度密度图、基于目标与背景二分类法获得的目标的分割图;Specifically, the above-mentioned first preset model may be a first preset neural network, and when training the above-mentioned first preset neural network, the training samples are more than one diversified sample graph in the field, corresponding to each of the above-mentioned sample graphs. The corresponding training labels include: coarse-grained density map, segmentation map of the target obtained based on the target and background binary classification method;

其中,上述粗粒度密度图的每一点的值均可用于表示上述原始图像中一个区域的目标密度值;Wherein, the value of each point of the above-mentioned coarse-grained density map can be used to represent the target density value of a region in the above-mentioned original image;

上述用作训练标签的粗粒度密度图的生成方式具体可以如下:The above-mentioned generation method of the coarse-grained density map used as the training label can be as follows:

第一步,对样本图进行均匀分块,并生成相应的密度框架图,上述密度框架图的各点分别与上述样本图中各分块的密度值相对应;In the first step, the sample image is uniformly divided into blocks, and a corresponding density frame image is generated, and each point of the above density frame image corresponds to the density value of each block in the above sample image;

第二步,确定样本图中各目标的最小包围框,并将各最小包围框所对应的上述密度框架图上的点均赋值为1,以及将上述密度框架图中,各最小包围框所对应的上述密度框架图上的点以外的点赋值为0,以得到密度过渡图;The second step is to determine the minimum bounding box of each target in the sample map, and assign the points on the above-mentioned density frame diagram corresponding to each minimum bounding box to be 1, and assign the points corresponding to each minimum bounding box in the above-mentioned density frame map The points other than the points on the above-mentioned density frame map of are assigned a value of 0 to obtain a density transition map;

第三步,将上述密度过渡图中各目标所对应的点的总值分别进行归一化处理,以最终得到上述粗粒度密度图。The third step is to normalize the total values of the points corresponding to the targets in the above-mentioned density transition map, so as to finally obtain the above-mentioned coarse-grained density map.

需要说明的是,采用上述粗粒度密度图对上述第一预设神经网络进行训练,可使上述第一预设神经网络得到的密度图具有良好的聚类特性,以更突出各目标的密度信息,此外,归一化处理还可使大小不同的目标具备相同的密度总值,防止小目标的丢失。It should be noted that, using the above-mentioned coarse-grained density map to train the above-mentioned first preset neural network can make the density map obtained by the above-mentioned first preset neural network have good clustering characteristics, so as to highlight the density information of each target. , In addition, the normalization process can also make the targets of different sizes have the same total density value, preventing the loss of small targets.

步骤103,基于上述分割图,确定上述原始图像中的目标区域,并基于上述目标区域和上述密度图,生成目标区域密度图;Step 103: Determine the target area in the original image based on the segmentation map, and generate a target area density map based on the target area and the density map;

其中,上述目标区域为上述分割图中亮度值大于第一预设值的点所构成的区域,上述目标区域密度图为仅包含上述目标区域的密度信息的密度图;Wherein, the above-mentioned target area is an area formed by points whose luminance values are greater than a first preset value in the above-mentioned segmentation map, and the above-mentioned target area density map is a density map that only includes density information of the above-mentioned target area;

本申请实施例中,可基于上述分割图确定上述目标区域,也即原始图像中存在目标的区域,之后对密度图进行处理,以将密度图中除对应上述目标区域以外的区域的密度值清零,最终生成上述目标区域密度值。In the embodiment of the present application, the above-mentioned target area can be determined based on the above-mentioned segmentation map, that is, the area where the target exists in the original image, and then the density map is processed to clear the density values of the areas other than the corresponding target area in the density map. Zero, resulting in the above target region density values.

可选的,上述基于上述分割图,确定上述原始图像中的目标区域,并基于上述目标区域和上述密度图,生成目标区域密度图包括:Optionally, determining the target area in the original image based on the above-mentioned segmentation map, and generating the target area density map based on the above-mentioned target area and the above-mentioned density map include:

将上述分割图中亮度值大于第一预设值的点的亮度值均更新为1,并将上述分割图中亮度值不大于第一预设值的点的亮度值均更新为0;updating the luminance values of points whose luminance values are greater than the first preset value in the above-mentioned segmented map to 1, and updating the luminance values of points whose luminance values are not greater than the first preset value in the above-mentioned segmented map to 0;

将更新后的分割图中各点的亮度值与上述密度图中各点的密度值一一对应相乘,以获得目标区域密度图。The brightness value of each point in the updated segmentation map is multiplied by the density value of each point in the above density map in a one-to-one correspondence to obtain the density map of the target area.

具体的,上述第一预设值可以为0、1和其它正整数中的任一数,此处不作限定。Specifically, the above-mentioned first preset value may be any number among 0, 1 and other positive integers, which is not limited here.

步骤104,基于上述目标区域密度图,从上述原始图像中裁剪出与目标区域密度图相关的分块图像;Step 104, based on the above-mentioned target area density map, cut out block images related to the target area density map from the above-mentioned original image;

本申请实施例中,可基于目标区域密度图的各点的密度值,大致确定原始图像中所需要检测的目标的位置,之后基于所需要检测的目标的位置对原始图像有针对性地进行裁剪,得到与目标区域密度图相关的分块图像。In the embodiment of the present application, the position of the target to be detected in the original image can be roughly determined based on the density value of each point in the target area density map, and then the original image can be tailored based on the position of the target to be detected , to obtain a block image related to the density map of the target region.

可选的,上述基于上述目标区域密度图,从上述原始图像中裁剪出与目标区域密度图相关的分块图像包括:Optionally, based on the above-mentioned target area density map, cutting out block images related to the target area density map from the above-mentioned original image includes:

基于上述目标区域密度图,生成用于包围上述目标区域密度图中的密度连通区域的最小包围框,其中,上述密度连通区域为密度值大于第二预设值的相连的点所构成的区域;Based on the above-mentioned target area density map, generate a minimum bounding box for enclosing the density-connected area in the above-mentioned target area density map, wherein the above-mentioned density-connected area is an area composed of connected points whose density value is greater than a second preset value;

基于各上述最小包围框、上述目标区域密度图和上述原始图像,得到各上述最小包围框所对应的预测目标面积占比,其中,上述预测目标面积占比为在相应最小包围框于上述原始图像上的映射区域内,各预测目标的面积占上述映射区域的总面积的比例的平均值;Based on each of the above-mentioned minimum bounding boxes, the above-mentioned target area density map, and the above-mentioned original image, the predicted target area ratio corresponding to each of the above-mentioned minimum bounding boxes is obtained. In the mapped area above, the average value of the ratio of the area of each predicted target to the total area of the above mapped area;

基于各上述预测目标面积占比与预设的标准占比的大小关系,对各上述最小包围框进行尺度调整,以使各调整后的最小包围框的预测目标面积占比相较于调整前更接近上述标准占比;Based on the size relationship between each of the above-mentioned predicted target area ratios and the preset standard ratio, the scale of each of the above-mentioned minimum bounding boxes is adjusted, so that the predicted target area ratio of each adjusted minimum bounding box is smaller than that before adjustment. Close to the above standard ratio;

基于各上述调整后的最小包围框映射在上述原始图像上的位置,对原始图像进行裁剪,以得到与各上述调整后的最小包围框一一对应的一个以上分块图像。Based on the position of each of the above-mentioned adjusted minimum bounding boxes mapped on the above-mentioned original image, the original image is cropped to obtain one or more block images corresponding to each of the above-mentioned adjusted minimum bounding boxes.

具体的,上述第二预设值可以为0、1和其它正整数中的任一数,此处不作限定。Specifically, the above-mentioned second preset value may be any number among 0, 1 and other positive integers, which is not limited here.

需要说明的是,若各分块图像的预测目标面积占比均较为接近,则后续对该各分块图像进行目标检测的效果会较好,可提高原始图像中的面积较小的目标的检测精度,其中,标准占比可根据实际需求确定。It should be noted that if the predicted target area ratios of each block image are relatively close, the effect of subsequent target detection on each block image will be better, which can improve the detection of targets with smaller areas in the original image. Accuracy, where the standard ratio can be determined according to actual needs.

进一步的,上述基于各上述预测目标面积占比与预设的标准占比的大小关系,对各上述最小包围框进行尺度调整,以使各调整后的最小包围框的预测目标面积占比相较于调整前更接近上述标准占比包括:Further, based on the size relationship between each of the above-mentioned predicted target area ratios and the preset standard ratio, adjust the scale of each of the above-mentioned minimum bounding boxes, so that the predicted target area ratios of the adjusted minimum bounding boxes are compared with each other. Proportions closer to the above standard before adjustment include:

分别计算各上述最小包围框的预测目标面积占比与上述标准占比的比值;Calculate the ratio of the predicted target area ratio of each of the above minimum bounding boxes to the above standard ratio;

若存在第一类包围框,则增大上述第一类包围框的尺度,以使各调整后的第一类包围框的预测目标面积占比相较于调整前更接近上述标准占比,其中,上述第一类包围框为各上述最小包围框中上述比值大于第三预设值的最小包围框;If there is a first-type bounding box, increase the scale of the above-mentioned first-type bounding box, so that the predicted target area ratio of each adjusted first-type bounding box is closer to the above-mentioned standard ratio than before adjustment, where , the above-mentioned first type of bounding box is the smallest bounding box with the above-mentioned ratio greater than the third preset value among the above-mentioned minimum bounding boxes;

若存在第二类包围框,则减小上述第二类包围框的尺度,和/或,将上述第二类包围框分割为两个以上最小包围框,以使各调整后的第二类包围框的预测目标面积占比相较于调整前更接近上述标准占比,其中,上述第二类包围框为各上述最小包围框中上述比值小于第四预设值的最小包围框;If there is a second-type bounding box, reduce the size of the second-type bounding box, and/or, divide the second-type bounding box into two or more minimum bounding boxes, so that each adjusted second-type bounding box The proportion of the predicted target area of the frame is closer to the above-mentioned standard proportion than before adjustment, wherein the above-mentioned second type of bounding box is the smallest bounding box with the above-mentioned ratio smaller than the fourth preset value in each of the above-mentioned smallest bounding boxes;

其中,上述第三预设值不小于上述第四预设值。Wherein, the above-mentioned third preset value is not less than the above-mentioned fourth preset value.

具体的,上述第三预设值可以等于上述第四预设值,也可以大于上述第四预设值。Specifically, the above-mentioned third preset value may be equal to the above-mentioned fourth preset value, or may be greater than the above-mentioned fourth preset value.

更进一步的,上述增大上述第一类包围框的尺度包括:增大上述第一类包围框的长和/或宽,其中,上述第一类包围框为矩形框;Furthermore, increasing the scale of the first type of bounding box includes: increasing the length and/or width of the first type of bounding box, wherein the first type of bounding box is a rectangular box;

上述减小上述第二类包围框的尺度包括:减小上述第二类包围框的长和/或宽,其中,上述第二类包围框为矩形框。The reducing the size of the second-type bounding frame includes: reducing the length and/or width of the second-type bounding frame, wherein the second-type bounding frame is a rectangular frame.

上述将上述第二类包围框分割为两个以上最小包围框包括:The above-mentioned division of the second type of bounding box into more than two minimum bounding boxes includes:

对上述第二类包围框的长进行二分操作,以生成两个新的最小包围框;Perform a binary operation on the length of the above-mentioned second type of bounding box to generate two new minimum bounding boxes;

在生成两个新的最小包围框后,对该两个新的最小包围框的被进行二分操作的边的长度进行调整,以使该两个新的最小包围框部分重叠。After the two new minimum bounding boxes are generated, the lengths of the sides of the two new minimum bounding boxes subjected to the bisection operation are adjusted so that the two new minimum bounding boxes partially overlap.

进一步的,在上述基于上述目标区域密度图,生成用于包围上述目标区域密度图中的密度连通区域的最小包围框后,上述目标检测方法还包括:Further, after generating the minimum bounding box for enclosing the density-connected regions in the above-mentioned target area density map based on the above-mentioned target area density map, the above-mentioned target detection method further includes:

将各上述最小包围框中相距距离小于预设距离的两个最小包围框进行合并,以合并成用于包围上述相距距离小于预设距离的两个最小包围框的密度连通区域的最小包围框,以防止面积较小的最小包围框数量过多,提高了目标检测的效率。Merging the two minimum bounding boxes whose distance is less than a preset distance among each of the above minimum bounding boxes, so as to merge into a minimum bounding box for enclosing the density-connected area of the two minimum bounding boxes whose distance is less than a preset distance, In order to prevent too many minimum bounding boxes with a small area, the efficiency of target detection is improved.

进一步的,上述基于各上述最小包围框、上述目标区域密度图和上述原始图像,得到各上述最小包围框所对应的预测目标面积占比包括:Further, based on the above-mentioned minimum bounding boxes, the above-mentioned target area density map and the above-mentioned original image, the predicted target area ratio corresponding to each of the above-mentioned minimum bounding boxes includes:

基于上述目标区域密度图和各上述最小包围框,确定各上述最小包围框的面积、各上述最小包围框内的密度值之和、各上述最小包围框中的密度连通区域的面积;Based on the above-mentioned target area density map and each of the above-mentioned minimum enclosing boxes, determine the area of each of the above-mentioned minimum enclosing boxes, the sum of the density values in each of the above-mentioned minimum enclosing boxes, and the area of the density connected region in each of the above-mentioned minimum enclosing boxes;

基于第二预设模型、各上述最小包围框的面积、各上述最小包围框内的密度值之和、各上述最小包围框中的密度连通区域的面积和上述原始图像的总面积,得到各上述最小包围框所对应的预测目标面积占比。Based on the second preset model, the area of each of the aforementioned smallest bounding boxes, the sum of the density values in each of the aforementioned smallest bounding boxes, the area of the density-connected regions in each of the aforementioned smallest bounding boxes, and the total area of the aforementioned original image, each of the aforementioned The proportion of the predicted target area corresponding to the smallest bounding box.

具体的,上述第二预设模型可以是第二预设神经网络,在训练上述第二预设神经网络时,训练样本为一张以上含若干最小包围框的样本密度图和样本原图(该密度图包含的信息至少包括:各最小包围框的密度值总和、各最小包围框的密度连通区域的面积、各最小包围框面积和样本原图的总面积),与各上述样本密度图相对应的训练标签为在各最小包围框于上述原始图像上的映射区域内,各实际目标的面积占上述映射区域的总面积的比例的平均值。Specifically, the above-mentioned second preset model may be a second preset neural network. When training the above-mentioned second preset neural network, the training samples are more than one sample density map and sample original image containing several minimum bounding boxes (the The information contained in the density map includes at least: the sum of the density values of each minimum bounding box, the area of the density connected region of each minimum bounding box, the area of each minimum bounding box and the total area of the sample original image), corresponding to each of the above sample density maps The training label of is the average value of the ratio of the area of each actual target to the total area of the above-mentioned mapping area in the mapping area of each minimum bounding box on the above-mentioned original image.

步骤105,分别对各上述分块图像进行目标检测,以输出各上述分块图像所对应的目标检测结果。In step 105, target detection is performed on each of the aforementioned block images, so as to output target detection results corresponding to each of the aforementioned block images.

本申请实施例中,可分别对上述分块图像进行目标检测,以输出各上述分块图像所对应的目标检测结果,该目标检测结果可包括:分块图像中的各目标在原始图像中的包围框以及相应的类别信息。In the embodiment of the present application, target detection can be performed on the above-mentioned block images respectively, so as to output the target detection results corresponding to each of the above-mentioned block images, and the target detection results can include: Bounding boxes and corresponding category information.

可选的,在上述分别对各上述分块图像进行目标检测后,上述目标检测方法还包括:Optionally, after performing target detection on each of the above-mentioned block images, the above-mentioned target detection method further includes:

基于非极大值抑制算法,对各上述目标检测结果进行合并,以得到上述原始图像的目标检测结果。Based on the non-maximum value suppression algorithm, the above-mentioned target detection results are combined to obtain the target detection result of the above-mentioned original image.

具体的,基于非极大值抑制算法,将各分块图像的目标检测结果整合于原始图像上,以输出原始图像的目标检测结果。Specifically, based on the non-maximum value suppression algorithm, the target detection results of each block image are integrated on the original image, so as to output the target detection result of the original image.

可选的,上述分别对各上述分块图像进行目标检测包括:Optionally, the above-mentioned target detection for each of the above-mentioned block images includes:

基于第三预设模型,分别对各上述分块图像进行目标检测。Based on the third preset model, target detection is performed on each of the aforementioned block images.

具体的,上述第三预设模型可以是第三预设神经网络,在训练上述第三预设神经网络时,训练样本为一张以上裁剪出的样本分块图像,与各上述样本分块图像相对应的训练标签包括:样本分块图像中用于包围各目标的目标包围框以及相应的类别信息。Specifically, the above-mentioned third preset model may be a third preset neural network. When training the above-mentioned third preset neural network, the training sample is more than one sample block image cut out, and each of the above sample block images The corresponding training labels include: object bounding boxes used to enclose each object in the sample block image and corresponding category information.

可选的,上述最小包围框均可以是最小垂直包围框。Optionally, each of the minimum bounding boxes above may be a minimum vertical bounding box.

由上可见,本申请的技术方案包括对原始图像进行特征信息提取,得到原始图像特征信息;基于原始图像特征信息,生成相应的密度图和分割图;基于分割图,确定原始图像中的目标区域,并基于目标区域和密度图,生成目标区域密度图;基于目标区域密度图,从原始图像中裁剪出与目标区域密度图相关的分块图像;分别对各分块图像进行目标检测,以输出各分块图像所对应的目标检测结果。基于本申请的技术方案,可先提取原始图像的分割图和密度图,并基于分割图对密度图作进一步删减,以提高目标区域密度图对原始图像中的目标的针对性,再基于目标区域密度图对原始图像进行裁剪,最后对各裁剪得到的分块图像进行目标检测以得到各目标检测结果,由于只对于目标区域密度图相关的分块图像进行目标检测,可有效排除原始图像中的噪声干扰,提高目标检测的准确性。It can be seen from the above that the technical solution of the present application includes extracting the feature information of the original image to obtain the feature information of the original image; generating the corresponding density map and segmentation map based on the feature information of the original image; determining the target area in the original image based on the segmentation map , and based on the target area and the density map, the target area density map is generated; based on the target area density map, the block images related to the target area density map are cut out from the original image; the target detection is performed on each block image to output The target detection results corresponding to each block image. Based on the technical solution of this application, the segmentation map and density map of the original image can be extracted first, and the density map can be further deleted based on the segmentation map to improve the pertinence of the target area density map to the target in the original image, and then based on the target The area density map cuts the original image, and finally performs target detection on each cropped block image to obtain each target detection result. Since the target detection is only performed on block images related to the target area density map, it can effectively exclude the original image. Noise interference, improve the accuracy of target detection.

实施例二Embodiment two

本申请提供一种目标检测装置,如图2所示,目标检测装置20包括:The present application provides a target detection device. As shown in FIG. 2, the target detection device 20 includes:

提取单元201,用于对原始图像进行特征信息提取,得到原始图像特征信息;An extraction unit 201, configured to extract feature information from the original image to obtain feature information of the original image;

第一生成单元202,用于基于上述原始图像特征信息,生成相应的密度图和分割图;The first generation unit 202 is configured to generate a corresponding density map and segmentation map based on the above-mentioned original image feature information;

第二生成单元203,用于基于上述分割图,确定上述原始图像中的目标区域,并基于上述目标区域和上述密度图,生成目标区域密度图,其中,上述目标区域为上述分割图中亮度值大于第一预设值的点所构成的区域,上述目标区域密度图为仅包含上述目标区域的密度信息的密度图;The second generation unit 203 is configured to determine the target area in the original image based on the segmentation map, and generate a density map of the target area based on the target area and the density map, wherein the target area is the brightness value in the segmentation map For an area formed by points larger than the first preset value, the above-mentioned target area density map is a density map that only includes density information of the above-mentioned target area;

裁剪单元204,用于基于上述目标区域密度图,从上述原始图像中裁剪出与目标区域密度图相关的分块图像;A cropping unit 204, configured to crop a block image related to the target area density map from the above-mentioned original image based on the above-mentioned target area density map;

目标检测单元205,用于分别对各上述分块图像进行目标检测,以输出各上述分块图像所对应的目标检测结果。The target detection unit 205 is configured to perform target detection on each of the above-mentioned block images, so as to output a target detection result corresponding to each of the above-mentioned block images.

可选的,裁剪单元204具体用于:Optionally, the cropping unit 204 is specifically used for:

基于上述目标区域密度图,生成用于包围上述目标区域密度图中的密度连通区域的最小包围框,其中,上述密度连通区域为密度值大于第二预设值的相连的点所构成的区域;Based on the above-mentioned target area density map, generate a minimum bounding box for enclosing the density-connected area in the above-mentioned target area density map, wherein the above-mentioned density-connected area is an area composed of connected points whose density value is greater than a second preset value;

基于各上述最小包围框、上述目标区域密度图和上述原始图像,得到各上述最小包围框所对应的预测目标面积占比,其中,上述预测目标面积占比为在相应最小包围框于上述原始图像上的映射区域内,各预测目标的面积占上述映射区域的总面积的比例的平均值;Based on each of the above-mentioned minimum bounding boxes, the above-mentioned target area density map, and the above-mentioned original image, the predicted target area proportion corresponding to each of the above-mentioned minimum bounding boxes is obtained. In the mapped area above, the average value of the ratio of the area of each predicted target to the total area of the above mapped area;

基于各上述预测目标面积占比与预设的标准占比的大小关系,对各上述最小包围框进行尺度调整,以使各调整后的最小包围框的预测目标面积占比相较于调整前更接近上述标准占比;Based on the size relationship between each of the above-mentioned predicted target area ratios and the preset standard ratio, the scale of each of the above-mentioned minimum bounding boxes is adjusted, so that the predicted target area ratio of each adjusted minimum bounding box is smaller than that before adjustment. Close to the above standard ratio;

基于各上述调整后的最小包围框映射在上述原始图像上的位置,对原始图像进行裁剪,以得到与各上述调整后的最小包围框一一对应的一个以上分块图像。Based on the position of each of the above-mentioned adjusted minimum bounding boxes mapped on the above-mentioned original image, the original image is cropped to obtain one or more block images corresponding to each of the above-mentioned adjusted minimum bounding boxes.

进一步的,裁剪单元204具体还用于:Further, the cropping unit 204 is also specifically used for:

分别计算各上述最小包围框的预测目标面积占比与上述标准占比的比值;Calculate the ratio of the predicted target area ratio of each of the above minimum bounding boxes to the above standard ratio;

若存在第一类包围框,则增大上述第一类包围框的尺度,以使各调整后的第一类包围框的预测目标面积占比相较于调整前更接近上述标准占比,其中,上述第一类包围框为各上述最小包围框中上述比值大于第三预设值的最小包围框;If there is a first-type bounding box, increase the scale of the above-mentioned first-type bounding box, so that the predicted target area ratio of each adjusted first-type bounding box is closer to the above-mentioned standard ratio than before adjustment, where , the above-mentioned first type of bounding box is the smallest bounding box with the above-mentioned ratio greater than the third preset value among the above-mentioned minimum bounding boxes;

若存在第二类包围框,则减小上述第二类包围框的尺度,和/或,将上述第二类包围框分割为两个以上最小包围框,以使各调整后的第二类包围框的预测目标面积占比相较于调整前更接近上述标准占比,其中,上述第二类包围框为各上述最小包围框中上述比值小于第四预设值的最小包围框;If there is a second-type bounding box, reduce the size of the second-type bounding box, and/or, divide the second-type bounding box into two or more minimum bounding boxes, so that each adjusted second-type bounding box The proportion of the predicted target area of the frame is closer to the above-mentioned standard proportion than before adjustment, wherein the above-mentioned second type of bounding box is the smallest bounding box with the above-mentioned ratio smaller than the fourth preset value in each of the above-mentioned smallest bounding boxes;

其中,上述第三预设值不小于上述第四预设值。Wherein, the above-mentioned third preset value is not less than the above-mentioned fourth preset value.

进一步的,裁剪单元204具体还用于:Further, the cropping unit 204 is also specifically used for:

将各上述最小包围框中相距距离小于预设距离的两个最小包围框进行合并,以合并成用于包围上述相距距离小于预设距离的两个最小包围框的密度连通区域的最小包围框。Merging two minimum bounding boxes whose distance is less than a preset distance among the above minimum bounding boxes to form a minimum bounding box for enclosing the density-connected area of the two minimum bounding boxes whose distance is less than a preset distance.

进一步的,裁剪单元204具体还用于:Further, the cropping unit 204 is also specifically used for:

基于上述目标区域密度图和各上述最小包围框,确定各上述最小包围框的面积、各上述最小包围框内的密度值之和、各上述最小包围框中的密度连通区域的面积;Based on the above-mentioned target area density map and each of the above-mentioned minimum enclosing boxes, determine the area of each of the above-mentioned minimum enclosing boxes, the sum of the density values in each of the above-mentioned minimum enclosing boxes, and the area of the density connected region in each of the above-mentioned minimum enclosing boxes;

基于第二预设模型、各上述最小包围框的面积、各上述最小包围框内的密度值之和、各上述最小包围框中的密度连通区域的面积和上述原始图像的总面积,得到各上述最小包围框所对应的预测目标面积占比。Based on the second preset model, the area of each of the aforementioned smallest bounding boxes, the sum of the density values in each of the aforementioned smallest bounding boxes, the area of the density-connected regions in each of the aforementioned smallest bounding boxes, and the total area of the aforementioned original image, each of the aforementioned The proportion of the predicted target area corresponding to the smallest bounding box.

可选的,目标检测单元205还用于:Optionally, the target detection unit 205 is also used for:

基于非极大值抑制算法,对各上述目标检测结果进行合并,以得到上述原始图像的目标检测结果。Based on the non-maximum value suppression algorithm, the above-mentioned target detection results are combined to obtain the target detection result of the above-mentioned original image.

可选的,第一生成单元202具体用于:Optionally, the first generating unit 202 is specifically configured to:

基于第一预设模型,对原始图像进行特征信息提取,并生成相应的密度图和分割图。Based on the first preset model, feature information is extracted from the original image, and a corresponding density map and segmentation map are generated.

可选的,目标检测单元205具体用于:Optionally, the target detection unit 205 is specifically used for:

基于第三预设模型,分别对各上述分块图像进行目标检测。Based on the third preset model, target detection is performed on each of the aforementioned block images.

由上可见,本申请的技术方案包括对原始图像进行特征信息提取,得到原始图像特征信息;基于原始图像特征信息,生成相应的密度图和分割图;基于分割图,确定原始图像中的目标区域,并基于目标区域和密度图,生成目标区域密度图;基于目标区域密度图,从原始图像中裁剪出与目标区域密度图相关的分块图像;分别对各分块图像进行目标检测,以输出各分块图像所对应的目标检测结果。基于本申请的技术方案,可先提取原始图像的分割图和密度图,并基于分割图对密度图作进一步删减,以提高目标区域密度图对原始图像中的目标的针对性,再基于目标区域密度图对原始图像进行裁剪,最后对各裁剪得到的分块图像进行目标检测以得到各目标检测结果,由于只对于目标区域密度图相关的分块图像进行目标检测,可有效排除原始图像中的噪声干扰,提高目标检测的准确性。It can be seen from the above that the technical solution of the present application includes extracting the feature information of the original image to obtain the feature information of the original image; generating the corresponding density map and segmentation map based on the feature information of the original image; determining the target area in the original image based on the segmentation map , and based on the target area and the density map, the target area density map is generated; based on the target area density map, the block images related to the target area density map are cut out from the original image; the target detection is performed on each block image to output The target detection results corresponding to each block image. Based on the technical solution of this application, the segmentation map and density map of the original image can be extracted first, and the density map can be further deleted based on the segmentation map to improve the pertinence of the target area density map to the target in the original image, and then based on the target The area density map cuts the original image, and finally performs target detection on each cropped block image to obtain each target detection result. Since the target detection is only performed on block images related to the target area density map, it can effectively exclude the original image. Noise interference, improve the accuracy of target detection.

实施例三Embodiment three

本申请还提供另一种目标检测装置,如图3所示,本申请实施例中的目标检测装置包括:存储器301、处理器302以及存储在存储器301中并可在处理器302上运行的计算机程序,其中:存储器301用于存储软件程序以及模块,处理器302通过运行存储在存储器301的软件程序以及模块,从而执行各种功能应用以及数据处理,存储器301和处理器302通过总线303连接。The present application also provides another target detection device. As shown in FIG. 3 , the target detection device in the embodiment of the present application includes: a memory 301, a processor 302, and a computer stored in the memory 301 and operable on the processor 302 program, wherein: the memory 301 is used to store software programs and modules, and the processor 302 executes various functional applications and data processing by running the software programs and modules stored in the memory 301 , and the memory 301 and processor 302 are connected through a bus 303 .

具体的,处理器302通过运行存储在存储器301的上述计算机程序时实现以下步骤:Specifically, the processor 302 implements the following steps by running the above computer program stored in the memory 301:

对原始图像进行特征信息提取,得到原始图像特征信息;Extract feature information from the original image to obtain feature information of the original image;

基于上述原始图像特征信息,生成相应的密度图和分割图;Generate the corresponding density map and segmentation map based on the above original image feature information;

基于上述分割图,确定上述原始图像中的目标区域,并基于上述目标区域和上述密度图,生成目标区域密度图,其中,上述目标区域为上述分割图中亮度值大于第一预设值的点所构成的区域,上述目标区域密度图为仅包含上述目标区域的密度信息的密度图;Determine the target area in the original image based on the segmentation map, and generate a target area density map based on the target area and the density map, wherein the target area is a point with a brightness value greater than a first preset value in the segmentation map In the formed area, the density map of the above-mentioned target area is a density map that only includes the density information of the above-mentioned target area;

基于上述目标区域密度图,从上述原始图像中裁剪出与目标区域密度图相关的分块图像;Based on the above-mentioned target area density map, cutting out block images related to the target area density map from the above-mentioned original image;

分别对各上述分块图像进行目标检测,以输出各上述分块图像所对应的目标检测结果。Target detection is performed on each of the above-mentioned block images, so as to output a target detection result corresponding to each of the above-mentioned block images.

假设上述为第一种可能的实施方式,则在基于上述第一种可能的实施方式的第二种可能的实施方式中,上述基于上述目标区域密度图,从上述原始图像中裁剪出与目标区域密度图相关的分块图像包括:Assuming that the above is the first possible implementation manner, then in the second possible implementation manner based on the above first possible implementation manner, the target area is cut out from the above original image based on the above target area density map Density map related tiled images include:

基于上述目标区域密度图,生成用于包围上述目标区域密度图中的密度连通区域的最小包围框,其中,上述密度连通区域为密度值大于第二预设值的相连的点所构成的区域;Based on the above-mentioned target area density map, generate a minimum bounding box for enclosing the density-connected area in the above-mentioned target area density map, wherein the above-mentioned density-connected area is an area composed of connected points whose density value is greater than a second preset value;

基于各上述最小包围框、上述目标区域密度图和上述原始图像,得到各上述最小包围框所对应的预测目标面积占比,其中,上述预测目标面积占比为在相应最小包围框于上述原始图像上的映射区域内,各预测目标的面积占上述映射区域的总面积的比例的平均值;Based on each of the above-mentioned minimum bounding boxes, the above-mentioned target area density map, and the above-mentioned original image, the predicted target area ratio corresponding to each of the above-mentioned minimum bounding boxes is obtained. In the mapped area above, the average value of the ratio of the area of each predicted target to the total area of the above mapped area;

基于各上述预测目标面积占比与预设的标准占比的大小关系,对各上述最小包围框进行尺度调整,以使各调整后的最小包围框的预测目标面积占比相较于调整前更接近上述标准占比;Based on the size relationship between each of the above-mentioned predicted target area ratios and the preset standard ratio, the scale of each of the above-mentioned minimum bounding boxes is adjusted, so that the predicted target area ratio of each adjusted minimum bounding box is smaller than that before adjustment. Close to the above standard ratio;

基于各上述调整后的最小包围框映射在上述原始图像上的位置,对原始图像进行裁剪,以得到与各上述调整后的最小包围框一一对应的一个以上分块图像。Based on the position of each of the above-mentioned adjusted minimum bounding boxes mapped on the above-mentioned original image, the original image is cropped to obtain one or more block images corresponding to each of the above-mentioned adjusted minimum bounding boxes.

在基于上述第二种可能的实施方式的第三种可能的实施方式中,上述基于各上述预测目标面积占比与预设的标准占比的大小关系,对各上述最小包围框进行尺度调整,以使各调整后的最小包围框的预测目标面积占比相较于调整前更接近上述标准占比包括:In a third possible implementation manner based on the above second possible implementation manner, based on the size relationship between each of the above-mentioned predicted target area ratios and the preset standard ratio, the scale of each of the above-mentioned minimum bounding boxes is adjusted, To make the proportion of the predicted target area of each adjusted minimum bounding box closer to the above-mentioned standard proportion than before the adjustment includes:

分别计算各上述最小包围框的预测目标面积占比与上述标准占比的比值;Calculate the ratio of the predicted target area ratio of each of the above minimum bounding boxes to the above standard ratio;

若存在第一类包围框,则增大上述第一类包围框的尺度,以使各调整后的第一类包围框的预测目标面积占比相较于调整前更接近上述标准占比,其中,上述第一类包围框为各上述最小包围框中上述比值大于第三预设值的最小包围框;If there is a first-type bounding box, increase the scale of the above-mentioned first-type bounding box, so that the predicted target area ratio of each adjusted first-type bounding box is closer to the above-mentioned standard ratio than before adjustment, where , the above-mentioned first type of bounding box is the smallest bounding box with the above-mentioned ratio greater than the third preset value among the above-mentioned minimum bounding boxes;

若存在第二类包围框,则减小上述第二类包围框的尺度,和/或,将上述第二类包围框分割为两个以上最小包围框,以使各调整后的第二类包围框的预测目标面积占比相较于调整前更接近上述标准占比,其中,上述第二类包围框为各上述最小包围框中上述比值小于第四预设值的最小包围框;If there is a second-type bounding box, reduce the size of the second-type bounding box, and/or, divide the second-type bounding box into two or more minimum bounding boxes, so that each adjusted second-type bounding box The proportion of the predicted target area of the frame is closer to the above-mentioned standard proportion than before adjustment, wherein the above-mentioned second type of bounding box is the smallest bounding box with the above-mentioned ratio smaller than the fourth preset value in each of the above-mentioned smallest bounding boxes;

其中,上述第三预设值不小于上述第四预设值。Wherein, the above-mentioned third preset value is not less than the above-mentioned fourth preset value.

在基于上述第二种或第三种可能的实施方式的第四种可能的实施方式中,在上述基于上述目标区域密度图,生成用于包围上述目标区域密度图中的密度连通区域的最小包围框后,上述目标检测方法还包括:In a fourth possible implementation based on the above-mentioned second or third possible implementation, based on the above-mentioned target area density map, generate the minimum enclosing After the box, the above target detection method also includes:

将各上述最小包围框中相距距离小于预设距离的两个最小包围框进行合并,以合并成用于包围上述相距距离小于预设距离的两个最小包围框的密度连通区域的最小包围框。Merging two minimum bounding boxes whose distance is less than a preset distance among the above minimum bounding boxes to form a minimum bounding box for enclosing the density-connected area of the two minimum bounding boxes whose distance is less than a preset distance.

在基于上述第一种或第二种或第三种可能的实施方式的第五种可能的实施方式中,在上述分别对各上述分块图像进行目标检测后,上述目标检测方法还包括:In the fifth possible implementation manner based on the first, second, or third possible implementation manners above, after performing target detection on each of the above-mentioned block images, the above-mentioned target detection method further includes:

基于非极大值抑制算法,对各上述目标检测结果进行合并,以得到上述原始图像的目标检测结果。Based on the non-maximum value suppression algorithm, the above-mentioned target detection results are combined to obtain the target detection result of the above-mentioned original image.

在基于上述第一种或第二种或第三种可能的实施方式的第六种可能的实施方式中,上述对原始图像进行特征信息提取,得到原始图像特征信息,基于上述原始图像特征信息,生成相应的密度图和分割图包括:In the sixth possible implementation manner based on the above-mentioned first, second, or third possible implementation manners, the feature information of the original image is extracted to obtain the feature information of the original image, and based on the above-mentioned feature information of the original image, Generate the corresponding density map and segmentation map including:

基于第一预设模型,对原始图像进行特征信息提取,并生成相应的密度图和分割图。Based on the first preset model, feature information is extracted from the original image, and a corresponding density map and segmentation map are generated.

在基于上述第二种或第三种可能的实施方式的第七种可能的实施方式中,上述基于各上述最小包围框、上述目标区域密度图和上述原始图像,得到各上述最小包围框所对应的预测目标面积占比包括:In the seventh possible implementation manner based on the above-mentioned second or third possible implementation manner, based on each of the above-mentioned minimum bounding boxes, the above-mentioned target area density map and the above-mentioned original image, the corresponding The proportion of predicted target area includes:

基于上述目标区域密度图和各上述最小包围框,确定各上述最小包围框的面积、各上述最小包围框内的密度值之和、各上述最小包围框中的密度连通区域的面积;Based on the above-mentioned target area density map and each of the above-mentioned minimum enclosing boxes, determine the area of each of the above-mentioned minimum enclosing boxes, the sum of the density values in each of the above-mentioned minimum enclosing boxes, and the area of the density connected region in each of the above-mentioned minimum enclosing boxes;

基于第二预设模型、各上述最小包围框的面积、各上述最小包围框内的密度值之和、各上述最小包围框中的密度连通区域的面积和上述原始图像的总面积,得到各上述最小包围框所对应的预测目标面积占比。Based on the second preset model, the area of each of the aforementioned smallest bounding boxes, the sum of the density values in each of the aforementioned smallest bounding boxes, the area of the density-connected regions in each of the aforementioned smallest bounding boxes, and the total area of the aforementioned original image, each of the aforementioned The proportion of the predicted target area corresponding to the smallest bounding box.

在基于上述第一种或第二种或第三种可能的实施方式的第八种可能的实施方式中,上述分别对各上述分块图像进行目标检测包括:In an eighth possible implementation manner based on the above-mentioned first or second or third possible implementation manner, the above-mentioned performing target detection on each of the above-mentioned block images respectively includes:

基于第三预设模型,分别对各上述分块图像进行目标检测。Based on the third preset model, target detection is performed on each of the aforementioned block images.

由上可见,本申请的技术方案包括对原始图像进行特征信息提取,得到原始图像特征信息;基于原始图像特征信息,生成相应的密度图和分割图;基于分割图,确定原始图像中的目标区域,并基于目标区域和密度图,生成目标区域密度图;基于目标区域密度图,从原始图像中裁剪出与目标区域密度图相关的分块图像;分别对各分块图像进行目标检测,以输出各分块图像所对应的目标检测结果。基于本申请的技术方案,可先提取原始图像的分割图和密度图,并基于分割图对密度图作进一步删减,以提高目标区域密度图对原始图像中的目标的针对性,再基于目标区域密度图对原始图像进行裁剪,最后对各裁剪得到的分块图像进行目标检测以得到各目标检测结果,由于只对于目标区域密度图相关的分块图像进行目标检测,可有效排除原始图像中的噪声干扰,提高目标检测的准确性。It can be seen from the above that the technical solution of the present application includes extracting the feature information of the original image to obtain the feature information of the original image; generating the corresponding density map and segmentation map based on the feature information of the original image; determining the target area in the original image based on the segmentation map , and based on the target area and the density map, the target area density map is generated; based on the target area density map, the block images related to the target area density map are cut out from the original image; the target detection is performed on each block image to output The target detection results corresponding to each block image. Based on the technical solution of this application, the segmentation map and density map of the original image can be extracted first, and the density map can be further deleted based on the segmentation map to improve the pertinence of the target area density map to the target in the original image, and then based on the target The area density map cuts the original image, and finally performs target detection on each cropped block image to obtain each target detection result. Since the target detection is only performed on block images related to the target area density map, it can effectively exclude the original image. Noise interference, improve the accuracy of target detection.

实施例四Embodiment four

本申请还提供一种计算机可读存储介质,其上存有计算机程序,该计算机程序被执行时可以实现上述实施例所提供的步骤。具体的,该计算机程序包括计算机程序代码,上述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式中的一种,此处不作限定;该计算机可读存储介质可以为能够携带上述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-OnlyMemory)、随机存取存储器(RAM,RandomAccessMemory)、电载波信号、电信信号以及软件分发介质中的一种,此处不作限定。需要说明的是,上述计算机可读存储介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减。The present application also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed, the steps provided in the above-mentioned embodiments can be realized. Specifically, the computer program includes computer program code, which may be in the form of source code, object code, executable file or some intermediate form, which is not limited here; the computer-readable storage medium may be Any entity or device capable of carrying the above computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-OnlyMemory), random access memory (RAM, RandomAccessMemory) , an electrical carrier signal, a telecommunication signal, and a software distribution medium, which are not limited herein. It should be noted that the content contained in the above computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction.

由上可见,本申请的技术方案包括对原始图像进行特征信息提取,得到原始图像特征信息;基于原始图像特征信息,生成相应的密度图和分割图;基于分割图,确定原始图像中的目标区域,并基于目标区域和密度图,生成目标区域密度图;基于目标区域密度图,从原始图像中裁剪出与目标区域密度图相关的分块图像;分别对各分块图像进行目标检测,以输出各分块图像所对应的目标检测结果。基于本申请的技术方案,可先提取原始图像的分割图和密度图,并基于分割图对密度图作进一步删减,以提高目标区域密度图对原始图像中的目标的针对性,再基于目标区域密度图对原始图像进行裁剪,最后对各裁剪得到的分块图像进行目标检测以得到各目标检测结果,由于只对于目标区域密度图相关的分块图像进行目标检测,可有效排除原始图像中的噪声干扰,提高目标检测的准确性。It can be seen from the above that the technical solution of the present application includes extracting the feature information of the original image to obtain the feature information of the original image; generating the corresponding density map and segmentation map based on the feature information of the original image; determining the target area in the original image based on the segmentation map , and based on the target area and the density map, the target area density map is generated; based on the target area density map, the block images related to the target area density map are cut out from the original image; the target detection is performed on each block image to output The target detection results corresponding to each block image. Based on the technical solution of this application, the segmentation map and density map of the original image can be extracted first, and the density map can be further deleted based on the segmentation map to improve the pertinence of the target area density map to the target in the original image, and then based on the target The area density map cuts the original image, and finally performs target detection on each cropped block image to obtain each target detection result. Since the target detection is only performed on block images related to the target area density map, it can effectively exclude the original image. Noise interference, improve the accuracy of target detection.

对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本发明。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其它实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将上述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述系统中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used for illustration. In practical applications, the above-mentioned functions can be assigned to different functional units, Module completion means that the internal structure of the above-mentioned device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment may be integrated into one processing unit, or each unit may exist separately physically, or two or more units may be integrated into one unit, and the above-mentioned integrated units may adopt hardware It can also be implemented in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the present application. For the specific working processes of the units and modules in the above system, reference may be made to the corresponding processes in the aforementioned method embodiments, and details will not be repeated here.

需要说明的是,上述实施例所提供的方法及其细节举例可结合至实施例提供的装置和设备中,相互参照,不再赘述。It should be noted that the methods provided in the above embodiments and their detailed examples can be combined into the devices and equipment provided in the embodiments, refer to each other, and will not be repeated here.

本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各实例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟是以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同的方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those skilled in the art can appreciate that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present application.

在本申请所提供的实施例中,应该理解到,所揭露的装置/终端设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/设备实施例仅仅是示意性的,例如,上述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以由另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。In the embodiments provided in this application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the device/device embodiments described above are only illustrative. For example, the division of the above modules or units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components May be combined or may be integrated into another system, or some features may be omitted, or not implemented.

上述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The foregoing embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: it can still be described in the foregoing embodiments Modifications to the technical solutions recorded, or equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of each embodiment of the application, and should be included in this application. within the scope of protection.

Claims (8)

1. A method of detecting an object, comprising:
extracting feature information of the original image to obtain feature information of the original image;
generating a corresponding density map and a corresponding segmentation map based on the original image characteristic information;
determining a target area in the original image based on the segmentation map, and generating a target area density map based on the target area and the density map, wherein the target area is an area formed by points with brightness values larger than a first preset value in the segmentation map, and the target area density map is a density map only containing density information of the target area;
Based on the target area density map, cutting out a block image related to the target area density map from the original image;
performing target detection on each segmented image respectively to output a target detection result corresponding to each segmented image;
the clipping the segmented image related to the target region density map from the original image based on the target region density map comprises:
generating a minimum bounding box for bounding a density connected region in the target region density map based on the target region density map, wherein the density connected region is a region formed by connected points with a density value larger than a second preset value;
obtaining a predicted target area occupation ratio corresponding to each minimum bounding box based on each minimum bounding box, the target area density map and the original image, wherein the predicted target area occupation ratio is an average value of the proportion of the area of each predicted target to the total area of a mapping area of the corresponding minimum bounding box on the original image;
based on the size relation between the predicted target area ratio and the preset standard ratio, carrying out scale adjustment on each minimum bounding box so that the difference between the predicted target area ratio of each adjusted minimum bounding box and the standard ratio is smaller than the difference between the predicted target area ratio of the minimum bounding box before adjustment and the standard ratio;
Clipping the original image based on the position of each adjusted minimum bounding box mapped on the original image to obtain more than one block image corresponding to each adjusted minimum bounding box one by one;
and scaling each minimum bounding box based on the size relation between each predicted target area duty ratio and a preset standard duty ratio, so that the difference between the predicted target area duty ratio of each adjusted minimum bounding box and the standard duty ratio is smaller than the difference between the predicted target area duty ratio of the minimum bounding box and the standard duty ratio before adjustment, wherein the step of scaling each minimum bounding box comprises the following steps:
calculating the ratio of the predicted target area occupation ratio of each minimum bounding box to the standard occupation ratio respectively;
if a first type bounding box exists, increasing the scale of the first type bounding box so that the difference between the predicted target area occupation ratio of each adjusted first type bounding box and the standard occupation ratio is smaller than the difference between the predicted target area occupation ratio of the minimum bounding box before adjustment and the standard occupation ratio, wherein the first type bounding box is the minimum bounding box in each minimum bounding box, and the ratio of the minimum bounding box is larger than a third preset value;
if a second type bounding box exists, reducing the scale of the second type bounding box, and/or dividing the second type bounding box into more than two minimum bounding boxes, so that the difference between the predicted target area occupation ratio of each adjusted second type bounding box and the standard occupation ratio is smaller than the difference between the predicted target area occupation ratio of the minimum bounding box before adjustment and the standard occupation ratio, wherein the second type bounding box is the minimum bounding box with the ratio smaller than a fourth preset value in each minimum bounding box;
Wherein the third preset value is not less than the fourth preset value.
2. The target detection method according to claim 1, wherein after the generating of the minimum bounding box for bounding a density connected region in the target region density map based on the target region density map, the target detection method further comprises:
and merging the two minimum bounding boxes with the distance smaller than the preset distance in the minimum bounding boxes to form a minimum bounding box for surrounding the density communication area of the two minimum bounding boxes with the distance smaller than the preset distance.
3. The object detection method according to claim 1, wherein after said object detection is performed on each of the block images, the object detection method further comprises:
and merging the target detection results based on a non-maximum suppression algorithm to obtain the target detection result of the original image.
4. The method of claim 1, wherein extracting feature information of the original image to obtain feature information of the original image, and generating the corresponding density map and segmentation map based on the feature information of the original image comprises:
And extracting characteristic information of the original image based on the first preset model, and generating a corresponding density map and a corresponding segmentation map.
5. The method of claim 1, wherein obtaining a predicted target area occupation ratio corresponding to each minimum bounding box based on each minimum bounding box, the target area density map, and the original image comprises:
determining the area of each minimum bounding box, the sum of density values in each minimum bounding box and the area of a density communication area in each minimum bounding box based on the target area density map and each minimum bounding box;
and obtaining a predicted target area occupation ratio corresponding to each minimum bounding box based on a second preset model, the area of each minimum bounding box, the sum of density values in each minimum bounding box, the area of a density communication area in each minimum bounding box and the total area of the original image.
6. The method according to claim 1, wherein the performing object detection on each of the block images respectively includes:
and respectively carrying out target detection on each segmented image based on a third preset model.
7. An object detection apparatus, comprising:
the extraction unit is used for extracting the characteristic information of the original image to obtain the characteristic information of the original image;
the first generation unit is used for generating a corresponding density map and a corresponding segmentation map based on the original image characteristic information;
a second generating unit, configured to determine a target area in the original image based on the segmentation map, and generate a target area density map based on the target area and the density map, where the target area is an area formed by points in the segmentation map where a luminance value is greater than a first preset value, and the target area density map is a density map that only includes density information of the target area;
a clipping unit, configured to clip a segmented image related to the target area density map from the original image based on the target area density map;
the target detection unit is used for respectively carrying out target detection on each segmented image so as to output a target detection result corresponding to each segmented image;
the clipping unit is specifically configured to generate, based on the target area density map, a minimum bounding box for bounding a density connected area in the target area density map, where the density connected area is an area formed by connected points with a density value greater than a second preset value;
Obtaining a predicted target area occupation ratio corresponding to each minimum bounding box based on each minimum bounding box, the target area density map and the original image, wherein the predicted target area occupation ratio is an average value of the proportion of the area of each predicted target to the total area of a mapping area of the corresponding minimum bounding box on the original image;
based on the size relation between the predicted target area ratio and the preset standard ratio, carrying out scale adjustment on each minimum bounding box so that the difference between the predicted target area ratio of each adjusted minimum bounding box and the standard ratio is smaller than the difference between the predicted target area ratio of the minimum bounding box before adjustment and the standard ratio;
clipping the original image based on the position of each adjusted minimum bounding box mapped on the original image to obtain more than one block image corresponding to each adjusted minimum bounding box one by one;
the clipping unit is specifically further configured to calculate a ratio of a predicted target area occupation ratio of each minimum bounding box to the standard occupation ratio;
if a first type bounding box exists, increasing the scale of the first type bounding box so that the difference between the predicted target area occupation ratio of each adjusted first type bounding box and the standard occupation ratio is smaller than the difference between the predicted target area occupation ratio of the minimum bounding box before adjustment and the standard occupation ratio, wherein the first type bounding box is the minimum bounding box in each minimum bounding box, and the ratio of the minimum bounding box is larger than a third preset value;
If a second type bounding box exists, reducing the scale of the second type bounding box, and/or dividing the second type bounding box into more than two minimum bounding boxes, so that the difference between the predicted target area occupation ratio of each adjusted second type bounding box and the standard occupation ratio is smaller than the difference between the predicted target area occupation ratio of the minimum bounding box before adjustment and the standard occupation ratio, wherein the second type bounding box is the minimum bounding box with the ratio smaller than a fourth preset value in each minimum bounding box;
wherein the third preset value is not less than the fourth preset value.
8. An object detection device comprising a memory and a processor, the memory storing a computer program, the processor implementing the steps of the method according to any one of claims 1 to 6 when the computer program is executed.
CN202011510824.5A 2020-12-18 2020-12-18 A target detection method and related device Active CN112488118B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011510824.5A CN112488118B (en) 2020-12-18 2020-12-18 A target detection method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011510824.5A CN112488118B (en) 2020-12-18 2020-12-18 A target detection method and related device

Publications (2)

Publication Number Publication Date
CN112488118A CN112488118A (en) 2021-03-12
CN112488118B true CN112488118B (en) 2023-08-08

Family

ID=74914867

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011510824.5A Active CN112488118B (en) 2020-12-18 2020-12-18 A target detection method and related device

Country Status (1)

Country Link
CN (1) CN112488118B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116630609B (en) * 2022-02-08 2025-04-15 腾讯科技(深圳)有限公司 Image object detection method and device
CN118447042B (en) * 2024-07-05 2025-07-11 杭州阿里巴巴海外互联网产业有限公司 Picture processing method and system, online wearing system and electronic equipment
CN119027967B (en) * 2024-10-31 2025-02-14 吉林大学 Ancient book image detection method and system based on density map

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019000653A1 (en) * 2017-06-30 2019-01-03 清华大学深圳研究生院 Image target identification method and apparatus
WO2019071976A1 (en) * 2017-10-12 2019-04-18 北京大学深圳研究生院 Panoramic image saliency detection method based on regional growth and eye movement model
CN109740571A (en) * 2019-01-22 2019-05-10 南京旷云科技有限公司 The method of Image Acquisition, the method, apparatus of image procossing and electronic equipment
CN110148192A (en) * 2019-04-18 2019-08-20 上海联影智能医疗科技有限公司 Medical image imaging method, device, computer equipment and storage medium
CN111241947A (en) * 2019-12-31 2020-06-05 深圳奇迹智慧网络有限公司 Training method and device of target detection model, storage medium and computer equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019000653A1 (en) * 2017-06-30 2019-01-03 清华大学深圳研究生院 Image target identification method and apparatus
WO2019071976A1 (en) * 2017-10-12 2019-04-18 北京大学深圳研究生院 Panoramic image saliency detection method based on regional growth and eye movement model
CN109740571A (en) * 2019-01-22 2019-05-10 南京旷云科技有限公司 The method of Image Acquisition, the method, apparatus of image procossing and electronic equipment
CN110148192A (en) * 2019-04-18 2019-08-20 上海联影智能医疗科技有限公司 Medical image imaging method, device, computer equipment and storage medium
CN111241947A (en) * 2019-12-31 2020-06-05 深圳奇迹智慧网络有限公司 Training method and device of target detection model, storage medium and computer equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于区域边界最优映射的图像分割算法;赵婕;张春美;张小勇;姚峰林;;计算机应用研究(01);第313-316页 *

Also Published As

Publication number Publication date
CN112488118A (en) 2021-03-12

Similar Documents

Publication Publication Date Title
CN112488118B (en) A target detection method and related device
CN111709420B (en) Text detection method, electronic device and computer readable medium
CN110069961B (en) Object detection method and device
CN111932577B (en) Text detection method, electronic device and computer readable medium
CN110633594A (en) Target detection method and device
CN115563522B (en) Clustering method, device, equipment and medium of traffic data
CN114241411B (en) Counting model processing method and device based on target detection and computer equipment
CN113792789B (en) Method and system for image tampering detection and location based on class activation heat map
CN109033148A (en) One kind is towards polytypic unbalanced data preprocess method, device and equipment
CN110232381A (en) License Plate Segmentation method, apparatus, computer equipment and computer readable storage medium
CN115205717B (en) Obstacle point cloud data processing method and flight equipment
Meena et al. Image splicing forgery detection using noise level estimation
JP2024525151A (en) Image quality adjustment method, device, equipment, and medium
CN113298122B (en) Target detection method and device and electronic equipment
CN112132215B (en) Method, device and computer readable storage medium for identifying object type
CN110874843B (en) Organ image segmentation method and device
CN111062388B (en) Advertisement character recognition method, system, medium and equipment based on deep learning
WO2024174726A1 (en) Handwritten and printed text detection method and device based on deep learning
CN115880293B (en) Pathological image recognition method, device and medium for lymph node metastasis of bladder cancer
TW202133041A (en) A method, a device for extracting features of fingerprint images and computer-readable storage medium
CN115082709B (en) Remote sensing big data processing method, system and cloud platform
CN117315406A (en) Sample image processing method, device and equipment
CN111401317B (en) Video classification method, device, equipment and storage medium
CN112036501A (en) Image similarity detection method based on convolutional neural network and related equipment thereof
CN114677769B (en) Method and device for identifying flipping certificate, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant