An object counting method, device and electronic equipment based on image processing

By using image processing technology to detect the position of the target object and calculate the difference in the position of the center point, the problem that the counting sensor in the existing technology cannot identify non-target objects is solved, and the target object can be counted quickly and accurately.

CN114972188BActive Publication Date: 2026-02-10CHONGQING XINXING SYNCHRONOUS LOGISTICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210433046.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-22
Publication Date
2026-02-10
Estimated Expiration
2042-04-22

AI Technical Summary

Technical Problem

In existing technologies, there are hardware limitations when counting target objects, which leads to high costs for manual counting and the inability of counting sensors to identify non-target objects, thus affecting the accuracy of counting.

Method used

An image processing-based method is adopted to detect the position of target objects in image frames using a preset detection model, calculate the difference in the position of the center point, and use a preset threshold to determine the update of the number of target objects.

Benefits of technology

It improves the accuracy of target object recognition, prevents misidentification, and enables fast and accurate target object counting.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114972188B_ABST
    Figure CN114972188B_ABST
Patent Text Reader

Abstract

The application discloses an image processing-based target object counting method and device and electronic equipment, and relates to the technical field of image processing. The method comprises the following steps: acquiring the center point positions of a plurality of target objects in a current image frame and acquiring the center point positions of the plurality of target objects in a previous image frame; and if the distance difference between the center position of a target object located at a set layer in the current image frame and the center point position of the target object in the previous image frame is greater than or equal to a preset threshold, the number of the plurality of target objects is updated. The accuracy of target object identification is ensured through target detection, the situation of target object misidentification during real-time counting is prevented, the distance difference between the center position in the current image frame and the center point position in the previous image frame is used for preset threshold judgment, so that the target object that needs to be counted is quickly determined, and the target object can be accurately and quickly counted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and more specifically to a method, apparatus, and electronic device for counting target objects based on image processing. Background Technology

[0002] In existing technologies, real-time counting of target objects is often limited by hardware conditions, relying on manual counting or the installation of counting sensors. However, manual counting is inaccurate due to limitations in the counting person's memory and recording capabilities, and it is also costly. To save costs and ensure accuracy, existing technologies also use counting sensors to count target objects. However, these sensors only have a single counting function and cannot identify the target object. When non-target objects are included in the count, the sensor will count them as well, affecting the accuracy of the target object count. Summary of the Invention

[0003] In view of this, the present invention provides a target object counting method, apparatus and electronic device based on image processing to solve the problem of target object misidentification during real-time counting, which leads to inaccurate target object counting.

[0004] Firstly, this application provides a target object counting method based on image processing, comprising:

[0005] Get the current image frame;

[0006] The current image frame is input into a preset detection model, and the positions of multiple target objects in the current image frame are detected by the preset detection model.

[0007] The center point position of the multiple target objects in the current image frame is determined based on the positions of the multiple target objects;

[0008] Obtain the center point position of the multiple target objects in the previous image frame;

[0009] If the distance difference between the center position of a target object located in a set layer in the current image frame and the center position in the previous image frame is greater than or equal to a preset threshold, then the number of the multiple target objects is updated.

[0010] The image processing-based target object counting method provided in this application detects target objects by inputting the current image frame into a preset detection model, outputting the positions of multiple target objects in the current image frame, and determining the center point positions of multiple target objects in the current image frame from their positions. Then, it obtains the center point positions of these target objects in the previous image frame and calculates the distance difference between the center position of a target object located at a set layer in the current image frame and its center position in the previous image frame. If the distance difference is greater than or equal to a preset threshold, it indicates the presence of a new target object in the current image frame, requiring an update to the target object count. Utilizing a preset detection model improves the accuracy of target object recognition and prevents misidentification during real-time counting. Using the distance difference between the center positions in the current and previous image frames to determine the preset threshold allows for rapid identification of target objects requiring counting, thus enabling the counting of the current number of target objects.

[0011] Optionally, the step of inputting the current image frame into a preset detection model and detecting the positions of multiple target objects in the current image frame using the preset detection model includes:

[0012] The current image frame is convolved using the preset detection model to obtain target feature maps of various scales.

[0013] Multiple target objects in the current image frame are determined based on the target feature map;

[0014] Key point detection is performed on the multiple target objects to obtain the coordinate values ​​of the key points of the multiple target objects.

[0015] Optionally, determining the center point position of the plurality of target objects in the current image frame based on their positions includes:

[0016] Obtain the coordinate values ​​of at least two key points in the target object, and use the average value of the coordinate values ​​of the at least two key points as the coordinate value of the center point of the target object.

[0017] The target object counting method based on image processing provided in this application obtains target feature maps of various scales by performing convolution operations on the current image frame, thereby realizing the detection of target objects of different scales; secondly, key point detection is performed on the detection results of the target objects, and the coordinate values ​​of the key points of the target objects are output. Then, the coordinate values ​​of the center point of the target objects are calculated using the coordinate values ​​of the key points of the target objects, and the coordinate values ​​of the center point of the target objects are used to facilitate the localization of the target objects, which is convenient for subsequent counting of the number of target objects.

[0018] Optionally, after obtaining the center point positions of the plurality of target objects in the previous image frame, the method further includes:

[0019] Based on the center point positions of the multiple target objects in the previous image frame and the preset coordinate values, calculate the center point loss value of the multiple target objects in the current image frame.

[0020] The center point position of each target object in the current image frame is adjusted based on the center point loss value of the multiple target objects in the current image frame.

[0021] Optionally, the formula for the loss value of the center point of the target object in the current image frame is:

[0022]

[0023] Where, loss c D represents the loss value at the center point of the target object in the current image frame. t-c B t-c For the preset coordinate values, D c B c The coordinates of the center point of the target object in the previous image frame are given, ε represents the preset deviation value, and A is 10.

[0024] The target object counting method based on image processing provided in this application calculates the center point loss value of the target object in the current image frame, adjusts the center point position in the current image frame using the center point loss value, and corrects the center point coordinates of the target object, thereby making the counting of target objects more realistic and accurate.

[0025] Optionally, the method further includes:

[0026] Calculate the distance difference between the center point coordinates of the multiple target objects in the current image frame and the center point coordinates in the previous image frame;

[0027] If the distance difference is less than the preset threshold, then the multiple target objects in the previous image frame and the multiple target objects in the current image frame are determined to be the same target objects.

[0028] The target object counting method based on image processing provided in this application can accurately count target objects by calculating the distance difference between the center point coordinates of multiple target objects in the current image frame and the center point coordinates in the previous image frame. If the distance difference is less than a preset threshold, the multiple target objects in the previous image frame and the multiple target objects in the current image frame are identified as the same target objects. By identifying the multiple target objects as the same target objects in the current image frame, the misidentification of target objects is avoided, and the accuracy of target object counting is ensured.

[0029] Optionally, if the distance difference between the center position of a target object located in a set layer in the current image frame and its center position in the previous image frame is greater than or equal to a preset threshold, then updating the number of the multiple target objects includes:

[0030] If the center point coordinates of the multiple target objects in the previous image frame are less than or equal to a preset coordinate threshold, and the center point coordinates of the multiple target objects in the current image frame are greater than the preset coordinate threshold, then the number of the multiple target objects is updated.

[0031] The target object counting method based on image processing provided in this application determines new target objects in the current image frame by setting a preset coordinate threshold, judging that the center point coordinates of multiple target objects in the previous image frame are less than or equal to the preset coordinate threshold, and judging that the center point coordinates of the multiple target objects in the current image frame are greater than the preset coordinate threshold, thereby updating the number of target objects in the current image frame, and thus achieving accurate and fast counting of target objects.

[0032] Secondly, this application provides a target object counting device based on image processing, the device comprising:

[0033] The first acquisition module is used to acquire the current image frame; the detection module is used to input the current image frame into a preset detection model and detect the positions of multiple target objects in the current image frame through the preset detection model.

[0034] The determining module is used to determine the center point position of the plurality of target objects in the current image frame based on the positions of the plurality of target objects;

[0035] The second acquisition module is used to acquire the center point position of the multiple target objects in the previous image frame;

[0036] The update module is used to update the number of the multiple target objects if the distance difference between the center position of the target object located in the set layer in the current image frame and the center point position in the previous image frame is greater than or equal to a preset threshold.

[0037] The image processing-based target object counting device provided in this application acquires the current image frame through a first acquisition module, then sends the current image frame to a detection module for target object detection, outputs the positions of multiple target objects, then sends the position information of the multiple target objects to a determination module, and determines the center point positions of the multiple target objects in the current image frame from the determination module. Then, the second acquisition module acquires the center point positions of the multiple target objects in the previous image frame, and sends the center point positions in the previous image frame and the current image frame to an update module to update the number of the multiple target objects, so as to quickly determine the target objects that need to be counted.

[0038] Thirdly, embodiments of the present invention provide an electronic device, including: a memory and a processor, wherein the memory stores a computer program, and the computer program is executed by the processor to perform the target object counting method based on image processing as described in the first aspect or any embodiment of the first aspect.

[0039] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program, the computer program being executed by a processor using the image processing-based target object counting method described in the first aspect or any embodiment of the first aspect. Attached Figure Description

[0040] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0041] Figure 1 A flowchart of a target object counting method based on image processing provided in an embodiment of the present invention;

[0042] Figure 2 This is a flowchart of step S2 in the image processing-based target object counting method provided in this embodiment;

[0043] Figure 3 This is a flowchart of steps S41 to S42 in the image processing-based target object counting method provided in this embodiment;

[0044] Figure 4 This is a flowchart of steps S61 to S62 in the image processing-based target object counting method provided in this embodiment;

[0045] Figure 5 This is a structural block diagram of a target object counting device based on image processing provided in this embodiment;

[0046] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an optional embodiment of the present invention.

[0047] Figure label:

[0048] 1-First acquisition module; 2-Detection module; 3-Determination module; 4-Second acquisition module; 5-Update module; 6-Memory; 7-Processor. Detailed Implementation

[0049] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0050] The technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0051] It should be noted that the target object counting method based on image processing provided in this embodiment of the invention can count objects such as plates, fruits, and books. Furthermore, in this embodiment, the hardware device implementing the target object counting method provided in this application can include an image acquisition device (e.g., a camera) and a background processor (e.g., a computer). The image acquisition device acquires image frames and transmits the acquired image frames to the background processor for image frame analysis (i.e., implementing the target object counting method provided in this application in the background processor), and then the background processor outputs the target object counting result.

[0052] Please see Figure 1 , Figure 1 This is a flowchart of a target object counting method based on image processing according to an embodiment of the present invention. Specifically, the target object counting method based on image processing can be used to count the number of multiple stacked target objects. The flowchart of the target object counting method includes the following steps:

[0053] S1, Get the current image frame.

[0054] In this embodiment, the current image frame can be an image frame of a target object in the current scene (e.g., a tray recycling room in a cafeteria) captured by an image acquisition device (e.g., an image of a tray in the tray recycling room). The captured image frame of the target object is then transmitted to the background processor in real time, where the background processor detects and analyzes the captured current image frame. For example, employees place their finished meals on trays in the tray recycling room, where a camera is installed to record images of the trays. The camera captures images of the trays in the tray recycling room in real time and transmits these images to the background processor.

[0055] S2, input the current image frame into the preset detection model, and use the preset detection model to detect the positions of multiple target objects in the current image frame.

[0056] In this embodiment, in order to perform target detection quickly and efficiently, the preset detection model can use the lightweight RFSong-779 target detection network to detect target objects in the current image frame. After the detection network detects the target object, it is also necessary to perform key point detection on the multiple detected target objects and output the positions of multiple target objects in the current image frame.

[0057] Optionally, the positions of multiple target objects can be the center coordinates of each target object.

[0058] Optionally, the position of the target object can also be the coordinates of key points of the target object in the current image frame. The key point coordinates can be the coordinates of the four corners of the rectangular selection box that determines the target object.

[0059] To ensure the accuracy of object detection results, the object detection network can be configured to detect objects of a specified type. For example, when performing object detection on an image frame, since the target object is pre-specified as a plate, the object detection network / model will only detect plates in the image frame.

[0060] In this embodiment, the position of each target object may include at least two coordinate values. By feeding the image of the cafeteria plates into a preset detection model, the preset detection model detects the positions of multiple target objects (plates) one by one, and outputs the coordinate positions of the target objects.

[0061] S3, determine the center point position of multiple target objects in the current image frame based on the positions of multiple target objects.

[0062] In this embodiment, in order to accurately count the number of target objects, the center point position of a single target object in the current image frame can be determined by calculating the average value of the coordinates of multiple key points of a single target object.

[0063] S4, obtain the center point position of multiple target objects in the previous image frame.

[0064] In this embodiment, to facilitate data analysis, after the background processor counts the image frames of the target object, it stores the data generated during the counting process (e.g., the center point position in the previous image frame, the number of counts in the previous image frame), so that the user can detect and count the target object in the next image frame.

[0065] S5. If the distance difference between the center position of the target object located in the set layer in the current image frame and the center position in the previous image frame is greater than or equal to a preset threshold, then the number of the multiple target objects is updated.

[0066] In this embodiment, the range of the preset threshold can be the range between the center point coordinates in the current image frame and the center point coordinates in the previous image frame. If the distance difference is greater than or equal to the preset threshold, it indicates that there is a new target object in the current image frame. Then, the number of target objects that need to be updated can be calculated based on the distance difference and the height of the target object / the distance between the target objects, thereby realizing real-time statistics of target objects.

[0067] The image processing-based target object counting method provided in this embodiment detects target objects by inputting the current image frame into a preset detection model, outputting the positions of multiple target objects in the current image frame, and determining the center point positions of multiple target objects in the current image frame from their positions. Then, it obtains the center point positions of these target objects in the previous image frame and calculates the distance difference between the center position of a target object located at a set layer in the current image frame and its center position in the previous image frame. If the distance difference is greater than or equal to a preset threshold, it indicates the presence of a new target object in the current image frame, requiring an update to the target object count. Utilizing a preset detection model improves the accuracy of target object recognition and prevents misidentification during real-time counting. Using the distance difference between the center positions in the current and previous image frames to determine the preset threshold allows for rapid identification of target objects requiring counting, thus enabling the counting of the current number of target objects.

[0068] This embodiment provides a target object counting method based on image processing, including:

[0069] like Figure 2 As shown, Figure 2This is a flowchart of step S2 in the image processing-based target object counting method provided in this embodiment. In order to identify target objects and prevent misidentification of target objects in this embodiment, the steps may include:

[0070] S21, perform convolution operation on the current image frame using a preset detection model to obtain target feature maps of various scales.

[0071] S22, determine multiple target objects in the current image frame based on the target feature map.

[0072] In this embodiment, a convolutional network preset in a preset detection model is used to perform convolution operations on the current image frame to output target feature maps of different scales. For example, the size of the current image frame can be 448*448 pixels. The current image frame is input into the convolutional network to output target feature maps of different sizes, such as 56*56, 28*28, 14*14, and 7*7. Then, the output target feature maps are used to detect target objects and output image frames in which the target objects are selected.

[0073] Optionally, when the preset detection model is working, if the resolution of the current image frame is larger, the accuracy of the detection result will be higher. However, for the model, the number of iterations will increase, and the processing time of the current image frame will consume more time as the number of iterations of target detection increases. In order to ensure the efficiency of image frame processing and the accuracy of target object recognition, the size of the current image frame can be set to 448*448 pixels.

[0074] S23, perform key point detection on multiple target objects to obtain the coordinate values ​​of the key points of multiple target objects.

[0075] In this embodiment, after obtaining the image frame of the selected target object, the image frame of the selected target object can be input into the key point detection model for key point detection. The key point detection model outputs the coordinate values ​​of the four vertices of the target object, thereby determining the coordinate values ​​of the key points. By setting the coordinate values ​​of the key points, the range of the target object can be determined, preventing the target object from being missed.

[0076] Optionally, step S3 may also be: obtaining the coordinate values ​​of at least two key points in the target object, and using the average of the coordinate values ​​of the at least two key points as the coordinate value of the center point of the target object.

[0077] In this embodiment, the formula for calculating the coordinates of the center point of the current target object can be:

[0078] Among them, (X) c ,Y cX1 and Y1 are the coordinates of the center point of the target object, respectively, and X1 and Y1 are the coordinates of the first key point of the target object. n and Y n These are the coordinates of the nth key point of the target object.

[0079] Optional, such as Figure 3 As shown, step S3 may include the following:

[0080] S41, Based on the center point positions of multiple target objects in the previous image frame and the preset coordinate values, calculate the center point loss value of multiple target objects in the current image frame.

[0081] S42, adjust the center point position of each target object in the current image frame according to the center point loss value of multiple target objects in the current image frame.

[0082] In existing technologies, target detection is rarely performed on negative sample data (images / frames without target objects) during network training. This results in low accuracy for real-time target object detection, leading to discrepancies between the results and the actual data. To reduce this discrepancy, existing technologies introduce a loss function to correct the data and minimize the difference between training and real data.

[0083] Specifically, the formula for the loss function used in existing technologies is:

[0084]

[0085] Where, loss a D represents the center point loss value. t-a B t-a Indicates the center point position of the correct bounding box, loss a D represents the width and height loss value. a B a This indicates the center point of the predicted bounding box, with A being 10.

[0086] However, based on the loss function used in existing technologies, it can be seen that when a negative sample (the target image is not present in the target frame) is input, the calculated center point loss is a non-zero value, while under normal circumstances, the calculated loss function should be 0 for negative samples. To ensure the consistency of the loss function and the accuracy of the final real-time count, in this embodiment, the formula for calculating the center point loss value of the target object in the current image frame is:

[0087]

[0088] Where, loss c D is represented as the loss value at the center point of the target object. t-c Bt-c D represents the coordinates of the center point of the preset target object. c B c This represents the coordinates of the center point of the target object at the previous moment, ε represents the preset deviation value, and A is 10. Preferably, ε can be 1×10. -6 .

[0089] By improving the loss function, when negative sample data is obtained during training, all inputs are zero, and any newly added terms will also become zero, ultimately resulting in a total loss function value of zero. When positive sample data is obtained during training, the numerator and denominator of the newly added terms differ by a very small value ε, thus the added terms will approach 1, ensuring the authenticity of the data without affecting the calculation of the original loss function.

[0090] Optional, such as Figure 4 As shown, it also includes:

[0091] S61, calculate the distance difference between the center point coordinates of multiple target objects in the current image frame and the center point coordinates in the previous image frame.

[0092] S62, If the distance difference is less than a preset threshold, then multiple target objects in the previous image frame and multiple target objects in the current image frame are identified as the same target objects.

[0093] In this embodiment, to reduce the possibility of false detections, before determining the number of target objects, the center point coordinates of the target object in the current image frame and the center point coordinates in the previous image frame can be obtained to calculate the distance difference between their center point coordinates. The system then determines whether the distance difference meets a preset threshold. If the distance difference meets the preset threshold, it is determined whether the current target object and the target object in the previous frame are the same target object. If the distance difference does not meet the preset threshold, it indicates that the current image frame and the previous image frame are not aligned, or that the target objects in the current image frame and the previous image frame are not the same object. For example, if the preset threshold is 6, and the distance difference is 3, then the current target object and the target object in the previous frame can be determined as the same target object; otherwise, they are not the same target object.

[0094] Optionally, step S5 includes:

[0095] S51, If ​​the center point coordinates of multiple target objects in the previous image frame are less than or equal to a preset coordinate threshold, and the center point coordinates of multiple target objects in the current image frame are greater than the preset coordinate threshold, then the number of multiple target objects is updated.

[0096] In this embodiment, the coordinate threshold is a set of coordinate values ​​of multiple preset targets stored in the background processor based on user experience data. The coordinate threshold in the background processor needs to be updated before each quantity update of the current image frame to accurately identify the number of target objects. In this embodiment, updating the quantity of multiple target objects can be done by counting the number of center point coordinates in the current image frame, or by pre-obtaining a preset spacing between the target objects and a preset coordinate threshold, calculating the difference between the preset coordinate threshold and the center point coordinates of the multiple target objects in the current image frame, and then using the difference between the preset coordinate threshold and the center point coordinates of the multiple target objects in the current image frame, along with the preset spacing, to calculate the number of target objects that need to be updated, and then updating the total number of target objects.

[0097] Accordingly, please refer to Figure 5 , Figure 5 This is a structural block diagram of a target object counting device based on image processing provided in this embodiment. The device includes:

[0098] The first acquisition module 1 is used to acquire the current image frame.

[0099] The detection module 2 is used to input the current image frame into a preset detection model and detect the positions of multiple target objects in the current image frame through the preset detection model.

[0100] The determination module 3 is used to determine the center point position of the multiple target objects in the current image frame based on the positions of the multiple target objects.

[0101] The second acquisition module 4 is used to acquire the center point position of the multiple target objects in the previous image frame.

[0102] Update module 5 is used to update the number of the multiple target objects if the distance difference between the center position of the target object located in the set layer in the current image frame and the center point position in the previous image frame is greater than or equal to a preset threshold.

[0103] In this embodiment, the current image frame is acquired by the first acquisition module 1, and then sent to the detection module 2 for target object detection. The positions of multiple target objects are output, and then the position information of multiple target objects is sent to the determination module 3. The center point positions of multiple target objects in the current image frame are determined from the determination module 3. Then, the center point positions of multiple target objects in the previous image frame are acquired by the second acquisition module 4, and the center point positions in the previous image frame and the current image frame are sent to the update module 5 to update the number of multiple target objects, so as to quickly determine the target objects that need to be counted.

[0104] Please see Figure 6 , Figure 6 This is a schematic diagram of the structure of an electronic device provided in an optional embodiment of the present invention, such as... Figure 6 As shown, the electronic device may include: at least one processor 7, such as a CPU (Central Processing Unit), and a memory 6. The memory and the processor are communicatively connected. The memory 6 may be high-speed RAM (Random Access Memory) or non-volatile memory, such as at least one disk storage device. Optionally, the memory 6 may also be at least one storage device located remotely from the aforementioned processor 7. The processor 7 may be combined with... Figure 5 The described apparatus has an application program stored in memory 6, and a processor 7 calls the program code stored in memory 6 to perform any of the above method steps.

[0105] In addition, memory 6 may include volatile memory, such as random-access memory (RAM); memory may also include non-volatile memory, such as flash memory, hard disk drive (HDD) or solid-state drive (SSD); memory 6 may also include combinations of the above types of memory.

[0106] Processor 7 can be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and an NP. Processor 7 may further include hardware chips. These hardware chips can be application-specific integrated circuits (ASICs), programmable logic devices (PLDs), or combinations thereof. The PLDs can be complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), generic array logic (GALs), or any combination thereof.

[0107] Optionally, memory 6 is also used to store program instructions. Processor 7 can invoke program instructions to implement the functions described in this application. Figures 1 to 4 The image processing-based target object counting method shown in the embodiment.

[0108] This invention also provides a non-transitory computer storage medium storing computer-executable instructions that can execute the imaging method in any of the above-described method embodiments. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium may also include combinations of the above types of memory.

[0109] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.

Claims

1. A target object counting method based on image processing, characterized in that, Includes the following steps: Get the current image frame; By performing convolution operations on the current image frame using a preset detection model, target feature maps of various scales are obtained. Multiple target objects in the current image frame are determined based on the target feature map; Key point detection is performed on the multiple target objects to obtain the coordinate values ​​of the key points of the multiple target objects; Obtain the coordinate values ​​of at least two key points in the target object, and take the average of the coordinate values ​​of the at least two key points as the coordinate value of the center point of the target object; Obtain the center point position of the multiple target objects in the previous image frame; Based on the center point positions of the multiple target objects in the previous image frame and the preset coordinate values, calculate the center point loss value of the multiple target objects in the current image frame. The formula for the loss value of the target object at the center point of the current image frame is: Where, loss c D represents the loss value at the center point of the target object in the current image frame. t-c B t-c D is the coordinate value of the center point of the preset target object. c B c The coordinates of the center point of the target object in the previous image frame are given, ε represents the preset deviation value, and A is 10. Adjust the center point position of the target objects in the current image frame according to the center point loss value of the target objects in the current image frame; If the center point coordinates of the multiple target objects in the previous image frame are less than or equal to a preset coordinate threshold, and the center point coordinates of the multiple target objects in the current image frame are greater than the preset coordinate threshold, then the number of the multiple target objects is updated. The preset coordinate threshold is a set of coordinate values ​​of multiple target objects stored in the background processor by the user based on experience data.

2. The method according to claim 1, characterized in that, Also includes: Calculate the distance difference between the center point coordinates of the multiple target objects in the current image frame and the center point coordinates in the previous image frame; If the distance difference is less than a preset threshold, then the multiple target objects in the previous image frame and the multiple target objects in the current image frame are determined to be the same target objects.

3. A target object counting device based on image processing, characterized in that, include: The first acquisition module is used to acquire the current image frame; The detection module is used to input the current image frame into a preset detection model and detect the positions of multiple target objects in the current image frame through the preset detection model; The determination module is used to perform convolution operations on the current image frame using a preset detection model to obtain target feature maps of various scales. Multiple target objects in the current image frame are determined based on the target feature map; Key point detection is performed on the multiple target objects to obtain the coordinate values ​​of the key points of the multiple target objects; Obtain the coordinate values ​​of at least two key points in the target object, and take the average of the coordinate values ​​of the at least two key points as the coordinate value of the center point of the target object; The second acquisition module is used to acquire the center point position of the multiple target objects in the previous image frame; Based on the center point positions of the multiple target objects in the previous image frame and the preset coordinate values, calculate the center point loss value of the multiple target objects in the current image frame. The center point positions of the target objects in the current image frame are adjusted based on the center point loss values ​​of the target objects in the current image frame; the formula for the center point loss values ​​of the target objects in the current image frame is: Where, loss c D represents the loss value at the center point of the target object in the current image frame. t-c B t-c D is the coordinate value of the center point of the preset target object. c B c The coordinates of the center point of the target object in the previous image frame are given, ε represents the preset deviation value, and A is 10. The update module is used to update the number of multiple target objects if the center point coordinates of the multiple target objects in the previous image frame are less than or equal to a preset coordinate threshold, and the center point coordinates of the multiple target objects in the current image frame are greater than the preset coordinate threshold. The preset coordinate threshold is a set of coordinate values ​​of multiple target objects stored in the background processor by the user based on experience data.

4. An electronic device, characterized in that, include: A memory and a processor, wherein the memory stores a computer program that, when executed by the processor, implements the image processing-based target object counting method as described in claim 1 or 2.

5. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the target object counting method based on image processing as described in claim 1 or 2.

Citation Information

Patent Citations

  • An automatic counting method of wheat spider based on the combination of multi-scale feature fusion network and localization model

    CN109145770A

  • Blood cell image detection and counting method based on convolutional neural network

    CN112750117A