CN110766644A - Image down-sampling method and device - Google Patents

Image down-sampling method and device Download PDF

Info

Publication number
CN110766644A
CN110766644A CN201810845244.8A CN201810845244A CN110766644A CN 110766644 A CN110766644 A CN 110766644A CN 201810845244 A CN201810845244 A CN 201810845244A CN 110766644 A CN110766644 A CN 110766644A
Authority
CN
China
Prior art keywords
image
detected
detection result
target
sampling
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.)
Granted
Application number
CN201810845244.8A
Other languages
Chinese (zh)
Other versions
CN110766644B (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.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital Technology Co Ltd
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 Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201810845244.8A priority Critical patent/CN110766644B/en
Publication of CN110766644A publication Critical patent/CN110766644A/en
Application granted granted Critical
Publication of CN110766644B publication Critical patent/CN110766644B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

The embodiment of the application provides an image down-sampling method, which comprises the following steps: acquiring an image to be detected; determining one or more regions to be detected in an image to be detected; determining the down-sampling multiple of each region to be detected as a first down-sampling multiple; and performing down-sampling on each region to be detected according to the determined first down-sampling multiple to obtain a first down-sampled image corresponding to each region to be detected. By applying the method, the down-sampling multiple of the area to be detected can be controlled in a targeted manner. If the resolution of the target in a certain area to be detected is low, then, when the area to be detected is subjected to down-sampling processing, a low down-sampling multiple can be adopted, so that the resolution of the target in the area to be detected meets the requirement of the lowest resolution threshold of the target detection algorithm, and thus, the phenomenon that the resolution value of the target in the area to be detected after down-sampling is lower than the lowest resolution threshold of the target detection algorithm can be reduced, and the detection rate of target detection is improved.

Description

Image down-sampling method and device
Technical Field
The present application relates to the field of image processing technologies, and in particular, to an image downsampling method and apparatus.
Background
When detecting an image for a target, it is generally necessary to down-sample the image in order to reduce the amount of computation. Existing downsampling schemes generally include: determining the down-sampling multiple k of the image, and converting the resolution of the image into a resolution of W × H
Figure BDA0001746476160000011
A down-sampled image is obtained.
However, in this down-sampling scheme, if the resolution of the target itself is low, after the down-sampling processing is performed on the region where the target is located in the image, the resolution of the target is lower than the minimum resolution threshold that can be detected by the target detection algorithm, and thus the target cannot be detected.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method and an apparatus for detecting a target, so as to solve the above technical problems.
The specific technical scheme is as follows:
the embodiment of the application provides an image down-sampling method, which comprises the following steps:
acquiring an image to be detected;
determining one or more regions to be detected in the image to be detected;
determining the down-sampling multiple of each region to be detected as a first down-sampling multiple;
and performing down-sampling on each region to be detected according to the determined first down-sampling multiple to obtain a first down-sampled image corresponding to each region to be detected.
Optionally, after obtaining the first downsampled image corresponding to each to-be-detected region, the method further includes:
and performing target detection on the first downsampled image corresponding to each to-be-detected area to obtain a target detection result of the to-be-detected image.
Optionally, after the acquiring the image to be detected, the method further includes:
determining a down-sampling multiple of the image to be detected as a second down-sampling multiple;
according to the determined second down-sampling multiple, down-sampling the image to be detected to obtain a second down-sampled image corresponding to the image to be detected;
after obtaining the first downsampled image corresponding to each region to be detected, the method further includes:
and carrying out target detection on the first downsampling image and the second downsampling image to obtain a target detection result of the image to be detected.
Optionally, the performing target detection on the first downsampled image and the second downsampled image to obtain a target detection result of the image to be detected includes:
performing target detection on the first downsampled image to obtain a first detection result;
performing target detection on the second downsampled image to obtain a second detection result;
and performing duplicate removal processing on the first detection result and the second detection result to obtain a target detection result of the image to be detected.
Optionally, the performing duplicate removal processing on the first detection result and the second detection result includes:
and judging whether the target frame in the first detection result and the target frame in any second detection result meet preset coincidence conditions or not according to each first detection result, and deleting the first detection result if the target frame in the first detection result and the target frame in any second detection result meet the preset coincidence conditions.
Optionally, the performing target detection on the first downsampled image and the second downsampled image to obtain a target detection result of the image to be detected includes:
splicing the second downsampled image and each first downsampled image to obtain a spliced image;
and carrying out target detection on the spliced image to obtain a target detection result of the image to be detected.
Optionally, determining one or more regions to be detected in the image to be detected includes:
uniformly dividing the image to be detected into M sub-regions according to a first preset direction, and determining one or more regions to be detected from the M sub-regions; wherein M is a positive integer greater than 1;
the determining the down-sampling multiple of each region to be detected as the first down-sampling multiple includes:
determining a down-sampling multiple N of the one or more regions to be detected, wherein N is a positive integer greater than 1;
the determining of the down-sampling multiple of the image to be detected as a second down-sampling multiple comprises the following steps:
determining the down-sampling multiple MXN of the image to be detected according to the down-sampling multiple N of the one or more regions to be detected;
the stitching the second downsampled image and each first downsampled image to obtain a stitched image includes:
and sequentially splicing the second downsampled image and each first downsampled image according to the first preset direction to obtain a spliced image.
Optionally, the target detection is performed on the stitched image to obtain a target detection result of the image to be detected, including:
determining a first detection result corresponding to the first downsampled image and a second detection result corresponding to the second downsampled image in the target detection results of the spliced image;
converting the coordinate of the first detection result in the spliced image into the coordinate of the first detection result in the image to be detected according to the first down-sampling multiple of the area to be detected;
converting the coordinates of the second detection result in the spliced image into the coordinates of the second detection result in the image to be detected according to the second down-sampling multiple of the image to be detected;
and according to the coordinates of the first detection result and the second detection result in the image to be detected, carrying out duplicate removal processing on the first detection result and the second detection result to obtain a target detection result of the image to be detected.
Optionally, determining, in the target detection results of the stitched image, a first detection result corresponding to the first downsampled image and a second detection result corresponding to the second downsampled image includes:
determining a position interval of the second downsampled image in the spliced image;
and judging whether the target detection result of the spliced image is in the position interval or not according to the coordinate of the target detection result of each spliced image, if so, taking the target detection result of the spliced image as the second detection result, and if not, taking the target detection result of the spliced image as the first detection result.
An embodiment of the present application further provides an image downsampling apparatus, the apparatus includes:
the image acquisition module is used for acquiring an image to be detected;
the area determining module is used for determining one or more areas to be detected in the image to be detected;
the down-sampling multiple determining module is used for determining the down-sampling multiple of each region to be detected as a first down-sampling multiple;
and the down-sampling processing module is used for down-sampling each region to be detected according to the determined first down-sampling multiple to obtain a first down-sampled image corresponding to each region to be detected.
Optionally, the apparatus further comprises:
and the area detection module is used for carrying out target detection on the first downsampled image corresponding to each area to be detected to obtain a target detection result of the image to be detected.
Optionally, the down-sampling multiple determining module is further configured to determine a down-sampling multiple of the image to be detected, where the down-sampling multiple is used as a second down-sampling multiple;
the downsampling processing module is further used for downsampling the image to be detected according to the determined second downsampling multiple to obtain a second downsampled image corresponding to the image to be detected;
the device further comprises:
and the target detection module is used for carrying out target detection on the first downsampling image and the second downsampling image to obtain a target detection result of the image to be detected.
Optionally, the target detection module includes:
the first detection submodule is used for carrying out target detection on the first downsampled image to obtain a first detection result;
the second detection submodule is used for carrying out target detection on the second downsampled image to obtain a second detection result;
and the duplicate removal processing submodule is used for carrying out duplicate removal processing on the first detection result and the second detection result to obtain a target detection result of the image to be detected.
Optionally, the duplicate removal processing sub-module is specifically configured to:
and judging whether the target frame in the first detection result and the target frame in any second detection result meet preset coincidence conditions or not according to each first detection result, and deleting the first detection result if the target frame in the first detection result and the target frame in any second detection result meet the preset coincidence conditions.
Optionally, the target detection module includes:
the splicing submodule is used for splicing the second downsampled image and each first downsampled image to obtain a spliced image;
and the spliced image detection submodule is used for carrying out target detection on the spliced image to obtain a target detection result of the image to be detected.
Optionally, the region determining module is specifically configured to uniformly divide the image to be detected into M sub-regions according to a first preset direction, and determine one or more regions to be detected from the M sub-regions; wherein M is a positive integer greater than 1;
the down-sampling multiple determining module is specifically configured to determine a down-sampling multiple N of the one or more regions to be detected, where N is a positive integer greater than 1; determining the down-sampling multiple MXN of the image to be detected according to the down-sampling multiple N of the one or more regions to be detected;
and the splicing submodule is specifically configured to splice the second downsampled image and each first downsampled image in sequence according to the first preset direction to obtain a spliced image.
Optionally, the mosaic image detection sub-module includes:
a detection result separation unit, configured to determine, in the target detection results of the stitched image, a first detection result corresponding to the first downsampled image and a second detection result corresponding to the second downsampled image;
the coordinate conversion unit is used for converting the coordinate of the first detection result in the spliced image into the coordinate of the first detection result in the image to be detected according to the first down-sampling multiple of the area to be detected; converting the coordinates of the second detection result in the spliced image into the coordinates of the second detection result in the image to be detected according to the second down-sampling multiple of the image to be detected;
and the detection result duplicate removal unit is used for removing the duplicate of the first detection result and the second detection result according to the coordinates of the first detection result and the second detection result in the image to be detected to obtain the target detection result of the image to be detected.
Optionally, the detection result separation unit is specifically configured to:
determining a position interval of the second downsampled image in the spliced image;
and judging whether the target detection result of the spliced image is in the position interval or not according to the coordinate of the target detection result of each spliced image, if so, taking the target detection result of the spliced image as the second detection result, and if not, taking the target detection result of the spliced image as the first detection result.
The embodiment of the application also provides electronic equipment which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
and a processor for implementing any of the image down-sampling methods described above when executing the program stored in the memory.
An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the computer program implements any one of the image downsampling methods described above.
Embodiments of the present application further provide a computer program product containing instructions, which when run on a computer, cause the computer to perform any one of the image downsampling methods described above.
According to the image downsampling method and device provided by the embodiment of the application, one or more areas to be detected and the downsampling multiple of each area to be detected are determined in the image to be detected, each area to be detected is downsampled according to the determined downsampling multiple, the downsampling image corresponding to each area to be detected is obtained and serves as the first downsampling image, and the downsampling multiple of the area to be detected can be controlled in a targeted mode. If the resolution of the target in a certain area to be detected is low, then, when the area to be detected is subjected to down-sampling processing, a low down-sampling multiple can be adopted, so that the resolution of the target in the area to be detected meets the requirement of the lowest resolution threshold of the target detection algorithm, and thus, the phenomenon that the resolution value of the target in the area to be detected after down-sampling is lower than the lowest resolution threshold of the target detection algorithm can be reduced, and the detection rate of target detection is improved. Of course, not all advantages described above need to be achieved at the same time in the practice of any one product or method of the present application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of an image downsampling method according to an embodiment of the present disclosure;
FIG. 2 is a schematic view of a process of downsampling and stitching an image to be detected;
fig. 3(a) and 3(b) are schematic diagrams for determining a region to be detected from an image to be detected;
FIG. 4 is a schematic diagram of stitching an image to be detected and an area to be detected in one implementation;
FIG. 5 is a schematic view of a process of separating, coordinate restoring and de-duplicating a target detection result in a coordinate system of a stitched image;
FIG. 6 is a schematic diagram of the coincidence and non-coincidence of target frames of the target detection result;
fig. 7 is a first flowchart of an image down-sampling method according to an embodiment of the present application;
fig. 8 is a schematic flowchart of a second image downsampling method according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of an image down-sampling apparatus according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms of the present application are explained as follows:
down-sampling: the sampling points in the image are reduced so that the image resolution becomes smaller.
Target detection: and detecting the target in the image by using a target detection algorithm to obtain a detection result.
RCNN: regions Convolutional Neural Network, RCNN, is an object detection algorithm.
FRCNN: fast Region conditional Neural Network, Fast Region Convolutional Neural Network, FRCNN, is a modified version of RCNN.
FasterRCNN: faster regional Convolutional Neural networks, fastern rcnn is a modified version of FRCNN.
SSD: single Shot MultiBox Detector, Single deep neural network Detector.
In some cases, it is often necessary to perform processing such as object detection, object recognition, and the like on an image. In the image processing process, algorithms such as RCNN, FRCNN, fasternn, SSD, etc. are often used, and the calculation process of these algorithms is complicated, so that the amount of calculation for image processing is very large, which may affect the real-time performance of image processing.
Therefore, the image can be down-sampled to reduce the resolution of the image, and then the obtained image with lower resolution is processed, so that the calculation amount of image processing is reduced.
In the related art, the image is usually directly downsampled according to a uniform downsampling multiple, and if targets with lower resolution exist in the image, the resolution of the targets is lower than a minimum resolution threshold value which can be detected by a target detection algorithm after downsampling processing is performed on the areas where the targets are located, so that the targets cannot be detected.
Fig. 1 is a schematic flow chart provided in the embodiment of the present application.
S101, acquiring an image to be detected, wherein the image to be detected refers to an image needing target detection, such as a video monitoring image.
And S102, performing down-sampling and splicing on the image to be detected. Determining different areas to be detected from the images to be detected, then performing down-sampling on the images to be detected and the areas to be detected according to different down-sampling multiples, and splicing the down-sampled images to be detected and the areas to be detected to obtain spliced images.
Specifically, as shown in fig. 2, downsampling and stitching an image to be detected includes the following operation steps.
S201, determining a region to be detected. The image to be detected is divided into m (m is a positive integer greater than 1) regions, as shown in fig. 3(a), where the size of m depends on the division manner, for example, the image to be detected can be divided into three regions, i.e., a small target, a medium target, and a large target, according to the resolution of the target in the image to be detected, where m is 3, or can also be uniformly divided into an upper half region and a lower half region according to the height of the image to be detected, where m is 2, or can be other various division manners, which are not listed here one by one. Further, one or more of the regions may be selected as the region to be detected.
For example, as shown in fig. 3(b), 2 regions, which are uniformly divided into 1 st region and 2 nd region according to the height of the image to be detected, are adopted, that is, m is 2, the image width of both regions is w, the height is h/2, and the 1 st region is selected as the region to be detected.
S202, performing n-time down-sampling on the area to be detected. The down-sampling algorithm may be an algorithm such as nearest neighbor interpolation, bilinear interpolation, and the like, and is not particularly limited. The down-sampling multiple is n (n is greater than 1), and the larger n is, the larger the down-sampling multiple is, the smaller the down-sampled image is, and n can be set according to actual needs, and in the application, n is 2. For example, if the pixel width of the region to be detected is x and the pixel height is y, the width of the first down-sampled image obtained by down-sampling n times is x/n and the height is y/n.
And S203, performing 2 n-time down-sampling on the image to be detected, and performing 2 n-time down-sampling on the image to be detected by adopting the method in the S202.
S204, a first down-sampled image is obtained through S202. S201 shows that the width of the region to be detected is w, the height of the region to be detected is h/2, the width of a first down-sampled image obtained after n times of down-sampling is w/n, and the height of the first down-sampled image is h/2 n.
S205, a second down-sampled image is obtained through S203. The width of the image to be detected is w, the height of the image to be detected is h, the width of a second down-sampled image obtained after 2n times of down-sampling is performed is w/2n, and the height of the second down-sampled image is h/2 n.
And S206, performing image splicing operation. And splicing the first downsampled image obtained in the step S204 and the second downsampled image obtained in the step S205, where the splicing mode may be left-right splicing, and the second downsampled image on the left side of the first downsampled image may be on the right side, or the second downsampled image on the right side of the first downsampled image may be on the left side, and in this application, the latter is adopted, as shown in fig. 4, the second downsampled image is on the left side, and the first downsampled image is on the right side.
And S207, obtaining a spliced image. And obtaining a spliced image after splicing, wherein the width of the image is w/2n + w/n, and the height of the image is h/2 n.
And S103, carrying out target detection on the spliced image.
And performing target detection on the spliced image by adopting a target detection algorithm, such as RCNN, FRCNN, FasterRCNN, SSD and other algorithms to obtain a target detection result. The target detection result includes a target frame of the target, and may also include other results, such as a foreground segmentation map of the target, a target color, a target category, a target character recognition result (e.g., a license plate), and the like.
For example, people and vehicles in the stitched image are detected, target frames of the people and the vehicles in the stitched image can be obtained, and coordinates of the target frames are represented as (x, y, w, h), wherein x represents an x-axis coordinate value at the upper left corner of the target frame, y represents a y-axis coordinate value at the upper left corner of the target frame, w represents the width of the target frame, and h represents the height of the target frame. The value ranges of the coordinate values of the target frame output by different detection algorithms may be different, and some outputs are actual coordinates (actual pixel number) (x)i,yi,wi,hi) I.e. xi,yi,wi,hiIs a positive integer greater than 1, and some outputs are normalized coordinates (x)f,yf,wf,hf) I.e. xf,yf,wf,hfA fraction greater than 0 and less than 1. For an image with width w and height h, the conversion relationship between the normalized coordinates and the actual coordinates is as follows: x is the number off=xi/w,yf=yi/h,wf=wi/w,hf=hi/h。
For convenience of description, in the embodiment of the present application, normalized coordinates (x) are usedf,yf,wf,hf)。
And S104, separating, restoring coordinates and removing the duplicate of the target detection result under the coordinate system of the spliced image.
In S103, target detection is directly performed on the stitched image, and the stitched image is composed of a first downsampled image and a second downsampled image, where the first downsampled image and the second downsampled image are obtained by downsampling the to-be-detected region and the to-be-detected image, and the to-be-detected region and the to-be-detected image are overlapped, so that a target detection result is also overlapped, and deduplication processing is required.
In addition, the coordinates of the target frame in the target detection result are coordinates in the coordinate system of the stitched image, and are different from the coordinate system of the image to be detected, so that the coordinates of the target detection result need to be restored.
The specific process of S104 is shown in fig. 5, and includes the following steps:
s501, obtaining a detection result linked list under a spliced image coordinate system.
Since the stitched image has a plurality of objects such as people and vehicles, a plurality of object detection results in the coordinate system of the stitched image are also called as a detection result linked list.
And S502, splitting a detection result linked list of the spliced image.
And the coordinates of the target frame in the detection result linked list of the spliced image are expressed as normalized coordinates. According to x in each detection resultfThe value of (a) splits the stitched image target detection result linked list into a second detection result linked list corresponding to the second downsampled image and a first detection result linked list corresponding to the first downsampled image, wherein x isfThe x-axis coordinate of the upper left corner of the target box. Specifically, the splitting mode is as follows:
Figure BDA0001746476160000111
i.e. xfSplitting of detection results for < T of those stitched imagesAnd in the second detection result linked list, the detection results of the spliced images which do not meet the condition are split into the first detection result linked list. In fig. 5, the stitched image is w/2n + w/n, and the second downsampled image occupies the left side 1/3 of the stitched image, so that T is 1/3.
And traversing all the detection results in the detection result linked list result under the whole spliced image coordinate system, and splitting according to the mode.
S503, a second detection result linked list is obtained through the step S502.
S504, a first detection result linked list is obtained through the step S502. .
And S505, mapping the second detection result linked list to the coordinate system of the image to be detected from the coordinate system of the spliced image.
The coordinate value of each detection result target frame in the second detection result linked list obtained in S503 is a value in the coordinate system of the stitched image, and needs to be converted into a value in the coordinate system of the image to be detected, and all detection results in the second detection result linked list result in the whole stitched image coordinate system are traversed for conversion.
S506, mapping the first detection result linked list to a coordinate system of the image to be detected from the coordinate system of the spliced image.
The coordinate value of each detection result target frame in the first detection result linked list obtained in S504 is a value in the coordinate system of the stitched image, and needs to be converted into a value in the coordinate system of the image to be detected, and all detection results in the first detection result linked list result in the whole stitched image coordinate system are traversed for conversion.
And S507, obtaining a second detection result linked list under the coordinate system of the image to be detected through S505.
And S508, obtaining a first detection result linked list under the coordinate system of the image to be detected through S506.
S509, respectively judging whether each target frame in the second detection result linked list is overlapped with each target frame in the first detection result linked list.
After the coordinate system conversion operation, the coordinate values of the second detection result and the coordinate values of the first detection result are mapped to the coordinate system of the image to be detected, so that the duplicate removal processing can be performed according to the position coincidence relation of the target frame. Fig. 6 shows a schematic diagram of the second detection result overlapping and not overlapping with the first detection result.
And traversing each detection result in the first detection result linked list, simultaneously traversing all the detection results in the second detection result linked list, judging whether a second detection result which is coincident with the first detection result exists, if not, turning to S510, otherwise, turning to S511.
And S510, adding the first detection result into a second detection result linked list.
S511, deleting the first detection result.
And S512, taking the second detection result linked list as a target detection result linked list of the image to be detected.
After the steps, the first detection result in the first detection result linked list which is not overlapped with the detection result in the second detection result linked list is merged into the second detection result, and the target detection result linked list of the image to be detected under the coordinate system of the image to be detected is obtained.
And S105, outputting a target detection result linked list of the image to be detected.
Therefore, the scheme can control the down-sampling multiple of the area to be detected in a targeted manner. If the resolution of the target in a certain area to be detected is low, then, when the area to be detected is subjected to down-sampling processing, a low down-sampling multiple can be adopted, so that the resolution of the target in the area to be detected meets the requirement of the lowest resolution threshold of the target detection algorithm, and thus, the phenomenon that the resolution value of the target in the area to be detected after down-sampling is lower than the lowest resolution threshold of the target detection algorithm can be reduced, and the detection rate of target detection is improved.
The embodiment of the application provides an image downsampling method and device, and the method and device can be applied to various electronic devices, such as a computer, a server, a smart camera and the like, and are not limited specifically.
Fig. 7 is a first flowchart of an image downsampling method according to an embodiment of the present application, including:
s701: and acquiring an image to be detected.
For example, the image to be detected may be from a video, for example, video frames are extracted from a monitoring video according to a certain period or number of frames, or may also be from a single image captured by an electronic device, which is not limited in this embodiment of the present application.
The image to be detected may include one or more targets, and there are various types of targets, such as pedestrians, vehicles, etc., which are not listed. The resolution of these objects is usually different, for example, if the image to be detected is a screenshot of a road surveillance video, then the resolution of distant vehicles and pedestrians will be lower and the resolution of nearby vehicles and pedestrians will be higher in the image to be detected.
S702: in the image to be detected, one or more regions to be detected are determined.
For example, the area with the smaller resolution of the target included in the image to be detected may be determined as the area to be detected according to the size of the resolution of the target in the different areas of the image to be detected, or the area which needs to be analyzed with emphasis may be determined as the area to be detected according to the different contents of the different areas in the image to be detected.
As another example, the region to be detected may be determined according to an instruction of the user. That is, the user determines the position of the region to be detected, for example, the user may perform visual observation on the image to be detected, and according to the observation result, designate a certain partial region with a low resolution of the target in the image to be detected as the region to be detected, or designate a region where the target to be accurately identified is located as the region to be detected, and the like.
Or, the area to be detected may also be determined by the electronic device according to a preset rule, for example, assuming that the image to be detected is an image in a section of road monitoring video, when down-sampling is performed, the electronic device may perform target detection on images of the first ten frames, and determine that some targets with lower resolution exist in a certain area in the image according to a detection result, and then may automatically use the certain area as the area to be detected, and so on.
The determined multiple regions to be detected can be spliced to obtain the whole image to be detected, or can be only spliced to obtain partial regions in the image to be detected, and each region to be detected can be in any shape and size.
In one implementation, as shown in fig. 3(a), the image to be detected may be divided into m regions from top to bottom, and the region to be detected is determined from the m regions, or as shown in fig. 3(b), the image to be detected may be divided into a 1 st region and a 2 nd region, and the region to be detected is determined from the two regions. In fig. 3(a) and 3(b), h represents the height of the image to be detected, and w represents the width of the image to be detected.
S703: and determining the down-sampling multiple of each region to be detected as a first down-sampling multiple.
After the regions to be detected are determined, the down-sampling multiple corresponding to each region to be detected can be further determined, and for convenience of description, the down-sampling multiple corresponding to each region to be detected is referred to as a first down-sampling multiple in the embodiment of the present application.
For example, a smaller first down-sampling multiple may be set for a region to be detected where a target with a smaller resolution is located, and a larger first down-sampling multiple may be set for a region to be detected where a target with a larger resolution is located; alternatively, a smaller first down-sampling multiple may be set for the region to be detected where the target with a higher degree of importance is located, and a larger first down-sampling multiple may be set for the region to be detected where the target with a lower degree of importance is located.
The specific numerical value of the first down-sampling multiple may be determined according to an instruction of a user, or may be determined by the electronic device through calculation, for example, assuming that the area to be detected is an image in a section of road monitoring video, when down-sampling is performed, the electronic device may perform target detection on the images of the first ten frames, determine several areas to be detected from the images to be detected according to a detection result, and then determine different first down-sampling multiples for each area to be detected according to different resolutions of targets in the different areas to be detected, so that the resolutions of the targets in each area to be detected after down-sampling processing are substantially the same, and a minimum threshold of a target detection algorithm is satisfied.
S704: and performing down-sampling on each region to be detected according to the determined first down-sampling multiple to obtain a first down-sampled image corresponding to each region to be detected.
After the first down-sampling multiple is determined, down-sampling can be performed on each region to be detected according to the first down-sampling multiple corresponding to each region to be detected, so as to obtain a down-sampled image of each region to be detected. For convenience of description, the down-sampled image of the region to be detected is referred to as a first down-sampled image in the embodiment of the present application.
If the first down-sampling multiple of a certain region to be detected is k and the resolution of the region to be detected is W × H, the specific down-sampling mode may be: acquiring sampling points every k rows and k columns from the area to be detected, and finally obtaining the resolution ratio of
Figure BDA0001746476160000141
The first down-sampled image of (1);
alternatively, the following may be used: dividing a region to be detected into a plurality of sub-regions with the size of k multiplied by k pixels, extracting a pixel point from each sub-region as a sampling point, and finally obtaining the resolution of
Figure BDA0001746476160000142
The first down-sampled image of (1);
alternatively, other down-sampling methods such as a nearest neighbor interpolation method and a bilinear interpolation method may also be used, which is not limited in this embodiment of the present application.
In an implementation manner, after the first downsampled image corresponding to each to-be-detected region is obtained, the target detection may be further performed on each first downsampled image to obtain a target detection result corresponding to each to-be-detected region, so as to obtain a target detection result of the to-be-detected image.
For example, the RCNN, FRCNN, FasterRCNN, SSD, or other algorithms may be used to perform target detection on the first downsampled region, where the detected target may be a person, a vehicle, an obstacle, or may also detect other results, such as a foreground segmentation map of the target, a target color, a target category, a target character recognition result (e.g., a license plate), and the like. In addition, the coordinate values of the target frames output by different detection algorithms may have different value ranges, some output is actual coordinates, that is, the number of actual pixels, and some output is normalized coordinates, that is, the value ranges of the coordinates are all larger than 0 and smaller than 1.
Further, in an implementation manner, in addition to performing downsampling on the area to be detected, downsampling may be performed on the full image to be detected to obtain a second downsampled image corresponding to the image to be detected. First, a second downsampling multiple of the image to be detected can be determined, and then, the image to be detected can be downsampled according to the determined second downsampling multiple, so that a second downsampled image corresponding to the image to be detected is obtained. For convenience of description, in the embodiment of the present application, the downsampling multiple of the image to be detected is referred to as a second downsampling multiple, and the downsampled image of the image to be detected is referred to as a second downsampled image.
When the target detection is carried out, the target detection can be carried out on the second down-sampling image, and then the target detection result of the image to be detected is obtained according to the first detection result of the first down-sampling image and the second detection result of the second down-sampling image.
For example, in one implementation manner, a region to which a target with a lower resolution in an image to be detected belongs may be used as the region to be detected, the region to be detected and the image to be detected are downsampled when the target is detected, and a first downsampling multiple corresponding to the region to be detected is set to be smaller than a second downsampling multiple.
For convenience of description, in the embodiment of the present application, a detection result obtained by performing target detection on the first down-sampled image is referred to as a first detection result, and a detection result obtained by performing target detection on the second down-sampled image is referred to as a second detection result.
Compared with the method that the target detection result of the image to be detected is directly obtained according to the first detection results of the plurality of areas to be detected, the target detection result of the image to be detected and the target detection result of the area to be detected are subjected to down-sampling, so that the phenomenon that the target is missed to be detected or is repeatedly detected can be reduced. Even if the same target is divided into different regions when determining the region to be detected, the target is not detected or is detected as two different targets.
Furthermore, when the target detection result of the image to be detected is obtained according to the first detection result and the second detection result, the first detection result obtained by performing the target detection on the first downsampling image and the second detection result obtained by performing the target detection on the second downsampling image can be subjected to deduplication processing, so that the target detection result repeatedly detected can be deleted at the overlapped part of the image to be detected and the area to be detected, and the obtained target detection result of the image to be detected is more definite.
In an implementation manner, it may be determined, for each first detection result, whether a target frame in the first detection result and a target frame in any second detection result satisfy a preset overlap condition, and if yes, the first detection result and the second detection result are considered to be the same target, and the first detection result is deleted, so that deduplication processing of the first detection result and the second detection result is implemented. As shown in FIG. 6, the left side is two object frames that overlap, and the right side is two object frames that do not overlap.
Or, it may be determined whether a second detection result similar to the coordinates of the first detection result exists directly according to the coordinates of each first detection result, and if so, the first detection result may be deleted.
Or, it can also be determined whether there is a second detection result with the same characteristics according to the identity of each first detection result, and if so, the first detection result is deleted.
In addition, after the second detection result which exists in the coincidence of the first detection result is judged, the second detection result can be deleted, the first detection result is reserved, or the first detection result and the second detection result are analyzed, and the more accurate one of the first detection result and the second detection result is selected.
As can be seen from the above, in the image downsampling method provided in the embodiment of the present application, one or more regions to be detected and the downsampling multiple of each region to be detected are determined in an image to be detected, and each region to be detected is downsampled according to the determined downsampling multiple, so that a downsampling image corresponding to each region to be detected is obtained and is used as a first downsampling image, and the downsampling multiple of the region to be detected can be controlled in a targeted manner. If the resolution of the target in a certain area to be detected is low, then, when the area to be detected is subjected to down-sampling processing, a low down-sampling multiple can be adopted, so that the resolution of the target in the area to be detected meets the requirement of the lowest resolution threshold of the target detection algorithm, and thus, the phenomenon that the resolution value of the target in the area to be detected after down-sampling is lower than the lowest resolution threshold of the target detection algorithm can be reduced, and the detection rate of target detection is improved.
Fig. 8 is a schematic flowchart of a second method for image down-sampling according to an embodiment of the present application, including:
s801: and acquiring an image to be detected.
For example, the image to be detected may be from a video, for example, video frames are extracted from a monitoring video according to a certain period or frame number, or may also be from a single image captured by an electronic device, which is not limited in this embodiment of the present application.
One or more objects may be included in the image to be detected, which objects are usually of different resolutions, for example, if the image to be detected is a screenshot of a road surveillance video, then in the image to be detected, the resolution of distant vehicles and pedestrians is low, and the resolution of nearby vehicles and pedestrians is high.
S802: in the image to be detected, one or more regions to be detected are determined.
For example, the area with the smaller resolution of the target included in the determined area can be used as the area to be detected according to the size of the resolution of the target in the different areas of the image to be detected, or the area to be detected which needs to be analyzed with emphasis can be determined according to the different contents of the different areas in the image to be detected and used as the area to be detected, and the like.
As another example, the region to be detected may be determined according to an instruction of the user. That is, the user determines the position of the region to be detected, for example, the user may perform visual observation on the image to be detected, and according to the observation result, designate a certain partial region with a low resolution of the target in the image to be detected as the region to be detected, or designate a region where the target to be accurately identified is located as the region to be detected, and the like.
Or, the area to be detected may also be determined by the electronic device according to a preset rule, for example, assuming that the image to be detected is an image in a section of road monitoring video, when down-sampling is performed, the electronic device may perform target detection on images of the first ten frames, and determine that some targets with lower resolution exist in a certain area in the image according to a detection result, and then may automatically use the certain area as the area to be detected, and so on.
The determined multiple regions to be detected can be spliced to obtain the whole image to be detected, or can be partial regions in the image to be detected, and each region to be detected can be in any shape and size.
S803: and determining the down-sampling multiple of each region to be detected as a first down-sampling multiple.
After the regions to be detected are determined, the down-sampling multiple corresponding to each region to be detected can be further determined, and for convenience of description, the down-sampling multiple corresponding to each region to be detected is referred to as a first down-sampling multiple in the embodiment of the present application.
For example, a smaller first down-sampling multiple may be set for a region to be detected where a target with a smaller resolution is located, and a larger first down-sampling multiple may be set for a region to be detected where a target with a larger resolution is located; alternatively, a smaller first down-sampling multiple may be set for the region to be detected where the target with a higher degree of importance is located, and a larger first down-sampling multiple may be set for the region to be detected where the target with a lower degree of importance is located.
The specific numerical value of the first down-sampling multiple may be determined according to an instruction of a user, or may be determined by the electronic device through calculation, for example, assuming that the area to be detected is an image in a section of road monitoring video, when down-sampling is performed, the electronic device may perform target detection on the images of the first ten frames, determine several areas to be detected from the images to be detected according to a detection result, and then determine different first down-sampling multiples for each area to be detected according to different resolutions of targets in the different areas to be detected, so that the resolutions of the targets in each area to be detected after down-sampling processing are substantially the same, and a minimum threshold of a target detection algorithm is satisfied.
S804: and performing down-sampling on each region to be detected according to the determined first down-sampling multiple to obtain a first down-sampled image corresponding to each region to be detected.
After the first down-sampling multiple is determined, down-sampling can be performed on each region to be detected according to the first down-sampling multiple corresponding to each region to be detected, so as to obtain a down-sampled image of each region to be detected. For convenience of description, the down-sampled image of the region to be detected is referred to as a first down-sampled image in the embodiment of the present application.
When each region to be detected is downsampled, assuming that the first downsampling multiple of a certain region to be detected is k, and the resolution of the region to be detected is W × H, then, when the first downsampling image and the second downsampling image are downsampled, the specific downsampling mode may be:
acquiring sampling points every k rows and k columns from the area to be detected, and finally obtaining the resolution ratio of
Figure BDA0001746476160000181
The first down-sampled image of (1);
alternatively, the following may be used: dividing a region to be detected into a plurality of sub-regions with the size of k multiplied by k pixels, extracting a pixel point from each sub-region as a sampling point, and finally obtaining the resolution of
Figure BDA0001746476160000182
The first down-sampled image of (1);
alternatively, other down-sampling manners may be adopted, which is not limited in this embodiment of the present application.
S805: and determining the down-sampling multiple of the image to be detected as a second down-sampling multiple.
S806: and performing down-sampling on the image to be detected according to the determined second down-sampling multiple to obtain a second down-sampled image corresponding to the image to be detected.
In the embodiment of the present application, the order of S805 to S806 and S803 to S804 is not limited. For convenience of description, in the embodiment of the present application, the downsampling multiple of the image to be detected is referred to as a second downsampling multiple, and the downsampled image of the image to be detected is referred to as a second downsampled image.
When the image to be detected is subjected to down sampling, the same mode as that when each region to be detected is subjected to down sampling can be adopted, and different modes can also be adopted, and the embodiment of the application does not limit the modes.
S807: and carrying out target detection on the first downsampling image and the second downsampling image to obtain a target detection result of the image to be detected.
Specifically, the target detection may be performed on the first downsampling region by using algorithms such as RCNN, FRCNN, fasterncnn, SSD, and the like, where the detected target may be a person, a vehicle, an obstacle, or may also detect other results, such as a foreground segmentation map of the target, a target color, a target category, a target character recognition result (e.g., a license plate), and the like. In addition, the coordinate values of the target frames output by different detection algorithms may have different value ranges, some output is actual coordinates, that is, the number of actual pixels, and some output is normalized coordinates, that is, the value ranges of the coordinates are all larger than 0 and smaller than 1.
In an implementation manner, when the target detection is performed, the target detection can be performed on the second downsampled image, and then the target detection result of the image to be detected is obtained according to the first detection result of the first downsampled image and the second detection result of the second downsampled image.
For example, in one implementation manner, a region to which a target with a lower resolution in an image to be detected belongs may be used as the region to be detected, the region to be detected and the image to be detected are downsampled when the target is detected, and a first downsampling multiple corresponding to the region to be detected is set to be smaller than a second downsampling multiple.
For convenience of description, in the embodiment of the present application, a detection result obtained by performing target detection on the first down-sampled image is referred to as a first detection result, and a detection result obtained by performing target detection on the second down-sampled image is referred to as a second detection result.
Compared with the method that the target detection result of the image to be detected is directly obtained according to the first detection results of the plurality of areas to be detected, the phenomenon that the target is missed to be detected or repeatedly detected can be reduced by performing down-sampling on the whole image of the image to be detected.
In one implementation, when the target detection result of the image to be detected is obtained according to the first detection result and the second detection result, the first detection result obtained by performing the target detection on the first downsampled image and the second detection result obtained by performing the target detection on the second downsampled image can be subjected to deduplication processing, so that the target detection result repeatedly detected can be deleted at the overlapped part of the image to be detected and the region to be detected, and the obtained target detection result of the image to be detected is more definite.
Specifically, it may be determined, for each first detection result, whether a target frame in the first detection result and a target frame in any second detection result satisfy a preset overlap condition, and if yes, the first detection result and the second detection result may be considered to be the same target, and the first detection result is deleted, so as to implement deduplication processing on the first detection result and the second detection result, or other deduplication processing manners may also be adopted, which is not limited in this embodiment of the application.
In one implementation, when the first downsampled image and the second downsampled image are subjected to target detection, the second downsampled image and each first downsampled image can be spliced to obtain a spliced image, and target detection is directly performed on the spliced image, so that a target detection result of an image to be detected is obtained. Therefore, when the electronic equipment detects the target, only one spliced image needs to be calculated, and the calculation times are reduced.
After the target detection is performed on the stitched images, a plurality of target detection results are usually obtained, and the target detection results of the stitched images may be represented as a set or a linked list.
In the foregoing implementation manner, further, when one or more regions to be detected are determined from the image to be detected, the image to be detected may be uniformly divided into M sub-regions according to a first preset direction, and one or more regions to be detected are determined from the obtained M sub-regions, where M is a positive integer greater than 1, and the first preset direction may be a horizontal direction or a longitudinal direction.
When determining the downsampling multiple of the image to be detected and each region to be detected, the downsampling multiple of the region to be detected can be uniformly determined as N (N is a positive integer greater than 1), and then the downsampling multiple of the image to be detected is determined as mxn.
Therefore, the lengths of the obtained first downsampled image and the second downsampled image are the same in the first preset direction, and when the first downsampled image and the second downsampled image are spliced in sequence according to the first preset direction, the obtained spliced images have uniform height or width, and subsequent calculation is facilitated.
For example, as shown in fig. 4: firstly, when a to-be-detected region is determined, transversely segmenting an image to be detected with the width of w and the height of h into 2 sub-regions uniformly, and taking the sub-region positioned above as the to-be-detected region, wherein the width of the to-be-detected region is w and the height of the to-be-detected region is h/2; then, when the down-sampling multiple is determined, determining the first down-sampling multiple as n, determining the second down-sampling multiple as 2n, and respectively obtaining a first down-sampling image and a second down-sampling image, wherein the width of the first down-sampling image is w/n, the height of the first down-sampling image is h/2n, the width of the first down-sampling image is w/2n, and the height of the first down-sampling image is h/2 n; when the first downsampling image and the second downsampling image are spliced, the height of the obtained spliced image is h/2n, and the width of the obtained spliced image is w/2n + w/n.
Further, after the target detection is performed on the spliced image, a first detection result corresponding to the first downsampling image and a second detection result corresponding to the second downsampling image can be determined in the target detection result of the spliced image, coordinates of the first detection result and the second detection result in the spliced image are converted into coordinates of the first detection result and the second detection result in the image to be detected according to the first downsampling multiple of the region to be detected and the second downsampling multiple of the image to be detected respectively, then, de-duplication processing can be performed on the first detection result and the second detection result according to the coordinates of the first detection result and the second detection result in the image to be detected, and the target detection result of the image to be detected is obtained.
The method for determining the first detection result corresponding to the first downsampling image and the second detection result corresponding to the second downsampling image from the target detection results of the stitched images may be that first, a position interval of the second downsampling image is determined in the stitched images, then, for the target detection result of each stitched image, according to coordinates of the target detection result of the stitched image, whether the target detection result of the stitched image is in the position interval to which the second downsampling image belongs is determined, if yes, the target detection result of the stitched image is the second detection result, and if not, the target detection result of the stitched image is the first detection result.
For example, continuing with the example shown in fig. 4, assuming that the image to be detected and the stitched image both adopt the normalized coordinates, the process of obtaining the target detection result of the image to be detected after performing the target detection on the stitched image shown in fig. 4 may be:
first, a first detection result corresponding to the first downsampled image and a second detection result corresponding to the second downsampled image can be determined from target detection results of the stitched image:
determining a position interval of a second downsampled image, wherein the position interval is an area of one third of the left side of a spliced image, if the origin of coordinates of the spliced image is set to be the upper left corner, the horizontal direction is an x axis, the vertical direction is a y axis, and the coordinate value of the rightmost side is 1, judging whether a target detection result of the spliced image is in the position interval of the second downsampled image according to the x-axis coordinate of the upper left corner of a target frame of the target detection result of the spliced image, if the x-axis coordinate of the upper left corner is smaller than 1/3, judging that the target detection result of the spliced image is a second detection result, and if the x-axis coordinate of the upper left corner is not smaller than 1/3, judging that the target detection result of the spliced image is a first detection result;
secondly, converting the coordinates of the first detection result and the second detection result in the spliced image into the coordinates of the first detection result and the second detection result in the image to be detected according to the first downsampling multiple of the area to be detected and the second downsampling multiple of the image to be detected respectively;
the specific conversion mode may be:
Figure BDA0001746476160000221
Figure BDA0001746476160000222
Figure BDA0001746476160000223
Figure BDA0001746476160000224
wherein
Figure BDA0001746476160000225
And
Figure BDA0001746476160000226
respectively representing the coordinate value of the x axis at the upper left corner, the coordinate value of the y axis at the upper left corner, the width and the height of the target frame of the first detection result in the coordinate system of the spliced image;
Figure BDA0001746476160000227
respectively representing the coordinate values of the upper left-hand x-axis and the upper left-hand y-axis of a target frame of a first image detection result in the coordinate system of the image to be detected, the width and the height;
Figure BDA0001746476160000228
Figure BDA0001746476160000229
Figure BDA00017464761600002210
Figure BDA00017464761600002211
wherein the content of the first and second substances,
Figure BDA00017464761600002212
and
Figure BDA00017464761600002213
respectively representing the width and the height of the coordinate value of the x axis at the upper left corner and the coordinate value of the y axis at the upper left corner of the target frame of the second detection result in the coordinate system of the spliced image;
Figure BDA00017464761600002214
and
Figure BDA00017464761600002215
respectively representing the coordinate value of the x axis at the upper left corner, the coordinate value of the y axis at the upper left corner, the width and the height of a target frame of a second detection result in the coordinate system of the image to be detected;
thirdly, performing duplicate removal processing on the first detection result and the second detection result according to the coordinates of the first detection result and the second detection result in the image to be detected;
the specific deduplication processing method may be as follows:
Figure BDA0001746476160000231
Figure BDA0001746476160000232
the abs represents an absolute value operation, whether the first detection result and any second detection result meet the formula is judged for each first detection result, if yes, the two detection results are judged to be coincident, and one of the two detection results can be deleted;
and after the duplicate removal treatment, obtaining a target detection result of the image to be detected.
As can be seen from the above, in the image downsampling method provided in the embodiment of the present application, one or more regions to be detected and the downsampling multiple of each region to be detected are determined in an image to be detected, and each region to be detected is downsampled according to the determined downsampling multiple, so that a downsampling image corresponding to each region to be detected is obtained and is used as a first downsampling image, and the downsampling multiple of the region to be detected can be controlled in a targeted manner. If the resolution of the target in a certain area to be detected is low, then, when the area to be detected is subjected to down-sampling processing, a low down-sampling multiple can be adopted, so that the resolution of the target in the area to be detected meets the requirement of the lowest resolution threshold of the target detection algorithm, and thus, the phenomenon that the resolution value of the target in the area to be detected after down-sampling is lower than the lowest resolution threshold of the target detection algorithm can be reduced, and the detection rate of target detection is improved.
As shown in fig. 9, an embodiment of the present application further provides a schematic structural diagram of an image downsampling apparatus, where the apparatus includes:
an image obtaining module 901, configured to obtain an image to be detected;
a region determining module 902, configured to determine one or more regions to be detected in the image to be detected;
a down-sampling multiple determining module 903, configured to determine a down-sampling multiple of each to-be-detected region as a first down-sampling multiple;
and a downsampling processing module 904, configured to downsample each to-be-detected region according to the determined first downsampling multiple, to obtain a first downsampled image corresponding to each to-be-detected region.
In one implementation, the apparatus further comprises:
and an area detection module (not shown in fig. 9) configured to perform target detection on the first downsampled image corresponding to each area to be detected, so as to obtain a target detection result of the image to be detected.
In an implementation manner, the down-sampling multiple determining module 903 is further configured to determine a down-sampling multiple of the image to be detected, as a second down-sampling multiple;
the downsampling processing module 904 is further configured to downsample the image to be detected according to the determined second downsampling multiple to obtain a second downsampled image corresponding to the image to be detected;
the device further comprises: the target detection module 905 is further configured to perform target detection on the first downsampled image and the second downsampled image to obtain a target detection result of the image to be detected.
In one implementation, the object detection module 905 includes a first detection submodule, a second detection submodule, and a deduplication processing submodule (not shown in fig. 9). Wherein:
the first detection submodule is used for carrying out target detection on the first downsampled image to obtain a first detection result;
the second detection submodule is used for carrying out target detection on the second downsampled image to obtain a second detection result;
and the duplicate removal processing submodule is used for carrying out duplicate removal processing on the first detection result and the second detection result to obtain a target detection result of the image to be detected.
In an implementation manner, the deduplication processing sub-module is specifically configured to:
and judging whether the target frame in the first detection result and the target frame in any second detection result meet preset coincidence conditions or not according to each first detection result, and deleting the first detection result if the target frame in the first detection result and the target frame in any second detection result meet the preset coincidence conditions.
In another implementation, the target detection module 905 includes a stitching sub-module and a stitched image detection sub-module (not shown in fig. 9). Wherein:
the splicing submodule is used for splicing the second downsampled image and each first downsampled image to obtain a spliced image;
and the spliced image detection submodule is used for carrying out target detection on the spliced image to obtain a target detection result of the image to be detected.
In an implementation manner, the region determining module 9020 is specifically configured to uniformly divide the image to be detected into M sub-regions according to a first preset direction, and determine one or more regions to be detected from the M sub-regions; wherein M is a positive integer greater than 1;
the down-sampling multiple determining module 903 is specifically configured to determine a down-sampling multiple N of the one or more regions to be detected, where N is a positive integer greater than 1; determining the down-sampling multiple MXN of the image to be detected according to the down-sampling multiple N of the one or more regions to be detected;
and the splicing submodule is specifically configured to splice the second downsampled image and each first downsampled image in sequence according to the first preset direction to obtain a spliced image.
In one implementation, the stitched image detection sub-module includes:
a detection result separation unit, configured to determine, in the target detection results of the stitched image, a first detection result corresponding to the first downsampled image and a second detection result corresponding to the second downsampled image;
the coordinate conversion unit is used for converting the coordinate of the first detection result in the spliced image into the coordinate of the first detection result in the image to be detected according to the first down-sampling multiple of the area to be detected; converting the coordinates of the second detection result in the spliced image into the coordinates of the second detection result in the image to be detected according to the second down-sampling multiple of the image to be detected;
and the detection result duplicate removal unit is used for removing the duplicate of the first detection result and the second detection result according to the coordinates of the first detection result and the second detection result in the image to be detected to obtain the target detection result of the image to be detected.
In an implementation manner, the detection result separation unit is specifically configured to:
determining a position interval of the second downsampled image in the spliced image;
and judging whether the target detection result of the spliced image is in the position interval or not according to the coordinate of the target detection result of each spliced image, if so, taking the target detection result of the spliced image as the second detection result, and if not, taking the target detection result of the spliced image as the first detection result.
As can be seen from the above, the image downsampling apparatus provided in the embodiment of the present application determines one or more regions to be detected and downsampling multiples of each region to be detected in an image to be detected, performs downsampling on each region to be detected according to the determined downsampling multiples, obtains a downsampled image corresponding to each region to be detected, and uses the downsampled image as a first downsampled image, so that the downsampling multiples of the region to be detected can be controlled in a targeted manner. If the resolution of the target in a certain area to be detected is low, then, when the area to be detected is subjected to down-sampling processing, a low down-sampling multiple can be adopted, so that the resolution of the target in the area to be detected meets the requirement of the lowest resolution threshold of the target detection algorithm, and thus, the phenomenon that the resolution value of the target in the area to be detected after down-sampling is lower than the lowest resolution threshold of the target detection algorithm can be reduced, and the detection rate of target detection is improved.
The embodiment of the present application further provides an electronic device, as shown in fig. 10, which includes a processor 1001, a communication interface 1002, a memory 1003 and a communication bus 1004, wherein the processor 1001, the communication interface 1002 and the memory 1003 complete mutual communication through the communication bus 1004,
a memory 1003 for storing a computer program;
the processor 1001 is configured to implement the following steps when executing the program stored in the memory 1003:
acquiring an image to be detected;
determining one or more regions to be detected in an image to be detected;
determining the down-sampling multiple of each region to be detected as a first down-sampling multiple;
and performing down-sampling on each region to be detected according to the determined first down-sampling multiple to obtain a first down-sampled image corresponding to each region to be detected.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
Therefore, the scheme can control the down-sampling multiple of the area to be detected in a targeted manner. If the resolution of the target in a certain area to be detected is low, then, when the area to be detected is subjected to down-sampling processing, a low down-sampling multiple can be adopted, so that the resolution of the target in the area to be detected meets the requirement of the lowest resolution threshold of the target detection algorithm, and thus, the phenomenon that the resolution value of the target in the area to be detected after down-sampling is lower than the lowest resolution threshold of the target detection algorithm can be reduced, and the detection rate of target detection is improved.
In yet another embodiment provided by the present application, a computer-readable storage medium is further provided, which has instructions stored therein, and when the instructions are executed on a computer, the instructions cause the computer to execute the image down-sampling method described in any of the above embodiments.
In yet another embodiment provided by the present application, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the image down-sampling method as described in any of the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the device embodiment, the electronic device embodiment and the storage medium embodiment, since they are basically similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only for the preferred embodiment of the present application, and is not intended to limit the scope of the present application. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims (18)

1. A method of image downsampling, the method comprising:
acquiring an image to be detected;
determining one or more regions to be detected in the image to be detected;
determining the down-sampling multiple of each region to be detected as a first down-sampling multiple;
and performing down-sampling on each region to be detected according to the determined first down-sampling multiple to obtain a first down-sampled image corresponding to each region to be detected.
2. The method according to claim 1, wherein after obtaining the first downsampled image corresponding to each region to be detected, the method further comprises:
and performing target detection on the first downsampled image corresponding to each to-be-detected area to obtain a target detection result of the to-be-detected image.
3. The method according to claim 1, wherein after said acquiring an image to be detected, the method further comprises:
determining a down-sampling multiple of the image to be detected as a second down-sampling multiple;
according to the determined second down-sampling multiple, down-sampling the image to be detected to obtain a second down-sampled image corresponding to the image to be detected;
after obtaining the first downsampled image corresponding to each region to be detected, the method further includes:
and carrying out target detection on the first downsampling image and the second downsampling image to obtain a target detection result of the image to be detected.
4. The method according to claim 3, wherein the performing the target detection on the first down-sampled image and the second down-sampled image to obtain the target detection result of the image to be detected comprises:
performing target detection on the first downsampled image to obtain a first detection result;
performing target detection on the second downsampled image to obtain a second detection result;
and performing duplicate removal processing on the first detection result and the second detection result to obtain a target detection result of the image to be detected.
5. The method of claim 4, wherein the performing de-duplication processing on the first detection result and the second detection result comprises:
and judging whether the target frame in the first detection result and the target frame in any second detection result meet preset coincidence conditions or not according to each first detection result, and deleting the first detection result if the target frame in the first detection result and the target frame in any second detection result meet the preset coincidence conditions.
6. The method according to claim 3, wherein the performing the target detection on the first down-sampled image and the second down-sampled image to obtain the target detection result of the image to be detected comprises:
splicing the second downsampled image and each first downsampled image to obtain a spliced image;
and carrying out target detection on the spliced image to obtain a target detection result of the image to be detected.
7. The method according to claim 6, wherein the determining one or more regions to be detected in the image to be detected comprises:
uniformly dividing the image to be detected into M sub-regions according to a first preset direction, and determining one or more regions to be detected from the M sub-regions; wherein M is a positive integer greater than 1;
the determining the down-sampling multiple of each region to be detected as the first down-sampling multiple includes:
determining a down-sampling multiple N of the one or more regions to be detected, wherein N is a positive integer greater than 1;
the determining of the down-sampling multiple of the image to be detected as a second down-sampling multiple comprises the following steps:
determining the down-sampling multiple MXN of the image to be detected according to the down-sampling multiple N of the one or more regions to be detected;
the stitching the second downsampled image and each first downsampled image to obtain a stitched image includes:
and sequentially splicing the second downsampled image and each first downsampled image according to the first preset direction to obtain a spliced image.
8. The method as claimed in claim 7, wherein the obtaining of the target detection result of the image to be detected by performing the target detection on the stitched image comprises:
determining a first detection result corresponding to the first downsampled image and a second detection result corresponding to the second downsampled image in the target detection results of the spliced image;
converting the coordinate of the first detection result in the spliced image into the coordinate of the first detection result in the image to be detected according to the first down-sampling multiple of the area to be detected;
converting the coordinates of the second detection result in the spliced image into the coordinates of the second detection result in the image to be detected according to the second down-sampling multiple of the image to be detected;
and according to the coordinates of the first detection result and the second detection result in the image to be detected, carrying out duplicate removal processing on the first detection result and the second detection result to obtain a target detection result of the image to be detected.
9. The method of claim 8, wherein the determining a first detection result corresponding to the first downsampled image and a second detection result corresponding to the second downsampled image from the target detection results of the stitched image comprises:
determining a position interval of the second downsampled image in the spliced image;
and judging whether the target detection result of the spliced image is in the position interval or not according to the coordinate of the target detection result of each spliced image, if so, taking the target detection result of the spliced image as the second detection result, and if not, taking the target detection result of the spliced image as the first detection result.
10. An image down-sampling apparatus, the apparatus comprising:
the image acquisition module is used for acquiring an image to be detected;
the area determining module is used for determining one or more areas to be detected in the image to be detected;
the down-sampling multiple determining module is used for determining the down-sampling multiple of each region to be detected as a first down-sampling multiple;
and the down-sampling processing module is used for down-sampling each region to be detected according to the determined first down-sampling multiple to obtain a first down-sampled image corresponding to each region to be detected.
11. The apparatus of claim 10, further comprising:
and the area detection module is used for carrying out target detection on the first downsampled image corresponding to each area to be detected to obtain a target detection result of the image to be detected.
12. The apparatus of claim 10,
the down-sampling multiple determining module is further used for determining the down-sampling multiple of the image to be detected as a second down-sampling multiple;
the downsampling processing module is further used for downsampling the image to be detected according to the determined second downsampling multiple to obtain a second downsampled image corresponding to the image to be detected;
the device further comprises:
and the target detection module is used for carrying out target detection on the first downsampling image and the second downsampling image to obtain a target detection result of the image to be detected.
13. The apparatus of claim 12, wherein the object detection module comprises:
the first detection submodule is used for carrying out target detection on the first downsampled image to obtain a first detection result;
the second detection submodule is used for carrying out target detection on the second downsampled image to obtain a second detection result;
and the duplicate removal processing submodule is used for carrying out duplicate removal processing on the first detection result and the second detection result to obtain a target detection result of the image to be detected.
14. The apparatus according to claim 13, wherein the deduplication processing sub-module is specifically configured to:
and judging whether the target frame in the first detection result and the target frame in any second detection result meet preset coincidence conditions or not according to each first detection result, and deleting the first detection result if the target frame in the first detection result and the target frame in any second detection result meet the preset coincidence conditions.
15. The apparatus of claim 12, wherein the object detection module comprises:
the splicing submodule is used for splicing the second downsampled image and each first downsampled image to obtain a spliced image;
and the spliced image detection submodule is used for carrying out target detection on the spliced image to obtain a target detection result of the image to be detected.
16. The apparatus of claim 15,
the region determining module is specifically configured to uniformly divide the image to be detected into M sub-regions according to a first preset direction, and determine one or more regions to be detected from the M sub-regions; wherein M is a positive integer greater than 1;
the down-sampling multiple determining module is specifically configured to determine a down-sampling multiple N of the one or more regions to be detected, where N is a positive integer greater than 1; determining the down-sampling multiple MXN of the image to be detected according to the down-sampling multiple N of the one or more regions to be detected;
and the splicing submodule is specifically configured to splice the second downsampled image and each first downsampled image in sequence according to the first preset direction to obtain a spliced image.
17. The apparatus of claim 16, wherein the stitched image detection sub-module comprises:
a detection result separation unit, configured to determine, in the target detection results of the stitched image, a first detection result corresponding to the first downsampled image and a second detection result corresponding to the second downsampled image;
the coordinate conversion unit is used for converting the coordinate of the first detection result in the spliced image into the coordinate of the first detection result in the image to be detected according to the first down-sampling multiple of the area to be detected; converting the coordinates of the second detection result in the spliced image into the coordinates of the second detection result in the image to be detected according to the second down-sampling multiple of the image to be detected;
and the detection result duplicate removal unit is used for removing the duplicate of the first detection result and the second detection result according to the coordinates of the first detection result and the second detection result in the image to be detected to obtain the target detection result of the image to be detected.
18. The apparatus according to claim 17, wherein the detection result separation unit is specifically configured to:
determining a position interval of the second downsampled image in the spliced image;
and judging whether the target detection result of the spliced image is in the position interval or not according to the coordinate of the target detection result of each spliced image, if so, taking the target detection result of the spliced image as the second detection result, and if not, taking the target detection result of the spliced image as the first detection result.
CN201810845244.8A 2018-07-27 2018-07-27 Image down-sampling method and device Active CN110766644B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810845244.8A CN110766644B (en) 2018-07-27 2018-07-27 Image down-sampling method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810845244.8A CN110766644B (en) 2018-07-27 2018-07-27 Image down-sampling method and device

Publications (2)

Publication Number Publication Date
CN110766644A true CN110766644A (en) 2020-02-07
CN110766644B CN110766644B (en) 2023-03-24

Family

ID=69327730

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810845244.8A Active CN110766644B (en) 2018-07-27 2018-07-27 Image down-sampling method and device

Country Status (1)

Country Link
CN (1) CN110766644B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114296629A (en) * 2021-12-28 2022-04-08 五邑大学 Signal acquisition method and system

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5640468A (en) * 1994-04-28 1997-06-17 Hsu; Shin-Yi Method for identifying objects and features in an image
CN1922858A (en) * 2004-02-17 2007-02-28 Toa株式会社 Image compression device
CN101999232A (en) * 2008-04-04 2011-03-30 富士胶片株式会社 Image processing system, image processing method, and program
CN102332162A (en) * 2011-09-19 2012-01-25 西安百利信息科技有限公司 Method for automatic recognition and stage compression of medical image regions of interest based on artificial neural network
CN104867165A (en) * 2015-05-19 2015-08-26 电子科技大学 Cramping method based on sampling technology under transform domain
CN106485720A (en) * 2016-11-03 2017-03-08 广州视源电子科技股份有限公司 Image processing method and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5640468A (en) * 1994-04-28 1997-06-17 Hsu; Shin-Yi Method for identifying objects and features in an image
CN1922858A (en) * 2004-02-17 2007-02-28 Toa株式会社 Image compression device
CN100539628C (en) * 2004-02-17 2009-09-09 Toa株式会社 Image compressing device
CN101999232A (en) * 2008-04-04 2011-03-30 富士胶片株式会社 Image processing system, image processing method, and program
CN102332162A (en) * 2011-09-19 2012-01-25 西安百利信息科技有限公司 Method for automatic recognition and stage compression of medical image regions of interest based on artificial neural network
CN104867165A (en) * 2015-05-19 2015-08-26 电子科技大学 Cramping method based on sampling technology under transform domain
CN106485720A (en) * 2016-11-03 2017-03-08 广州视源电子科技股份有限公司 Image processing method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114296629A (en) * 2021-12-28 2022-04-08 五邑大学 Signal acquisition method and system

Also Published As

Publication number Publication date
CN110766644B (en) 2023-03-24

Similar Documents

Publication Publication Date Title
CN107545262B (en) Method and device for detecting text in natural scene image
JP6902611B2 (en) Object detection methods, neural network training methods, equipment and electronics
CN108875723B (en) Object detection method, device and system and storage medium
CN110097050B (en) Pedestrian detection method, device, computer equipment and storage medium
CN110298858B (en) Image clipping method and device
US11900676B2 (en) Method and apparatus for detecting target in video, computing device, and storage medium
CN110363211B (en) Detection network model and target detection method
CN111382637B (en) Pedestrian detection tracking method, device, terminal equipment and medium
CN111738995A (en) RGBD image-based target detection method and device and computer equipment
CN110991310A (en) Portrait detection method, portrait detection device, electronic equipment and computer readable medium
CN110866428B (en) Target tracking method, device, electronic equipment and storage medium
CN112348116A (en) Target detection method and device using spatial context and computer equipment
CN108229281B (en) Neural network generation method, face detection device and electronic equipment
CN111598088A (en) Target detection method and device, computer equipment and readable storage medium
CN113762220B (en) Object recognition method, electronic device, and computer-readable storage medium
Wang et al. Object counting in video surveillance using multi-scale density map regression
CN114267029A (en) Lane line detection method, device, equipment and storage medium
US9171227B2 (en) Apparatus and method extracting feature information of a source image
WO2023019682A1 (en) Watermark removal method and apparatus, terminal device and readable storage medium
CN110766644B (en) Image down-sampling method and device
CN111738272A (en) Target feature extraction method and device and electronic equipment
JP2009182624A (en) Target tracking device
CN111444834A (en) Image text line detection method, device, equipment and storage medium
CN116109652A (en) Image segmentation method, system and equipment based on improved region growing algorithm
CN115661851A (en) Sample data acquisition and component identification method and electronic equipment

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