Method, device and storage medium for estimating the number of image recognition objects
The problem of lack of head size information in crowd density estimation is solved through the object number prediction network, and the accuracy and applicability of the object number estimation in the image is improved.
Patent Information
- Application Number
- CN202110207662.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-24
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2041-02-24
AI Technical Summary
The existing population density estimation calculation method cannot obtain the size information of the head, resulting in inconsistent density maps, poor population density estimation effect, large local counting error, low accuracy of the number of people in the image, and poor applicability.
The area category labels of each predicted area in the image are determined through the object number prediction network, and an appropriate counting interval is selected from multiple counting intervals based on the category label. The interval parameters are determined by the number of interval objects and the length of interval objects, taking into account the balance of the number of interval objects and length, and improving the estimation accuracy.
It improves the accuracy of estimating the number of recognized objects in the image, is simple to operate and has high applicability, and is suitable for estimating the number of image recognition objects in the fields of computer vision and machine learning.
Smart Images

Figure CN114973115B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, and storage medium for estimating the number of image recognition objects. Background Art
[0002] Crowd density estimation can infer the total number of people in an image and plays an important role in fields such as video and public safety. Currently, most crowd density estimation algorithms combine density map regression with deep learning technology for end-to-end training and inference. This effectively addresses issues such as the large range of crowd density distribution and the large range of head size variations, improving the accuracy of head count calculations to a certain extent. However, current crowd density estimation algorithms are unable to obtain head size information. They typically use the same Gaussian standard deviation for all heads in a single image to generate a density map. This results in inconsistencies in the generated density map due to the varying head sizes in the image, resulting in poor crowd density estimation.
[0003] During the course of research and practice, the inventors of the present application discovered that the crowd density estimation in the prior art uses a framework method of local count value classification to convert the number of people estimated in the entire image (i.e., the whole) into the number of people estimated in the image block (i.e., the local image area), and then obtains the number of people estimated in the entire image according to the number of people estimated in the image block, so as to convert the overall count into a local count. However, in the prior art, when converting the overall count into the local count, the counting interval is mainly divided evenly (i.e., the interval length is the same, for example, the length of the range of the number of samples (i.e., the number of people) in each counting interval is the same) or the interval is divided equally according to the number of samples (i.e., the number of people) in each counting interval, which results in an imbalance in the number of samples in the intervals with the same length, or the length difference of the intervals with the same number of samples is too large, resulting in a large local counting error, low accuracy in estimating the number of people in the image, and poor applicability. Summary of the Invention
[0004] The embodiments of the present application provide a method, device, and storage medium for estimating the number of image recognition objects, which can improve the estimation accuracy of the number of recognized objects in an image, are simple to operate, and have high applicability.
[0005] A first aspect of an embodiment of the present application provides a method for estimating the number of image recognition objects, comprising:
[0006] Obtaining an image to be identified, inputting the image to be identified into an object quantity prediction network, and determining a region category label for each predicted region in the image to be identified through the object quantity prediction network;
[0007] Determining, based on the region category labels of the respective prediction regions, counting intervals corresponding to the respective prediction regions from a plurality of counting intervals, and determining the number of region objects in the respective prediction regions according to a range of the number of interval objects in the counting intervals corresponding to the respective prediction regions, wherein each of the plurality of counting intervals has the same interval parameter, which is determined by the number of interval objects and the interval length;
[0008] The estimated number of objects to be identified in the image to be identified is determined according to the number of area objects in each of the predicted areas.
[0009] In combination with the first aspect, in a possible implementation manner, the above method further includes:
[0010] Obtain a sample image, and generate a sample density map corresponding to the sample image based on the center point of the head of the identified object in the sample image;
[0011] Determine a plurality of regions from the sample density map, and determine the number of identification objects in any of the plurality of regions based on the density value of a unit pixel in any of the plurality of regions;
[0012] Determine a target counting interval corresponding to the number of identified objects in any of the above regions based on the range of the number of objects in each counting interval, and determine a region category label for any of the above regions based on the interval category of the above target counting interval. The region category label for any of the above regions is used to mark the range of the number of objects in any of the above regions.
[0013] The object quantity prediction network is trained according to the sample density map and the region category labels of each region in the sample density map, so that the object quantity prediction network outputs the region category label of any region.
[0014] In conjunction with the first aspect, in one possible implementation, determining the target counting interval corresponding to the number of identified objects in any of the above-mentioned areas based on the range of the number of objects in each counting interval includes:
[0015] The target interval object number range to which the number of identified objects in any area belongs is determined according to the interval object number range of each counting interval, and the counting interval corresponding to the target area object number range is determined as the target counting interval.
[0016] In combination with the first aspect, in a possible implementation manner, the above method further includes:
[0017] Acquire a plurality of sample image blocks for determining a counting interval, and determine a first number of intervals and an interval parameter search range for determining the counting interval;
[0018] Determining a target interval parameter search range by a binary search method based on the plurality of sample image blocks, the number of objects in each sample image block, and the interval parameter search range, wherein the target interval parameter search range is an interval parameter search range in which the number of counting intervals obtained by dividing the plurality of sample image blocks is equal to the number of first intervals, and the interval parameters of the counting intervals are the same;
[0019] The midpoint value of the target interval parameter search range is determined as the target interval parameter, and the multiple counting intervals obtained by dividing based on the target interval parameter are determined as multiple counting intervals.
[0020] In combination with the first aspect, in one possible implementation, determining a target interval parameter search range by a binary search method based on the plurality of sample image blocks, the number of objects in each sample image block, and the interval parameter search range includes:
[0021] Determining a minimum parameter threshold of the interval parameter search range as an initial interval parameter, and determining an initial number of counting intervals obtained by dividing the counting intervals based on the plurality of sample image blocks, the number of objects in each sample image block, and the initial interval parameter;
[0022] If the initial number of intervals is not equal to the first number of intervals, adjusting the interval parameter search range based on the vertex of the interval parameter search range, determining the minimum parameter threshold of the adjusted interval parameter search range as the initial interval parameter, and performing the step of determining the initial number of intervals of the counting intervals obtained by dividing the counting intervals based on the plurality of sample image blocks, the number of objects in each sample image block, and the initial interval parameter;
[0023] If the number of the initial intervals is equal to the number of the first intervals, the interval parameter search range is determined as the target interval parameter search range.
[0024] In combination with the first aspect, in a possible implementation, one counting interval in the plurality of counting intervals corresponds to one interval category label, and the interval category label of any counting interval is used to mark a range of the number of interval objects in the any counting interval;
[0025] The above-mentioned determining the counting interval corresponding to each prediction area from a plurality of counting intervals based on the area category label of each prediction area includes:
[0026] The counting intervals among the plurality of counting intervals whose interval category labels are the same as the area category label of any prediction area are determined as the counting intervals corresponding to the any prediction area, so as to obtain the counting intervals corresponding to each prediction area.
[0027] In conjunction with the first aspect, in a possible implementation, determining the number of area objects in each prediction area according to the range of the number of interval objects in the counting interval corresponding to each prediction area includes:
[0028] The midpoint value of the interval object quantity range of the counting interval corresponding to any of the above prediction regions is determined as the region object quantity of any of the above prediction regions, so as to obtain the region object quantity of each of the above prediction regions.
[0029] In a second aspect, an embodiment of the present application provides a device for estimating the number of image recognition objects, the device comprising:
[0030] A first acquisition module is used to acquire an image to be identified;
[0031] a first determining module, configured to input the image to be identified obtained by the first obtaining module into an object quantity prediction network, and determine a region category label of each predicted region in the image to be identified through the object quantity prediction network;
[0032] a second determining module, configured to determine, based on the region category labels of the respective prediction regions, a counting interval corresponding to each prediction region from a plurality of counting intervals, and determine the number of region objects in each prediction region according to a range of the number of interval objects in the counting interval corresponding to each prediction region, wherein each of the plurality of counting intervals has the same interval parameter, which is determined by the number of interval objects and the interval length;
[0033] The third determining module is configured to determine an estimated number of objects in the to-be-identified image according to the number of objects in each of the predicted regions.
[0034] In conjunction with the second aspect, in one possible implementation, the apparatus further includes:
[0035] A second acquisition module is used to acquire a sample image;
[0036] A second output module is configured to generate a sample density map corresponding to the sample image according to the center point of the head of the identification object in the sample image;
[0037] a fourth determination module, configured to determine a plurality of regions from the sample density map, and determine the number of identification objects in any of the plurality of regions based on the density value of a unit pixel in any of the plurality of regions;
[0038] a fifth determining module, determining a target counting interval corresponding to the number of identified objects in any of the aforementioned areas based on the range of the number of objects in each counting interval, and determining an area category label for any of the aforementioned areas based on the interval category of the target counting interval, wherein the area category label for any of the aforementioned areas is used to mark the range of the number of objects in any of the aforementioned areas;
[0039] The first training module is used to train the object quantity prediction network according to the sample density map and the region category labels of each region in the sample density map, so that the object quantity prediction network outputs the region category label of any region.
[0040] In conjunction with the second aspect, in a possible implementation manner, the fifth determining module is further configured to:
[0041] The target interval object number range to which the number of identified objects in any area belongs is determined according to the interval object number range corresponding to each counting interval, and the counting interval corresponding to the target area object number range is determined as the target counting interval.
[0042] In conjunction with the second aspect, in one possible implementation, the apparatus further includes:
[0043] A third acquisition module, configured to acquire a plurality of sample image blocks for determining a counting interval;
[0044] A sixth determining module, configured to determine the number of first intervals of the counting intervals and an interval parameter search range of the interval parameter;
[0045] a seventh determining module, configured to determine a target interval parameter search range by a binary search method based on the plurality of sample image blocks, the number of objects in each sample image block, and the interval parameter search range, wherein the target interval parameter search range is an interval parameter search range in which the number of counting intervals obtained by dividing the plurality of sample image blocks is equal to the number of first intervals, and the interval parameters of the counting intervals are the same;
[0046] An eighth determining module is configured to determine a midpoint value of the target interval parameter search range as the target interval parameter, and determine multiple counting intervals obtained by dividing the target interval parameter as multiple counting intervals.
[0047] In conjunction with the second aspect, in a possible implementation manner, the seventh determining module further includes:
[0048] an initial interval number determining unit, configured to determine the minimum parameter threshold of the interval parameter search range as the initial interval parameter, and determine the initial interval number of the counting intervals obtained by dividing the counting intervals based on the initial interval parameter;
[0049] a target interval parameter determining unit, configured to, if the initial number of intervals is not equal to the first number of intervals, adjust the interval parameter search range based on a vertex of the interval parameter search range, determine a minimum parameter threshold of the adjusted interval parameter search range as an initial interval parameter, and execute the step of determining the initial number of intervals of the counting intervals obtained by dividing the counting intervals based on the initial interval parameter;
[0050] If the number of the initial intervals is equal to the number of the first intervals, the interval parameter search range is determined as the target interval parameter search range.
[0051] In conjunction with the second aspect, in one possible implementation, each of the multiple counting intervals corresponds to an interval category label, and the interval category label of any counting interval is used to mark the range of the number of interval objects in the any counting interval; and the second determining module is further configured to:
[0052] A counting interval in the plurality of counting intervals having the same interval category label as the area category label of any prediction area is determined as the counting interval corresponding to the any prediction area, so as to obtain the counting interval corresponding to each prediction area.
[0053] In conjunction with the second aspect, in a possible implementation manner, the second determining module is further configured to:
[0054] The midpoint value of the interval object quantity range of the counting interval corresponding to any prediction region is determined as the region object quantity of any prediction region, so as to obtain the region object quantity of each prediction region.
[0055] In a third aspect, the present application provides a computer device comprising: a processor, a transceiver, a memory, and a network interface;
[0056] The above-mentioned processor is connected to the memory, the transceiver and the network interface, wherein the network interface is used to provide data communication function, the above-mentioned memory is used to store program code, and the above-mentioned processor and the above-mentioned transceiver are used to call the above-mentioned program code to execute the method executed by the above-mentioned first aspect and any possible implementation method of the first aspect in this application.
[0057] In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program, and the computer program includes program instructions. When the program instructions are executed by a processor, the method performed by the above-mentioned first aspect of the present application and any possible implementation method of the first aspect is executed.
[0058] After acquiring the image to be identified, the embodiment of the present application inputs the image to be identified into the trained object quantity prediction network to determine the region category label of each prediction region in the image to be identified. The image to be identified includes multiple prediction regions, and one prediction region corresponds to one region category label. Based on the region category labels of each prediction region, the counting intervals corresponding to each prediction region are determined from multiple counting intervals, wherein the interval parameters of each counting interval in the multiple counting intervals are the same, and the interval parameters are determined by the number of interval objects and the interval length, that is, the balance of the number of interval objects and the balance of the interval length are taken into account at the same time, which can improve the estimation accuracy of the number of identified objects in the image to be identified, is simple to operate, and has high applicability. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0060] Figure 1 This is a schematic diagram of the network architecture provided by the embodiment of the present application;
[0061] Figure 2 Schematic diagram of a scenario of a method for estimating the number of image recognition objects provided by an embodiment of the present application;
[0062] Figure 3 1 is a flow chart of a method for estimating the number of image recognition objects provided by an embodiment of the present application;
[0063] Figure 4 This is a schematic diagram of the object quantity prediction network structure provided by an embodiment of the present application;
[0064] Figure 5 It is a schematic diagram of the prediction area division method provided in this application;
[0065] Figure 6 This is a diagram showing the impact of different interval division methods provided in the application on the counting error of each interval category;
[0066] Figure 7 1 is a flow chart of a method for training an object quantity prediction network according to an embodiment of the present application;
[0067] Figure 8 This is a schematic diagram of a device for estimating the number of image recognition objects provided by the present application;
[0068] Figure 9is another structural diagram of the device for estimating the number of image recognition objects provided by the present application;
[0069] Figure 10 It is a structural diagram of the computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0070] The following will be combined with the accompanying drawings to clearly and completely describe the technical solutions in this application. Obviously, the embodiments described are only some of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0071] Artificial intelligence (AI) refers to the theories, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive field within computer science that seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. AI also studies the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making. AI technology is an interdisciplinary discipline encompassing a wide range of fields, encompassing both hardware and software technologies. Foundational AI technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0072] The solution provided in the embodiment of the present application belongs to the computer vision technology (CV) and machine learning (ML) under the field of artificial intelligence. Computer vision is a science that studies how to make machines "see". More specifically, it refers to machine vision such as using cameras and computers to replace human eyes to identify and measure targets, and further performs graphic processing to make computer processing into images that are more suitable for human eye observation or transmission to instrument detection. As a scientific discipline, computer vision studies related theories and technologies, attempting to establish an artificial intelligence system that can obtain information from images or multidimensional data. Computer vision technology generally includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous positioning and mapping, and also includes common biometric recognition technologies such as face recognition and fingerprint recognition. Machine learning is a multi-disciplinary interdisciplinary subject that involves multiple disciplines such as probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. Machine learning is the study of how computers can simulate or implement human learning behaviors to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is at the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications span all areas of artificial intelligence. Machine learning and deep learning typically include techniques such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning.
[0073] See Figure 1 , Figure 1 This is a schematic diagram of the network architecture provided by the embodiment of this application. Figure 1 As shown, the system may include a business server 100 and a user terminal cluster, and the user terminal cluster may include user terminal 10a, user terminal 10b, ..., user terminal 10n, wherein there may be a communication connection between the user terminal clusters, for example, there is a communication connection between user terminal 10a and user terminal 10b, and there is a communication connection between user terminal 10b and user terminal 10n, and any user terminal in the user terminal cluster may have a communication connection with the business server 100, for example, there is a communication connection between user terminal 10a and business server 100, and there is a communication connection between user terminal 10b and business server 100.
[0074] Among them, the above-mentioned user terminal clusters (also including the above-mentioned user terminals 10a, 10b and 10n) can all be integrated with target applications. Optionally, the target application may include an application with the function of displaying data information such as text, images, and videos. For example, the target application may be a video application, which can be used to view images or videos captured by the user terminal camera and identify the number of people, animals or objects in the camera shot. Or the target application may also be an image detection application, which can be used for users to upload pictures or videos and detect the density or number of people, animals or objects in the pictures or videos. The business server 100 in this application can collect business data such as images or videos uploaded by these applications. Optionally, the business data may include images to be identified uploaded by users, etc. For the sake of convenience, the images to be identified are directly used as business data for example. The business server 100 can predict the regional category labels of each predicted area from these images to be identified, and determine the number of regional objects in each predicted area based on the above-mentioned regional category labels and counting intervals. Subsequently, the service server 100 determines the estimated number of objects in the image to be identified based on the number of objects in each of the predicted areas, and returns the estimated number of objects to the user terminal. Figure 1 For any user terminal selected from the user terminal cluster of the corresponding embodiment, for example, user terminal 10b, the user can view the estimated number of identified objects on the display page of user terminal 10b. Optionally, the identified objects can be people, objects, or animals, depending on the actual application scenario and is not limited in this embodiment.
[0075] It is understandable that the method provided in the embodiment of the present application can be executed by a computer device, and the computer device includes but is not limited to a terminal or a server. The business server 100 in the embodiment of the present application can be a computer device, and the user terminal in the user terminal cluster can also be a computer device, which is not limited here. The above-mentioned business server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The above-mentioned terminals may include: smart phones, tablet computers, laptops, desktop computers, smart TVs, smart speakers, desktop computers, smart watches and other smart terminals with image recognition functions (for example, identifying the head area of the identified object in the image), but are not limited to this. Among them, the user terminal and the business server can be directly or indirectly connected by wired or wireless communication, and this application is not limited here.
[0076] See Figure 2 , Figure 2 Schematic diagram of the scene of the method for estimating the number of image recognition objects provided by the embodiment of the present application. Figure 2 As shown, when user A is using a target application (e.g., an image detection application) in a user terminal, user A uploads an image 20a through user terminal 10b. Image 20a includes several objects to be identified (e.g., people). User terminal 10b then sends a request to the service server 100 to estimate the number of image recognition objects in image 20a. Specifically, service server 100 can detect and collect that the user has uploaded an image 20a to be identified that includes several human portraits, input the image 20a to be identified into an object number prediction network, and obtain region category labels for each predicted region in the image to be identified based on the object number prediction network. The image to be identified includes multiple predicted regions, each corresponding to a region category label, and the region category labels are used to determine the range of the number of objects in the region. Subsequently, the business server 100 can determine the counting intervals corresponding to the above-mentioned prediction areas from a plurality of preset counting intervals based on the area category labels of the above-mentioned prediction areas, wherein the above-mentioned plurality of preset counting intervals (hereinafter referred to as counting intervals for the convenience of description) are determined according to a plurality of sample image blocks, the number of sample objects in each sample image block, and the interval parameter search range, and the interval parameters of each counting interval in the above-mentioned plurality of counting intervals are the same, and the above-mentioned interval parameters are determined by the number of interval objects and the interval length. Optionally, the interval parameter can be the product of the number of interval objects and the interval length. The number of area objects in the above-mentioned prediction areas is determined based on the range of the number of interval objects in the counting intervals corresponding to the above-mentioned prediction areas. Subsequently, the business server 100 determines the estimated number of objects to be identified in the above-mentioned image 20a to be identified based on the number of area objects in the above-mentioned prediction areas, and returns the estimated number of objects to be identified to the user terminal 10b, so that user A can view the estimated number of identified objects on the display page of the user terminal 10b.
[0077] Among them, the specific method for the business server 100 to output the regional category labels of each predicted area in the above-mentioned image to be identified can be determined based on the object quantity prediction network. In order to improve the prediction accuracy of the above-mentioned object quantity prediction network for the regional category labels of the above-mentioned prediction areas, the above-mentioned object quantity prediction network can be trained and adjusted to optimize the object quantity prediction network obtained after the training and adjustment, and then the above-mentioned regional category labels are predicted based on the trained object quantity prediction network. For the specific process of obtaining the trained object quantity prediction network, please refer to the subsequent Figure 7The description of steps S201-S205 in the corresponding embodiment. The specific process of the business server 100 determining the above counting intervals can be found in the subsequent Figure 3 This corresponds to the description of step S103 in the embodiment.
[0078] Optionally, if a trained object number prediction network is stored locally on the user terminal 10b, the user terminal 10b can locally estimate the number of objects in the image to be recognized. Since training the object number prediction network involves a significant amount of offline computation, the object number prediction network stored locally on the user terminal can be trained by the service server 100 and sent to the user terminal 10b. The specific method can be determined based on the actual application scenario and is not limited here.
[0079] For further understanding, please see Figure 3 , Figure 3 This is a flow chart of a method for estimating the number of image recognition objects provided by an embodiment of the present application. Figure 1 or Figure 2 The user terminal shown in FIG) can also be executed by the user terminal and the service server (as shown above Figure 1 or Figure 2 The method for estimating the number of image recognition objects may include at least the following steps S101 to S104:
[0080] S101 , obtaining an image to be identified, inputting the image to be identified into an object quantity prediction network, and determining a region category label of each prediction region in the image to be identified through the object quantity prediction network.
[0081] In some feasible implementations, the image to be identified is input into the object number prediction network. Through several convolutional layers in the object number prediction network, convolutional features of different dimensions of the image to be identified are obtained respectively, and the features extracted by each convolutional layer can be abstracted and combined into higher-order features in the next layer. Based on the convolutional features, each convolutional layer can output a corresponding feature map, and a point on the feature map corresponds to an area of the input image. Optionally, the feature map corresponding to the convolutional features extracted by two or more convolutional layers is input into a pooling layer. The pooling layer can integrate the feature points on the feature map to obtain compressed features, which plays a role in reducing the dimension of the convolutional features, thereby reducing the computational complexity. In each feature point integration stage of the pooling layer, there is a slight information loss from low-level features to mid-level features and then to high-level features, which also enables the pooling layer to remove redundant information. However, the role of the pooling layer is not limited to this. It also has translation invariance, that is, when integrating feature points, the position information of each pixel in the feature map can be retained, so that the position information of the feature points can be restored when the feature map size is subsequently restored. As the depth of the model increases, the features extracted by each convolutional layer become more and more detailed, and the size of the feature map becomes smaller and smaller, so the next convolutional layer can increase the number of feature maps to more fully extract the features of the previous layer. Optionally, when the detail information of the above-mentioned image to be identified is fully extracted, in order to obtain a high-resolution feature map with both high-level semantic information and detail information, a jump link is usually introduced to fuse the features of the first part with the features of the second part. The features of the first part here are local features that are fully loaded with image detail information after being extracted through several convolutional layers and several pooling layers; the features of the second part are global features that are upsampled by deconvolution, that is, transposed convolution, to increase the size of the feature map, thereby carrying high-level semantic information. The above-mentioned second part of the features combines the structural features of each level of the first part of the features through jump links, and improves the accuracy of the predicted regional category labels of each of the above-mentioned prediction areas through feature integration.
[0082] Please also see Figure 4 , Figure 4 This is a schematic diagram of the structure of an object quantity prediction network provided in an embodiment of the present application. Figure 4As shown, in some feasible implementations, the above-mentioned object quantity prediction network can be a U-Net convolutional neural network, and the entire U-Net convolutional neural network mainly consists of two parts: a downsampling part and an upsampling part. In an optional embodiment of the present application, the above-mentioned downsampling part adopts the front-end network of the VGG16 network model, that is, only the first four layers of the 16-layer network of the VGG16 network model are used. Among them, the first three layers of the four-layer network can be composed of a residual network layer and a pooling layer, and the last layer is a residual network layer. Optionally, the residual network layer 1 here can be ConvBlock1, the residual network layer 2 can be ConvBlock2, the residual network layer 3 can be ConvBlock3, the residual network layer 4 can be ConvBlock4, and the pooling layer can be Maxpool. Among them, ConvBlock is one type of residual network. Using a residual network, the features of the shallow layer can be transferred to the deep layer to solve the phenomenon of model degradation as the number of network layers increases. This is because as the number of network layers increases, the image information contained in the feature map will decrease layer by layer, and the use of a residual network can ensure that the network of the Lth layer must include more feature information than the network of the L+1th layer. In an optional embodiment of the present application, the above-mentioned ConvBlock1 residual network layer includes 2 layers of internal convolutional layers, the ConvBlock2 residual network layer includes 2 layers of internal convolutional layers, the ConvBlock3 residual network layer includes 3 layers of internal convolutional layers, and the ConvBlock4 residual network layer includes 3 layers of internal convolutional layers, and the number of convolution channels of all convolutional layers in the same ConvBlock residual network layer is the same, the number of convolution channels of the above-mentioned ConvBlock1 residual network layer is 64, the number of convolution channels of the ConvBlock2 residual network layer is 128, the number of convolution channels of the ConvBlock3 residual network layer is 256, and the number of convolution channels of the ConvBlock4 residual network layer is 512. Downsampling is achieved between each ConvBlock residual network layer through a maximum pooling layer (Maxpool) to increase the network receptive field and local translation invariance. The above-mentioned network receptive field is the size of the area mapped on the input image by the pixel points on the feature map output by each layer of the convolutional neural network, that is, a point on the feature map corresponds to an area on the input image; the above-mentioned local translation invariance means that no matter where the predicted area on the input image is moved to on the image, the output image result is the same. In an optional embodiment of the present application, the above-mentioned upsampling part adopts a bilinear upsampling method, and in the process of upsampling, the size of the image to be identified must be restored and the resolution of the image to be identified must be improved. The bilinear upsampling method here mainly uses bilinear interpolation to improve the resolution of the image to be identified. As Figure 4As shown, convolutional layer 1 introduces the convolution features extracted by the ConvBlock4 residual network layer through a skip link, and performs transposed convolution on the above convolution features. The calculation results are element-wise added with the convolution features extracted by the ConvBlock3 residual network layer introduced by the skip link through bilinear upsampling, and the added results are transposed convolution calculated by convolutional layer 2. The transposed convolution calculation results of convolutional layer 2 are element-wise added with the convolution features extracted by the ConvBlock2 residual network layer introduced by the skip link through bilinear upsampling, and the added results are transposed convolution calculated by convolutional layer 3. The transposed convolution calculation results of convolutional layer 3 are element-wise added with the convolution features extracted by the ConvBlock3 residual network layer introduced by bilinear upsampling, and the added results are convolution calculated by convolutional layer 4 until the region category labels of the above-mentioned prediction regions are output.
[0083] In some feasible implementations, the object number prediction network is a trained object number prediction network. The image to be identified is input into the trained object number prediction network, and the trained object number prediction network determines the region category label of each prediction region in the image to be identified. The image to be identified includes multiple prediction regions, each prediction region corresponds to a region category label, and the region category label is used to determine the range of the number of objects in the region (i.e., the range of the number of objects in the region). Figure 5 , Figure 5 This is a schematic diagram of the prediction area division method provided in the embodiment of this application. Figure 5 As shown in 5a in FIG, the several dotted lines in 5a divide the image to be recognized into several prediction areas (image blocks). Figure 5 As shown in 5b, 5b is one of the predicted regions (image blocks) in the image to be identified, wherein one predicted region (image block) corresponds to one region category label, and the region category label is used to mark the range of the number of objects in the region. Optionally, based on the above-mentioned object number prediction network, the region category label of any predicted region in the image to be identified can be determined. For example, if the number of objects in any region is in the range [0, 5] (indicating that the number of objects in the region is any one of 0 to 5), then based on the above-mentioned object number prediction network, the region category can be determined to be category 1, and based on the above-mentioned object number prediction network, the region category label of any of the above regions can be output as C1. If the number of objects in any of the above regions is in the range [6, 10], then based on the above-mentioned object number prediction network, the region category can be determined to be category 2, and based on the above-mentioned object number prediction network, the region category label of any of the above regions can be determined to be C2, etc. It can be understood that the region category label corresponding to 5b, which marks the range of the number of objects in the region, is C2.
[0084] S102 : Determine a counting interval corresponding to each prediction area from a plurality of counting intervals based on the area category label of each prediction area.
[0085] In some feasible implementations, each counting interval in the plurality of counting intervals corresponds to an interval category label, and the interval category label of any counting interval is used to mark the range of the number of objects in the interval of any counting interval. After the object quantity prediction network outputs the region category label for each prediction region, the counting interval in the plurality of counting intervals whose interval category label is the same as the region category label of any prediction region can be used as the counting interval corresponding to the prediction region to obtain the counting interval corresponding to each prediction region. The interval parameters of each counting interval in the counting intervals are the same, and the interval parameters are determined by the number of objects in the interval and the interval length. Optionally, the interval parameter can be the product of the number of objects in the interval and the interval length.
[0086] In some feasible embodiments, when determining the multiple counting intervals, multiple sample image blocks used to determine the counting intervals may be obtained, and a first number of intervals (e.g., K) used to determine the multiple counting intervals and an interval parameter search range (e.g., L to H) used to determine the interval parameters of the multiple counting intervals may be determined. The minimum parameter threshold of the interval parameter search range is determined as the initial interval parameter (e.g., M=L), and an initial counting interval division is given. Then, based on the number of sample objects in each sample image block (e.g., the number of people in each sample image), the initial counting interval is determined for each sample image block. In this way, each initial counting interval is assigned to a number of sample image blocks. Assuming that the number of sample image blocks divided into each initial counting interval (e.g., n) and the interval length of each initial counting interval (e.g., l) are the same, the product of n and l for each initial counting interval is the same. The initial number of counting intervals obtained by division can also be determined. If the initial number of intervals is not equal to the first number of intervals, the interval parameter search range is adjusted based on the vertex of the interval parameter search range, and the minimum parameter threshold of the adjusted interval parameter search range is determined as the initial interval parameter. The setting of the counting interval is adjusted based on the initial interval parameter determined after the adjustment of the interval parameter search range (i.e., the counting interval is re-divided), and the number of initial intervals obtained after the re-dividing of the counting interval is determined. When the calculated initial number of intervals is equal to the first number of intervals (i.e., K1 is equal to K) and the interval parameters of each counting interval are equal (i.e., the product of n and l is equal to M), the interval parameter search range at this time is determined as the target interval parameter search range. The target interval parameter search range is an interval parameter search range in which the number of counting intervals obtained by dividing the multiple sample image blocks is equal to the first number of intervals and the interval parameters of each counting interval are the same. The midpoint value of the target interval parameter search range is determined as the target interval parameter, and the multiple counting intervals obtained by dividing based on the target interval parameter are determined as multiple counting intervals.
[0087] Specifically, in some feasible implementations, if the trained object quantity prediction network outputs the region category label of the i-th prediction region in each of the above prediction regions as C i , and C iIf the corresponding counting interval is [10, 20], then [10, 20] is used as the counting interval of the i-th prediction region. Optionally, when dividing the counting intervals, keep the product M of the number of sample objects (i.e., n) and the length of the counting interval (i.e., l) in each counting interval equal, that is, the interval parameter M of each of the above counting intervals is equal. Set the interval parameter search range of the above interval parameter M to [L, H], and set the number of the first intervals to K. Determine the minimum parameter threshold L of the interval parameter search range [L, H] as the initial interval parameter, given an initial counting interval division, and then determine the initial counting interval where each sample image block is located according to the number of sample objects in each sample image block, so that each initial counting interval will be assigned several sample image blocks. Assume the number of sample image blocks (such as n) divided into each initial counting interval and the interval length (such as l) of each initial counting interval, then the product of n and l of each initial counting interval is the same. At this time, the initial number of intervals K1 can be obtained based on the above process. If K1 < K, then adjust the interval parameter search range to [(L + H) / 2, H]; if K1 > K, then adjust the interval parameter search range to [L, (L + H) / 2], and repeat the above steps of obtaining the initial number of counting intervals based on the initial interval parameter division until the number of counting intervals K1 = K obtained by dividing the above multiple sample image blocks and the interval parameter M of each counting interval are the same, then determine the current interval parameter search range as the target parameter search range. Determine the midpoint value of the above target interval parameter search range as the target interval parameter, and determine the multiple counting intervals obtained by dividing based on the above target interval parameter as the multiple counting intervals. Please refer to Figure 6 , Figure 6 is the influence diagram of the counting error of each interval category provided by this application. As Figure 6 shown, the current interval division methods also use the method of dividing according to the local count value, but they mainly divide the counting intervals according to the same length of each counting interval (such as Figure 6 6a in), or divide the intervals according to the equal number of sample objects in each counting interval (such as Figure 6 6b in). As Figure 6 shown in 6a, if the counting intervals are divided according to the same length of each counting interval, it can be seen that the influence diagram of the counting error shows an obvious long-tail feature. At this time, the number of sample objects corresponding to some counting intervals is very large, resulting in a great imbalance in the number of sample objects in each counting interval, affecting the optimization of the model and leading to the final counting error. As Figure 6As shown in 6b, if the intervals are divided according to the equal number of sample objects in each counting interval, long-tail characteristics will also appear, resulting in some counting intervals being very long, so that the misclassified samples in these counting intervals contribute a large counting error, affecting the counting accuracy. The embodiment of the present application proposes a more optimized solution to the problems existing in the above counting interval division method, that is, to simultaneously take into account the balance of the number of sample objects and the balance of the counting interval length, thereby achieving higher counting accuracy, such as Figure 6 As shown in 6c, 6c is the counting error obtained by the counting interval division method provided in the embodiment of the present application. It can be seen that if the counting interval is divided in a manner that takes into account both the balance of the number of sample objects and the balance of the counting interval length, the contribution of the counting error of each counting interval can be made approximately equal, thereby reducing the counting error.
[0088] S103 , determining the number of region objects in each prediction region according to the range of the number of interval objects in the counting interval corresponding to each prediction region.
[0089] In some feasible implementations, the midpoint value of the range of the number of interval objects in the counting interval corresponding to each of the above prediction regions is determined as the number of region objects in each of the above prediction regions. Specifically, if the counting interval of the i-th prediction region among the above prediction regions is [10, 20], the midpoint value 15 of the interval [10, 20] is used as the number of region objects in the i-th prediction region.
[0090] S104 , determining an estimated number of objects in the image to be recognized according to the number of area objects in each prediction area.
[0091] In some feasible implementations, if the number of regional objects in each of the above-mentioned prediction regions has been determined, the number of regional objects in each prediction region may be summed up to obtain the estimated number of objects in the image to be recognized.
[0092] In an embodiment of the present application, after acquiring an image to be identified, the image to be identified is input into a trained object number prediction network to determine a region category label for each prediction region in the image to be identified. The image to be identified includes multiple prediction regions, each corresponding to a region category label. Based on the region category labels of each prediction region, a counting interval corresponding to each prediction region is determined from multiple counting intervals. Each of the multiple counting intervals has the same interval parameter, which is determined by the number of objects in the interval and the interval length, thereby simultaneously taking into account the balance of the number of objects in the interval and the balance of the interval length, thereby achieving higher counting accuracy. The number of objects in each prediction region is then determined based on the optimized range of the number of objects in the counting interval corresponding to each prediction region, and the estimated number of objects in the image to be identified is determined based on the number of objects in each prediction region. The method proposed in the embodiment of the present application significantly improves the accuracy of image recognition object number estimation by predicting the region category label for each prediction region and then determining the range of the number of objects in the region based on the counting intervals with the same optimized interval parameters. The method is simple to operate and highly applicable.
[0093] For some possible implementations, please refer to Figure 7 , Figure 7 This is a flow chart of the training method of the object quantity prediction network provided by the embodiment of the present application. Figure 1 or Figure 2 The user terminal shown in FIG) can also be executed by the user terminal and the service server (as shown above Figure 1 or Figure 2 The training method of the object quantity prediction network may include at least the following steps S201 to S205:
[0094] S201 , obtaining a sample image, and generating a sample density map corresponding to the sample image according to the center point of the head of the identification object in the sample image.
[0095] In some feasible implementations, the identification object of the sample image may be a person. In order to obtain the density map corresponding to the sample image, the center points of the N heads in the sample image are recorded as X1...X i , for each head center point X i Generate a two-dimensional response graph H separately i In this response graph, only the pixel value of the center of the head is 1, and the rest of the pixels are 0. iThe sum of these values yields the response map H for all heads in the sample image. Assuming that the contribution of each head to the density of its surrounding pixels decays according to a Gaussian function, a convolution operation is performed on the response map H using a normalized Gaussian kernel to yield the sample density map corresponding to the sample image.
[0096] S202 , determining a plurality of regions from the sample density map, and determining the number of identification objects in any region according to the density value of a unit pixel in any region of the plurality of regions.
[0097] In some feasible implementations, the above-mentioned sample density map is divided into multiple regions, and the identification object density value of each pixel in each region is calculated. Here, the pixel is the smallest unit in the sample image. The identification object density value of each pixel in each of the above-mentioned regions is summed to obtain the number of identification objects in this region.
[0098] S203 : Determine a target counting interval corresponding to the number of recognized objects in any area according to the range of the number of objects in each counting interval corresponding to each counting interval.
[0099] In some feasible implementations, based on the range of the number of objects in each counting interval corresponding to a plurality of counting intervals, the target range of the number of objects in any of the above-mentioned areas is determined, and the counting interval corresponding to the target range of objects is determined as the target counting interval. The interval parameters of each preset interval in the above counting interval are the same, and the above interval parameters are determined by the number of objects in the interval and the interval length. For the specific method of determining the counting interval, please refer to Figure 3 The specific implementation of the corresponding step S103 will not be repeated here.
[0100] Specifically, according to the same division method of the interval parameters of each counting interval, the target interval object number range to which the number of identified objects in any area belongs is divided, and the counting interval corresponding to the target interval object number range is used as the target identification object number interval. Figure 5 In 5b, it can be understood that the number of area objects in 5b is 6. If the target interval number of objects corresponding to the number of area objects 6 in each counting interval is [6, 10], then the target counting interval of the area is [6, 10].
[0101] S204: Determine a region category label for any region according to the interval category of the target counting interval corresponding to the target recognition object quantity interval.
[0102] In some feasible implementations, each of the multiple counting intervals corresponds to an interval category label. The category label of any counting interval is used to mark the range of the number of objects in the interval. Therefore, the target counting interval corresponds to an interval category of a target counting interval, and the region category label of any region is determined based on the interval category of the target counting interval. For example, if the target counting interval corresponding to the target object number interval is [6, 10], and the counting interval [6, 10] belongs to category 2, and the region category label of category 2 is C2, then C2 is used as the region category label for the target object number interval.
[0103] S205 , training an object quantity prediction network according to the sample density map and the region category labels of each region in the sample density map, so that the object quantity prediction network outputs the region category label of any region.
[0104] In some feasible implementations, the object quantity prediction network is trained using a loss function based on the true region category labels of each region in the sample density map and the region category labels of each region in the sample density map, so that the region category label of any region in the sample density map output by the object quantity prediction network becomes closer and closer to the true category label of any of the above regions. The loss function here is used to estimate the degree of inconsistency between the region category label and the true region category label. The loss value is calculated based on the difference between the region category label and the true region category label, and the above object quantity prediction network is adjusted by the calculated loss value. If the loss value meets the network convergence condition, it can be considered that the prediction result of the object quantity prediction network at this time is sufficiently accurate, and based on the trained object quantity prediction network, the region category label of any region can be output.
[0105] In the present application, a sample image can be used to train an object quantity prediction network, wherein the sample image may include sample objects (e.g., human portraits, animals, etc.), and multiple regions are determined by a sample density map corresponding to the sample image, and the number of identified objects in any region is determined based on the density value of a unit pixel in any region of the multiple regions. According to the interval object quantity range corresponding to each counting interval in a plurality of counting intervals, a target identification object quantity interval corresponding to the number of identified objects in any region is determined, and the region category label of any region is determined based on the interval category of the target counting interval corresponding to the target identification object quantity interval. The interval parameters of each preset interval in the above counting interval are the same, and the above interval parameters are determined by the number of interval objects and the interval length. Through the training of the above sample images, the region category labels of each predicted region output by the object quantity prediction network can be made more and more accurate. The region object quantity of each predicted region is determined based on the interval object quantity range of the optimized counting interval corresponding to each predicted region, and the estimated number of identified objects in the above image to be identified is determined based on the region object quantity of each predicted region. By adopting the method provided in this application, the object quantity prediction network can be optimized through training with sample images, so that the regional category labels of each prediction area output by the object quantity prediction network can become more and more accurate. In combination with the method of evenly dividing the counting intervals by taking into account the number of objects in the interval and the length of the interval, the accuracy of the number estimation of image recognition objects is improved, and the operation is simple and the applicability is high.
[0106] Further, see Figure 8 , Figure 8 This is a schematic diagram of a structure of a device for estimating the number of image recognition objects provided by the present application. The device for estimating the number of image recognition objects can be a computer program (including program code) running on a computer device. For example, the device for estimating the number of image recognition objects is an application software; the device can be used to execute the corresponding steps of the method provided by the present application. Figure 8 As shown, the device for estimating the number of image recognition objects includes: a first acquisition module 10 , a first output module 20 , a first determination module 30 , a second determination module 40 , and a third determination module 50 .
[0107] A first acquisition module 10 is used to acquire an image to be identified;
[0108] A first determination module 20 is configured to input the image to be identified obtained by the first acquisition module into an object quantity prediction network, and determine a region category label of each predicted region in the image to be identified through the object quantity prediction network;
[0109] a second determining module 30 configured to determine, based on the region category labels of the respective prediction regions, a counting interval corresponding to each prediction region from a plurality of counting intervals, and determine the number of region objects in each prediction region according to a range of the number of interval objects in the counting interval corresponding to each prediction region, wherein each of the plurality of counting intervals has the same interval parameter, which is determined by the number of interval objects and the interval length;
[0110] The third determining module 40 is configured to determine an estimated number of objects in the to-be-recognized image according to the number of objects in each of the predicted regions.
[0111] In a possible implementation, please refer to Figure 9 , the above-mentioned device further includes:
[0112] A second acquisition module 50 is used to acquire a sample image;
[0113] A second output module 60 is configured to generate a sample density map corresponding to the sample image according to the center point of the head of the identified object in the sample image;
[0114] A fourth determining module 70 is configured to determine a plurality of regions from the sample density map, and determine the number of identification objects in any of the plurality of regions based on the density value of a unit pixel in any of the plurality of regions;
[0115] a fifth determining module 80 for determining a target counting interval corresponding to the number of identified objects in any of the aforementioned regions based on the range of the number of objects in each counting interval, and for determining a region category label for any of the aforementioned regions based on the interval category of the target counting interval, wherein the region category label for any of the aforementioned regions is used to mark the range of the number of objects in any of the aforementioned regions;
[0116] The first training module 90 is used to train the object quantity prediction network according to the sample density map and the region category labels of each region in the sample density map, so that the object quantity prediction network outputs the region category label of any region.
[0117] In a possible implementation manner, the fifth determining module 80 is further configured to:
[0118] The target interval object number range to which the number of identified objects in any area belongs is determined according to the interval object number range corresponding to each counting interval, and the counting interval corresponding to the target area object number range is determined as the target counting interval.
[0119] In a possible implementation, please refer to Figure 9 , the above-mentioned device further includes:
[0120] A third acquisition module 100 is used to acquire a plurality of sample image blocks for determining a counting interval;
[0121] A sixth determining module 110 is configured to determine the number of first intervals of the counting intervals and an interval parameter search range of the interval parameter;
[0122] a seventh determining module 120 configured to determine a target interval parameter search range by a binary search method based on the plurality of sample image blocks, the number of objects in each sample image block, and the interval parameter search range, wherein the target interval parameter search range is an interval parameter search range in which the number of counting intervals obtained by dividing the plurality of sample image blocks equals the number of first intervals and the interval parameters of the counting intervals are the same;
[0123] The eighth determining module 130 is configured to determine the midpoint value of the target interval parameter search range as the target interval parameter, and determine the multiple counting intervals obtained by dividing the target interval parameter as multiple counting intervals.
[0124] In a possible implementation manner, the seventh determining module further includes:
[0125] an initial interval number determining unit 1201, configured to determine the minimum parameter threshold of the interval parameter search range as the initial interval parameter, and determine the initial interval number of the counting intervals obtained by dividing the counting intervals based on the plurality of sample image blocks, the number of objects in each sample image block, and the initial interval parameter;
[0126] a target interval parameter determining unit 1202 configured to, if the initial number of intervals is not equal to the first number of intervals, adjust the interval parameter search range based on a vertex of the interval parameter search range, determine a minimum parameter threshold of the adjusted interval parameter search range as the initial interval parameter, and perform a step of determining an initial number of intervals of the counting intervals obtained by dividing the counting intervals based on the plurality of sample image blocks, the number of objects in each sample image block, and the initial interval parameter;
[0127] If the number of the initial intervals is equal to the number of the first intervals, the interval parameter search range is determined as the target interval parameter search range.
[0128] In a possible implementation, each of the multiple counting intervals corresponds to an interval category label, and the interval category label of any counting interval is used to mark the range of the number of interval objects in the any counting interval; and the second determining module 30 is further configured to:
[0129] A counting interval in the plurality of counting intervals having the same interval category label as the area category label of any prediction area is determined as the counting interval corresponding to the any prediction area, so as to obtain the counting interval corresponding to each prediction area.
[0130] In a possible implementation manner, the second determining module 30 is further configured to:
[0131] The midpoint value of the interval object quantity range of the counting interval corresponding to any prediction region is determined as the region object quantity of any prediction region, so as to obtain the region object quantity of each prediction region.
[0132] The specific implementation of the first acquisition module 10, the first determination module 20, the second determination module 30, and the third determination module 40 can be found in the above Figure 3 The description of steps S101 to S104 in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated here either.
[0133] For further information, see Figure 10 , Figure 10 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 10 As shown, the computer device 2000 can be applied to a server, which can be the above-mentioned Figure 1 The business server 100 in the corresponding embodiment; the computer device 2000 can be applied to a terminal, which can be the above-mentioned Figure 1 The user terminal 10a, user terminal 10b, ..., user terminal 10n in the corresponding embodiment; the computer device 2000 can also be the above-mentioned Figure 3 The computer device in the corresponding embodiment. The computer device 2000 may include: a processor 2001, a network interface 2004 and a memory 2005. In addition, the above-mentioned computer device 2000 also includes: a transceiver 2003, and at least one communication bus 2002. Among them, the communication bus 2002 is used to realize the connection and communication between these components. The network interface 2004 may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface). The memory 2005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 2005 may optionally also be at least one storage device located away from the aforementioned processor 2001. As Figure 10 As shown, the memory 2005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application.
[0134] exist Figure 10In the computer device 2000 shown, the network interface 2004 can provide network communication functions; the processor 2001 and the transceiver 2003 can be used to call the device control application stored in the memory 2005 to achieve:
[0135] The transceiver 2003 is used to obtain the image to be recognized;
[0136] The processor 2001 is configured to input the image to be identified into an object quantity prediction network, and determine a region category label for each predicted region in the image to be identified through the object quantity prediction network;
[0137] The processor 2001 is configured to determine, based on the region category labels of the respective prediction regions, a counting interval corresponding to each prediction region from a plurality of counting intervals, and determine the number of region objects in each prediction region according to a range of the number of interval objects in the counting interval corresponding to each prediction region, wherein each of the plurality of counting intervals has the same interval parameter, which is determined by the number of interval objects and the interval length;
[0138] The processor 2001 is configured to determine an estimated number of objects in the image to be identified based on the number of objects in each of the prediction regions.
[0139] In a possible implementation, the processor 2001 is further configured to:
[0140] Generating a sample density map corresponding to the sample image according to the center point of the head of the identification object in the sample image obtained by the transceiver 2003;
[0141] Determine a plurality of regions from the sample density map, and determine the number of identification objects in any of the plurality of regions based on the density value of a unit pixel in any of the plurality of regions;
[0142] Determine a target counting interval corresponding to the number of identified objects in any area according to the range of the number of objects in each counting interval, and determine a region category label for any area according to the interval category of the target counting interval, wherein the region category label for any area is used to mark the range of the number of objects in any area;
[0143] The object quantity prediction network is trained according to the sample density map and the region category labels of each region in the sample density map, so that the object quantity prediction network outputs the region category label of any region.
[0144] In a possible implementation, the processor 2001 is further configured to:
[0145] The target interval object number range to which the number of identified objects in any area belongs is determined according to the interval object number range of each counting interval, and the counting interval corresponding to the target area object number range is determined as the target counting interval.
[0146] In a possible implementation, the processor 2001 is further configured to:
[0147] determining a first interval number and an interval parameter search range for determining the counting interval;
[0148] and determining a target interval parameter search range by a binary search method based on the multiple sample image blocks for determining the counting intervals, the number of objects in each sample image block, and the interval parameter search range obtained by the transceiver 2003. The target interval parameter search range is an interval parameter search range in which the number of counting intervals obtained by dividing the multiple sample image blocks is equal to the number of the first intervals, and the interval parameters of the counting intervals are the same;
[0149] The midpoint value of the target interval parameter search range is determined as the target interval parameter, and the multiple counting intervals obtained by dividing based on the target interval parameter are determined as multiple counting intervals.
[0150] In a possible implementation, the processor 2001 is further configured to:
[0151] Determining a minimum parameter threshold of the interval parameter search range as an initial interval parameter, and determining an initial number of counting intervals obtained by dividing the counting intervals based on the plurality of sample image blocks, the number of objects in each sample image block, and the initial interval parameter;
[0152] If the initial number of intervals is not equal to the first number of intervals, adjusting the interval parameter search range based on the vertex of the interval parameter search range, determining the minimum parameter threshold of the adjusted interval parameter search range as the initial interval parameter, and performing the step of determining the initial number of intervals of the counting intervals obtained by dividing the counting intervals based on the plurality of sample image blocks, the number of objects in each sample image block, and the initial interval parameter;
[0153] If the number of the initial intervals is equal to the number of the first intervals, the interval parameter search range is determined as the target interval parameter search range.
[0154] In a possible implementation, each counting interval in the plurality of counting intervals corresponds to an interval category label, and the interval category label of any counting interval is used to mark a range of the number of interval objects in the any counting interval; and the processor 2001 is further configured to:
[0155] The counting intervals among the plurality of counting intervals whose interval category labels are the same as the area category label of any prediction area are determined as the counting intervals corresponding to the any prediction area, so as to obtain the counting intervals corresponding to each prediction area.
[0156] In a possible implementation, the processor 2001 is further configured to:
[0157] The midpoint value of the range of the number of interval objects in the counting interval corresponding to any one of the above-mentioned prediction regions is determined as the number of region objects in the above-mentioned prediction region.
[0158] It should be understood that the computer device 2000 described in the embodiment of the present application can execute the above Figure 3 and / or Figure 7 The description of the corresponding embodiment can also be performed Figure 8 and / or Figure 9 The description of the apparatus for estimating the number of image-recognized objects in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated here either.
[0159] In addition, it should be pointed out here that: the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the aforementioned image recognition object quantity estimation device, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the aforementioned Figure 3 and / or Figure 7 The description of the method for estimating the number of image recognition objects in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, the program instructions can be deployed to be executed on one computing device, or on multiple computing devices located in one location.
[0160] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The above-mentioned program can be stored in a computer-readable storage medium. When executed, the program can include the processes of the above-mentioned method embodiments. The above-mentioned computer-readable storage medium can be a control device for a power converter provided in any of the above-mentioned embodiments or an internal storage unit of the above-mentioned device, such as a hard disk or memory of an electronic device. The computer-readable storage medium can also be an external storage device of the electronic device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device. The above-mentioned computer-readable storage medium can also include a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory, etc. Furthermore, the computer-readable storage medium can also include both the internal storage unit of the electronic device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and quantities required by the electronic device. The computer-readable storage medium can also be used to temporarily store data that has been output or is about to be output.
[0161] The terms "first," "second," and the like in the claims, specification, and drawings of the present invention are used to distinguish between different objects, not to describe a specific order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device comprising a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or device. Reference herein to an "embodiment" means that a particular feature, structure, or characteristic described in conjunction with the embodiment may be included in at least one embodiment of the present invention. The presence of such a phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments. The term "and / or," as used in the specification and appended claims of the present invention, refers to any and all possible combinations of one or more of the associated listed items, including, but not limited to, those combinations.
[0162] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented using electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the above description generally describes the components and steps of each example according to their functions. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of the present invention.
[0163] The functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0164] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A method for estimating the number of objects in image recognition, characterized in that: The method comprises: Acquire an image to be identified, input the image to be identified into an object quantity prediction network, and determine a region category label of each prediction region in the image to be identified by the object quantity prediction network; Based on the region category labels of the respective prediction regions, determining a counting interval corresponding to each prediction region from a plurality of counting intervals, and determining the number of region objects in each prediction region according to a range of the number of interval objects in the counting interval corresponding to each prediction region, wherein each counting interval in the plurality of counting intervals has the same interval parameter, which is the product of the number of interval objects and the interval length; The estimated number of objects in the image to be recognized is determined according to the number of area objects in each predicted area.
2. The method according to claim 1, characterized in that The method further comprises: Acquire a sample image, and generate a sample density map corresponding to the sample image according to the center point of the head of the identified object in the sample image; Determine a plurality of regions from the sample density map, and determine the number of identification objects in any region according to a density value of a unit pixel in any region of the plurality of regions; Determine a target counting interval corresponding to the number of identified objects in any area according to the range of the number of objects in each counting interval, and determine a region category label for any area according to the interval category of the target counting interval, wherein the region category label for any area is used to mark the range of the number of objects in any area; The object quantity prediction network is trained according to the sample density map and the region category labels of each region in the sample density map, so that the object quantity prediction network outputs the region category label of any region.
3. The method according to claim 2, characterized in that The determining of the target counting interval corresponding to the number of identified objects in any area according to the range of the number of objects in each counting interval includes: A target interval object number range to which the number of identified objects in any area belongs is determined according to the interval object number range of each counting interval, and a counting interval corresponding to the target interval object number range is determined as a target counting interval.
4. The method according to claim 2, characterized in that The method further comprises: Acquire a plurality of sample image blocks for determining a counting interval, and determine a first number of intervals and an interval parameter search range for determining the counting interval; determining a target interval parameter search range by a binary search method based on the multiple sample image blocks, the number of objects in each sample image block, and the interval parameter search range, wherein the target interval parameter search range is an interval parameter search range in which the number of counting intervals obtained by dividing the multiple sample image blocks is equal to the number of the first intervals and the interval parameters of the counting intervals are the same; The midpoint value of the target interval parameter search range is determined as the target interval parameter, and the multiple counting intervals obtained by dividing based on the target interval parameter are determined as multiple counting intervals.
5. The method according to claim 4, characterized in that The step of determining a target interval parameter search range by a binary method based on the plurality of sample image blocks, the number of objects in each sample image block, and the interval parameter search range includes: Determining a minimum parameter threshold of the interval parameter search range as an initial interval parameter, and determining an initial interval number of counting intervals obtained by dividing the counting intervals based on the plurality of sample image blocks, the number of objects in each sample image block, and the initial interval parameter; If the initial number of intervals is not equal to the first number of intervals, adjusting the interval parameter search range based on the vertex of the interval parameter search range, determining the minimum parameter threshold of the adjusted interval parameter search range as the initial interval parameter, and performing the step of determining the initial number of intervals of the counting intervals obtained by dividing the counting intervals based on the multiple sample image blocks, the number of objects in each sample image block, and the initial interval parameter; If the initial interval number is equal to the first interval number, the interval parameter search range is determined as the target interval parameter search range.
6. The method according to any one of claims 1 to 5, characterized in that One counting interval in the plurality of counting intervals corresponds to one interval category label, and the interval category label of any counting interval is used to mark the range of the number of interval objects in the any counting interval; The determining, based on the region category labels of the respective predicted regions, from a plurality of counting intervals, a counting interval corresponding to each predicted region includes: A counting interval in the plurality of counting intervals having the same interval category label as the area category label of any prediction area is determined as the counting interval corresponding to the any prediction area, so as to obtain the counting interval corresponding to each prediction area.
7. The method according to claim 6, characterized in that The determining the number of area objects in each prediction area according to the range of the number of interval objects in the counting interval corresponding to each prediction area includes: The midpoint value of the interval object quantity range of the counting interval corresponding to any prediction region is determined as the region object quantity of any prediction region, so as to obtain the region object quantity of each prediction region.
8. A device for estimating the number of objects recognized by image recognition, characterized in that: The device comprises: An acquisition module, used to acquire an image to be identified; a first determining module, configured to input the image to be identified acquired by the acquiring module into an object quantity prediction network, and determine a region category label of each predicted region in the image to be identified through the object quantity prediction network; a second determining module, configured to determine, based on the region category labels of the respective prediction regions, a counting interval corresponding to the respective prediction regions from a plurality of counting intervals, and determine the number of region objects in the respective prediction regions according to a range of the number of interval objects in the counting interval corresponding to the respective prediction regions, wherein each of the plurality of counting intervals has the same interval parameter, which is the product of the number of interval objects and the interval length; The third determining module is configured to determine an estimated number of objects in the to-be-identified image according to the number of area objects in each prediction area.
9. A computer device, characterized in that: include: processors, transceivers, memory, and network interfaces; The processor is connected to a memory, a transceiver, and a network interface, wherein the network interface is used to provide a data communication function, the memory is used to store program code, and the transceiver and the processor are used to call the program code to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the method according to any one of claims 1 to 7 is executed.
Citation Information
Patent Citations
Pedestrian flow monitoring method and device, storage medium and equipment
CN109697435A
A method and device for detecting the number of people in a monitoring video
CN109918971A