CN110956609A - Object quantity determination method and device, electronic equipment and readable medium - Google Patents

Object quantity determination method and device, electronic equipment and readable medium Download PDF

Info

Publication number
CN110956609A
CN110956609A CN201910985368.0A CN201910985368A CN110956609A CN 110956609 A CN110956609 A CN 110956609A CN 201910985368 A CN201910985368 A CN 201910985368A CN 110956609 A CN110956609 A CN 110956609A
Authority
CN
China
Prior art keywords
age
determining
day
image
frame information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910985368.0A
Other languages
Chinese (zh)
Other versions
CN110956609B (en
Inventor
苏睿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Haiyi Tongzhan Information Technology Co Ltd
Original Assignee
Beijing Haiyi Tongzhan Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Haiyi Tongzhan Information Technology Co Ltd filed Critical Beijing Haiyi Tongzhan Information Technology Co Ltd
Priority to CN201910985368.0A priority Critical patent/CN110956609B/en
Publication of CN110956609A publication Critical patent/CN110956609A/en
Application granted granted Critical
Publication of CN110956609B publication Critical patent/CN110956609B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/30Subject of image; Context of image processing
    • G06T2207/30242Counting objects in image
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Abstract

The application relates to a method and a device for determining the number of objects, electronic equipment and a readable medium, and the method comprises the steps of firstly acquiring an acquired image which is acquired by an image acquisition device and contains a target object; then, the acquired image is input into a pre-established bundle identification model, whether the target object in the acquired image is bundled or not is detected by using the bundle identification model, whether the target object bundle condition exists in the acquired image or not is detected, the error in counting the number of the target objects is avoided when the bundle condition exists, if the detection result is that the target object in the acquired image is not bundled, the number of the target objects in the acquired image is calculated, the number of the target objects is ensured to be counted under the condition that the target object is not bundled, and the accuracy of the result of counting the target objects is improved.

Description

Object quantity determination method and device, electronic equipment and readable medium
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a method and an apparatus for determining a number of objects, an electronic device, and a readable medium.
Background
The pig breeding industry in China is listed in the top world, and intelligent deployment in farms plays a key role. In an intelligent system of a pig farm, counting the number of target objects in each column is an important link of pig farm management, and the correctness of the counted number of the target objects directly relates to the reliability of subsequent pig farm data analysis.
However, when the intelligent system of the pig farm checks the number of the target objects, if the target objects are piled up, the accuracy of checking the number of the target objects is affected.
Disclosure of Invention
In order to solve the technical problem or at least partially solve the technical problem, the application provides an object quantity determining method, an object quantity determining device, an electronic device and a readable medium.
In a first aspect, the present application provides a method for determining a number of objects, where the method for determining a number of objects includes:
acquiring an acquired image which is acquired by an image acquisition device and contains a target object;
inputting the acquired image into a pre-established bunching identification model, and detecting whether a target object in the acquired image is bunched or not by using the bunching identification model;
and if the target objects in the acquired image are not piled, counting the number of the target objects in the acquired image to obtain the number of the target objects.
Optionally, the ages in days of the target objects in the acquired images are the same; inputting the collected image into a pre-established bundle pile identification model, comprising the following steps:
acquiring the age of the target object;
determining the age period of the day;
acquiring a bundling identification model corresponding to the age of day;
and inputting the acquired image into the bunching identification model corresponding to the age of day.
Optionally, the building process of the bundle identification model includes:
obtaining a plurality of sample images, wherein the sample images comprise pre-labeled object frames, the object frames comprise at least two object bunkers, and the object objects in the collected images have the same age in days;
determining object frame information of an object frame in each sample image;
training a bunching recognition model by using the sample image and the object frame information until the accuracy of the output result of the bunching recognition model is higher than a preset threshold value;
determining the age period of the day according to a preset corresponding relation;
and establishing a corresponding relation between the age of the day section where the age of the day is located and the bundling identification model.
Optionally, the step of determining the object frame information of the object frame in each of the sample images includes:
detecting a pre-labeled object frame in the sample image to obtain reference frame information;
clustering the reference frame information to obtain at least one cluster, wherein the sample images in the cluster correspond to the same reference frame information;
and for each sample image, determining the corresponding reference frame information of the sample image in the cluster as the object frame information of the sample image.
Optionally, the training of the bundled and piled recognition model by using the sample image and the object frame information until the accuracy of the output result of the bundled and piled recognition model is higher than a preset threshold includes:
converting the sample image into sample images with different preset sizes by the aid of the bunching identification model for each iteration preset time;
determining object frame information corresponding to a sample image with a preset size;
and training the bundle pile recognition model by using the sample image with the preset size and the object frame information corresponding to the sample image.
Optionally, the step of determining the age of the day section in which the age of the day is located includes:
determining a plurality of age periods according to the preset cycle days;
calculating a quotient value of dividing the age of the day by the number of days in a preset period;
and determining the age of the day corresponding to the rounded quotient.
Optionally, the method further comprises:
and if the target object in the acquired image is piled up, re-executing the step of acquiring the acquired image which is acquired by the image acquisition device and contains the target object after a preset time period.
In a second aspect, the present application provides an object number determination apparatus, including:
the acquisition module is used for acquiring an acquired image which is acquired by the image acquisition device and contains a target object;
the detection module is used for inputting the acquired image into a pre-established bundling identification model and detecting whether the target object in the acquired image is bundled by using the bundling identification model;
and the counting module is used for counting the number of the target objects in the acquired image to obtain the number of the target objects if the target objects in the acquired image are not piled.
Optionally, the ages in days of the target objects in the acquired images are the same; the detection module comprises:
a first acquisition unit configured to acquire the age of the target object;
the determining unit is used for determining the age of the day section where the age of the day is;
the second acquisition unit is used for acquiring a bundling identification model corresponding to the age of day;
and the input unit is used for inputting the acquired image into the bunching identification model corresponding to the age of the day.
Optionally, the apparatus further comprises:
the system comprises a sample acquisition module, a storage module and a display module, wherein the sample acquisition module is used for acquiring a plurality of sample images, the sample images comprise pre-labeled object frames, the object frames comprise at least two target objects which are piled, and the target objects in the acquired images have the same age in days;
an information determination module for determining object frame information of an object frame in each of the sample images;
the training module is used for training the bunching recognition model by using the sample image and the object frame information until the accuracy of the output result of the bunching recognition model is higher than a preset threshold value;
the age of day section determining module is used for determining the age of day section where the age of day is located according to a preset corresponding relation;
and the establishing module is used for establishing the corresponding relation between the age of the day section where the age of the day is located and the bundling identification model.
Optionally, the information determining module includes:
the detection unit is used for detecting a pre-labeled object frame in the sample image to obtain reference frame information;
the clustering unit is used for clustering the reference frame information to obtain at least one clustering cluster, and the sample images in the clustering cluster correspond to the same reference frame information;
and the determining unit is used for determining the corresponding reference frame information of the sample image in the cluster as the object frame information of the sample image for each sample image.
Optionally, the training module comprises:
the conversion unit is used for converting the sample image into sample images with different preset sizes every iteration preset times of the bundled and piled identification model;
the information determining submodule is used for determining object frame information corresponding to the sample image with the preset size;
and the training submodule is used for training the bunching recognition model by utilizing the sample image with the preset size and the object frame information corresponding to the sample image.
Optionally, the determining unit includes:
the first determining submodule is used for determining a plurality of age periods according to the preset cycle days;
the calculation submodule is used for calculating a quotient of the age of the day divided by the number of days in a preset period;
and the second determining submodule is used for determining the age of the day corresponding to the rounded quotient.
Optionally, the method further comprises:
and the execution module is used for re-executing the step of acquiring the acquired image which is acquired by the image acquisition device and contains the target object after a preset time period if the target object in the acquired image is piled.
In a third aspect, the present application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
a processor configured to implement the method for determining the number of objects according to any one of the first aspect when executing a program stored in a memory.
In a fourth aspect, the present application provides a computer readable medium having non-volatile program code executable by a processor, the program code causing the processor to perform the method of any of the first aspects.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages: firstly, acquiring an acquired image which is acquired by an image acquisition device and contains a target object; then, the acquired image is input into a pre-established bundle identification model, whether the target object in the acquired image is bundled or not is detected by using the bundle identification model, whether the target object bundle condition exists in the acquired image or not is detected, the error in counting the number of the target objects is avoided when the bundle condition exists, if the detection result is that the target object in the acquired image is not bundled, the number of the target objects in the acquired image is calculated, the number of the target objects is ensured to be counted under the condition that the target object is not bundled, and the accuracy of the result of counting the target objects is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is a schematic flowchart of an object quantity determining method according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of a method of step S102 according to an embodiment of the present disclosure;
fig. 3 is a schematic flow chart of a method for establishing a bundle identification model according to an embodiment of the present application;
fig. 4 is a schematic flowchart of a method of step S302 according to an embodiment of the present disclosure;
fig. 5 is a schematic flowchart of the method of step S303 according to the embodiment of the present application;
fig. 6 is a schematic flowchart of a method of step S202 according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an object quantity determining apparatus according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Icon:
01-an acquisition module; 02-a detection module; 03-a statistical module; 1110-a processor; 1120-a communication interface; 1130-a memory; 1140-communication bus.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
China is a large country in the breeding industry, and with the development of electronic information technology, intelligent equipment is introduced into each farm, so that the breeding capacity of the farm is greatly enhanced, for example, in an intelligent system of a pig farm, counting the number of target objects in each column is an important link for pig farm management, and the correctness of the counted number of target objects directly concerns the reliability of subsequent pig farm data analysis. However, when the intelligent system of the pig farm checks the number of the target objects, if the target objects are piled up, the accuracy of checking the number of the target objects is affected.
In addition, in the research process, researchers also find that in the prior art, the method for shooting the images of the target detection objects without being bundled is difficult to realize in the breeding area by continuously adjusting the angles of the cameras, and because the moving behaviors of the animals are uncertain in the breeding area, the target objects are difficult to be accurately collected by the image collection device when the animals are not bundled; therefore, in another prior art, it is possible to detect whether a bundle has occurred in a target object by using an RFID (Radio Frequency Identification) device, which increases the accuracy of the target number detection result to a certain extent, but also increases the detection cost, and thus has no universality.
Based on this, an embodiment of the present invention provides an object quantity determining method to solve the above technical problem, and as shown in fig. 1, the object quantity determining method includes:
step S101, acquiring an acquired image which is acquired by an image acquisition device and contains a target object;
in the embodiment of the present invention, the target object may be an animal in a farm, but is not limited to the animal in the farm, and a person in the acquired image may also be the target object. Wherein, image acquisition device is used for gathering the image of detection area, and image acquisition device can be surveillance camera head, or other devices that possess the image acquisition function, and image acquisition device can set up in the collection place of target object, for example: the image acquisition device is arranged at a preset position in the pig raising shed so as to acquire the acquired image containing the pigs.
In this step, the manner of acquisition may be determined according to actual conditions, for example, images of the detection area are acquired at regular intervals according to the activity rules of different target objects.
Step S102, inputting the collected image into a pre-established bundling identification model, and detecting whether a target object in the collected image is bundled or not by using the bundling identification model;
in the embodiment of the invention, the target object collected in the breeding area can be an animal, a plurality of animals can be in the breeding area, the behaviors of the animals are uncertain, the situations of cluster heating of a plurality of animals or pile-forming of a plurality of animals overlapping up and down can occur, if the target object in the collected image is directly counted, the shielded animals are easily ignored, and the deviation between the counting result and the actual number is caused, researchers find through long-term experiments that when the pigs are piled tightly, particularly when three or more than three pigs are piled tightly, the result of counting the target object can be influenced, so that before counting the target object in the collected image, the embodiment of the invention judges whether the target object is piled in the collected image by inputting the collected image into the pile-forming identification model, so as to avoid the target object from being piled, counting the number of the target objects to generate counting errors.
In the embodiment of the invention, the strapped identification model adopts a pre-established model, preferably, a YOLOv2 model can be used for detecting whether the target object is strapped, and since the YOLOv2 model only has a convolutional layer and a pooling layer, the target object detection is performed on the input image with any size, so that the method has better universality and wider application range, but not only is limited to detecting whether the target object is strapped by using the YOLOv2 model, and the specific selected neural network model can be determined according to actual conditions.
Step S103, if the target objects in the collected image are not piled, counting the number of the target objects in the collected image to obtain the number of the target objects.
In the embodiment of the present invention, if the target object in the acquired image does not have the condition of bunching, the representative target detection object appears in the acquired image completely and clearly, an algorithm capable of detecting the target object, such as target detection, may be used for the acquired image, and the number of the target objects may be counted.
Further, as shown in fig. 1, the method further includes:
and step S104, if the target object in the acquired image is piled, after a preset time period, re-executing the step 101, and acquiring the acquired image which is acquired by the image acquisition device and contains the target object.
In the embodiment of the present invention, if the target object is jammed in the image acquired by the image acquisition device, in order to ensure the accuracy of the counting result of the number of the target objects, step S101 is executed again to determine whether the target object in the acquired image acquired by the image acquisition device at the next moment is jammed until the acquired image including the target object which is not jammed is acquired, and the following specific working process may refer to the above working steps, which is not described herein again.
According to the embodiment of the invention, before counting the number of the target objects in the acquired image, a process of judging whether the target objects are piled or not is added, so that the purpose of counting the target objects in the acquired image without the situation of the piled target objects is realized. Compared with the prior art that whether the target object is piled or not is detected through an RFID (radio frequency Identification) device before the target object is counted, the method and the device achieve the purpose of improving the accuracy of counting the target object number and reducing the equipment consumption cost only through improving the collected image processing algorithm, and therefore have wider applicability.
In yet another embodiment provided by the present invention, if animals are kept in a farm for a number inventory, some animals will have large size variations within a short period of time, for example: only before the pigs are slaughtered, the body type of the pigs is obviously changed due to time increase when the breeding house is generated, so that the characteristics of the bundled pigs are changed (for example, the size of a bounding box of a bundled area), and therefore, the bundled training model identifies whether the animals are bundled or not and the possibility of false detection exists, and further, in step S102, the acquired image is input into a pre-established bundled identification model, as shown in fig. 2, the method comprises the following steps:
step S201, acquiring the age of the target object;
in the embodiment of the present invention, the age of day may be the length of time from birth to the calculated time of the target object in the detection area, for example, the detection area is a pig shed, the target object is a pig, and usually for convenience of management, the pigs with the same age of day are placed in the same pig shed for feeding, so that the age of day of the pig in each pig shed is the same, for example, pigs with the age of day 20 are all in one pig shed.
In addition, a channel for acquiring the age of the target object may be established in advance by establishing a database, where the database is used to store the detection area identifier and the age of the target object corresponding to the detection area identifier, and when acquiring an image, the image acquisition device sends the acquired image and the detection area identifier to a device for executing the object quantity determination method, and determines the age of the target object corresponding to the detection area identifier in the database according to the detection area identifier.
Step S202, determining the age of the day section of the age of the day;
in the embodiment of the present invention, the age of day may represent different age of day intervals, and the age of day is divided according to different growth cycles of different target objects, for example: the pig has an increased body type and obvious change every 20 days, so that the day age range can be set as 0-20 days as the first day age range, 21-40 days as the second day age range and 41-60 days as the third day age range, and the target object is assumed to have a day age of 55 days, wherein the 55 days age is in the range of 41-60 days of the third day age range, so that the target object is in the third day age range.
Step S203, acquiring a bundling identification model corresponding to the age of day;
in the embodiment of the invention, the corresponding relation between the age of day and the bundling identification model can be preset, and different age of day correspond to different bundling identification models.
In an actual application scenario, if a target object is an animal whose body type changes significantly as time increases, a fixed bundler identification model is used to identify a bundler area of the target object, which is prone to cause a detection result error, for example: training a bunching recognition model by using training samples of 41-60 day age segments, and detecting whether a bunching condition exists in target objects of 0-20 day age segments by using the bunching recognition model, wherein the pig bodies of the 41-60 day age segments are much larger than those of the 0-20 day age segments, so that the regions where five non-bunched pig bodies are located are easily recognized as the bunching regions, and therefore, by training the bunching recognition models of different day age segments, the false detection probability can be effectively reduced for the target objects corresponding to the judged day age segments, and the accuracy of the detection result is greatly improved.
In this step, the age of day may be compared with each preset age of day, and a bundler model corresponding to the preset age of day that is the same as the age of day may be obtained.
And step S204, inputting the acquired image into the bunching identification model corresponding to the age of day.
In the embodiment of the invention, the target object in the acquired image is a pig, and as the body type of the pig is changed greatly along with time when the pig is within the age of three months, the pig image training samples of different age of days are set to train the bunching recognition model, so that the detection accuracy of the bunching recognition model is ensured, and the pig can be fed with the pig in the same period in the feeding process, so that the ages of the pig in the acquired image are the same, and the corresponding bunching recognition model is obtained by determining the age of day in which the age of day is located, so that the age of day of the pig in the acquired image to be detected is the same as the age of day corresponding to the bunching recognition model, and the detection accuracy can be improved.
Wherein, the day-old period can be set by combining the body type change of pigs through a large number of experiments, such as: the pig of a certain breed has obvious change of body type after 20 days, because the day age section can be set to be 0-20 days, 21-40 days and the like, specifically, training can be carried out on the bunching recognition model by using training samples of different day age sections, and the day age section corresponding to the bunching recognition model is recorded.
For example: after the acquired image is acquired, the day age of the target object in the acquired image is acquired, and if the day age of the target object is 15 days and belongs to the day age range of 0-20 days, a bunching recognition model trained by using the pig training samples in the day age range of 0-20 days is correspondingly acquired, so that whether the target object is bunched or not is detected in the acquired image in a targeted manner, and the accuracy of a detection result output by the bunching recognition model is ensured.
Further, the process of establishing the bundle identification model, as shown in fig. 3, includes:
step S301, obtaining a plurality of sample images, wherein the sample images comprise pre-labeled object frames, the object frames comprise at least two object bunkers, and the object objects in the collected images have the same age in days;
in the embodiment of the present invention, the sample image is an image selected or acquired in advance by a researcher, and an object frame is labeled in a bundler area in the sample image, preferably, the sample image includes at least two bundlers of the target object, for example, the sample image may be a sample image including three target objects, or may be a sample image including five target objects, and the specifically selected training sample may be determined according to an actual application field.
For example, in a pig breeding area, three bunches, four bunches and five bunches are generally easy to occur, so when a bunch identification model for identifying the pig bunch is established, a training sample comprises a plurality of sample images comprising three target object bunches, four target object bunches and five target object bunches, and the ages of the target objects in the training sample are the same, so that the targeted training bunch identification model identifies the acquired images of the age period corresponding to the age period.
Step S302, determining object frame information of an object frame in each sample image;
in the embodiment of the invention, the object frame information is the mark of a researcher on the acquired image in advance, the acquired image comprises the area of the target pile, and the researcher marks the area to obtain the object frame information comprising the size and the position of the object frame.
In the embodiment of the present invention, the training sample includes a plurality of sample images and object frame information corresponding to the sample images, wherein the object frame information of the object frame in the sample images is determined for each sample image, and the object frame information may be the same or different, for example, training samples are collected in the region where pigs are raised, because the activity of animals is not fixed, the region where the pigs are piled and the way of the piles are different, and the situation of upper and lower piles or other irregular piles may occur, for example, three pigs are only closely arranged, one pig with a body perpendicular to the three parallel pigs is close to the three parallel pigs, so even if the number of the piles is the same, the way of the piles is different, the size and position of the object frame will be different, so the object frame information will be different, and in the process of actually selecting the training samples, as many sample images as possible should be selected, and the sample images contain different bunching conditions, so that the object frame information obtained according to each sample image is different, and the bunching identification model can more accurately detect each bunching area.
Based on this, an embodiment of the present invention further provides an optimal implementation manner for determining object frame information, and further, in step S302, the determining the object frame information of the object frame in each sample image, as shown in fig. 4, includes:
step S401, detecting a pre-labeled object frame in the sample image to obtain reference frame information;
in the embodiment of the invention, the sample image contains an object frame pre-labeled by researchers, the object frame contains a plurality of object piles, the reference frame information of the sample image can be determined according to the object frame, and the reference information can contain the size information and the position information of the object frame, wherein the object piles are different in mode, so that the sizes of the object frames may be different, the positions may be different, or the sizes and the positions are different, so that the reference frame information of each sample image can be different.
In addition, the position information of the object frame contained in the reference frame may be an offset of the object frame in the sample image, and specifically, the reference origin may be selected according to an actual situation, and the offset of the object frame may be calculated to indicate the position of the object frame in the sample image.
Step S402, clustering a plurality of reference frame information to obtain at least one cluster, wherein the sample images in the cluster correspond to the same reference frame information;
in the embodiment of the invention, the reference frame information is clustered, a plurality of reference frame information is clustered according to the information contained in the reference frame information, for example, the reference frame information contains three-dimensional image characteristic parameters, and then the step of clustering a plurality of reference frame information is to synthesize the three-dimensional image characteristic parameters in the reference frame information, cluster sample images with the same image characteristics into one class to obtain one cluster.
The reference frame information corresponding to each cluster contains the parameter value, the specific calculation mode is determined according to the parameter in the reference frame information, for example, the reference frame information comprises the size of an object frame, after the size of the object frame corresponding to the sample image in the cluster is determined, the size of the object frame in the same cluster is optimized, and the optimized value is determined as the reference frame information corresponding to the cluster. In the embodiment of the invention, the object frame information obtained by clustering is compared with the reference frame information corresponding to the reference frame which is manually pre-labeled, so that the object frame information is more close to the boundary of the actual heap area, and the accuracy reduction of the model output result obtained by training due to the error which is manually pre-labeled is avoided.
Step S403, for each sample image, determining reference frame information corresponding to the sample image in the cluster as object frame information of the sample image.
In the embodiment of the invention, each sample image corresponds to one clustering cluster, each clustering cluster corresponds to one reference frame information, and the sample images and the object frame information are used for training the bunching recognition model in a mode of determining the reference frame information of the sample images in the clustering clusters as the object frame information of the sample images, so that the bunching area recognized by the bunching recognition model is more fit with the actual range of the bunching area.
In an actual application scenario, a YOLOv2 model can be used as a strapped recognition model, correspondingly, a method for determining object frame information according to an acquired image can adopt the following mode to obtain reference frame information labeled in advance in the acquired image, when a researcher sets a training sample, a strapped area in the acquired image is manually labeled to obtain the reference frame information, the reference frame information at least comprises position information and size information of a reference frame, before training a YOLOv2 model, a plurality of reference frame information are generally clustered by using a k-means clustering algorithm to obtain at least one object frame information, because the size information and the position information of the object frame information can be closer to the information of an actual strapped area, after obtaining the object frame information, the YOLOv2 model is trained by using the object frame information and the sample image, so that the YOLOv2 model can more accurately detect the strapped area, the accuracy of whether the model detects the bundling process is improved.
Step S303, training a bundled and piled recognition model by using the sample image and the object frame information until the accuracy of the output result of the bundled and piled recognition model is higher than a preset threshold value;
in the embodiment of the invention, the sample image and the object frame information are used as training samples, the training samples are used for training the bundled identification model until the model is converged, during training, the bundled identification model carries out iterative calculation on the input sample image and the object frame information so as to enable the identification accuracy of the bundled identification model to reach a preset threshold value, and when the accuracy of the result output by the bundled identification model is higher than the preset threshold value, the training is stopped.
Preferably, the tiering identification model may use a YOLOv2 model, because the YOLOv2 model only has a convolutional layer and a pooling layer, and thus does not need to have a fixed size of an input picture, so that the YOLOv2 model can identify input images of different sizes, and further the tiering identification model can adapt to more application scenarios, and a structure or a type of a specifically adopted neural network model may be determined according to actual conditions, which is not specifically limited by the embodiment of the present invention.
Step S304, determining the age of the day section of the age of the day according to a preset corresponding relation;
in the embodiment of the present invention, the preset corresponding relationship may be determined according to a growth rule of the target object, for example: the pig of a certain breed has obvious change of body type after 20 days, because the age of day can be set to 0-20 days, 21-40 days and the like, and the age of day of the target object is assumed to be 35 days, and the age of day is 21-40 days according to the preset corresponding relation.
Step S305, establishing a corresponding relation between the age of day section where the age of day is located and the bundling identification model.
In the present example, since some animals have large body size variations in a short time, for example: according to the method, training is carried out on the bunching recognition model by using training samples of different age periods of days, and the age period corresponding to the bunching recognition model is recorded, so that whether target bunching exists in the collected images of the same age period is detected, and the purpose of improving the recognition accuracy of the bunching recognition model is achieved.
Further, step S303, training a bundled and piled recognition model by using the sample image and the object frame information until the accuracy of the output result of the bundled and piled recognition model is higher than a preset threshold, as shown in fig. 5, includes:
step S501, converting the sample image into sample images with different preset sizes every iteration preset times of the bundled and piled identification model;
step S502, determining object frame information corresponding to a sample image with a preset size;
step S503, training the bundled pile recognition model by using a sample image with a preset size and the object frame information corresponding to the sample image.
In the embodiment of the invention, in order to increase the robustness of the bunching identification model, in the process of training the bunching identification model by using the training sample, the size of the sample image in the training sample can be changed after the bunching identification model iterates for a certain number of times, a researcher can mark the reference frame on the target object bunching area in the sample image after the size is changed, or the size and/or the position of the reference frame in the original sample image can be converted by a calculation formula, so that the size and/or the position of the converted reference frame corresponds to the bunching area in the sample image after the size is changed, the reference frame information of a new reference frame in the sample image with a preset size is determined, the object frame information is determined according to the reference frame information, and then the sample image after the size of the sample image is modified and the object frame information are used for training the bunching identification model, so as to achieve the purpose of multi-, therefore, the bundle identification model can identify the input images with different sizes, and the bundle identification model can be adapted to more application scenes.
For example: setting the bound and piled recognition model to iterate for 5 times, converting the sample image from the original size to a first preset size when the bound and piled recognition model iterates for 5 times, training the bound and piled recognition model by using the sample image with the first preset size and the object frame information corresponding to the sample image, converting the sample image with the first preset size to a second preset size when the bound and piled recognition model iterates for 10 times, and repeating the processing process.
In another embodiment of the present invention, a preferred implementation of calculating the age of the target object is provided, and step S202, determining the age of the target object, as shown in fig. 6, includes:
step S601, determining a plurality of age periods according to preset cycle days;
step S602, calculating a quotient of the age of day divided by the number of days in a preset period;
step S603, determining the age of day corresponding to the rounded quotient.
In the embodiment of the present invention, the preset cycle days may be determined according to growth characteristics of the target object, a plurality of day-age segments may be divided by the preset cycle days, and a quotient obtained by dividing the day-age by the preset cycle days is calculated, for example, the day-age is 50 days, the preset cycle is 20 days, the first day-age segment is 0 to 20 days, the second day-age segment is 21 to 40 days.
In the embodiment of the present invention, for example, the target object is a pig, because the body shape of the pig in the nursery house before slaughtering is changed greatly, the characteristic of bunching will also change accordingly, for example, the size of the target area will increase as the body shape of the pig increases, the object frame information needs to be modified according to the size of the pig, the day age D of the pig is obtained first, the body shape of the pig will change significantly at intervals of 20 days, so that the preset cycle day number is set to 20 days, the day age interval is set to 0-20 days, the day age interval is set to 21-40 days, the preset day age corresponding to the day age is calculated corresponding to the second day age … …, and D can be obtained by dividing D by 20, and D is rounded to obtain the day age, and then a bunch recognition model corresponding to the day age and trained to converge is obtained, so as to realize the accurate detection process.
In an application scene of a breeding plant, researchers find in an experimental process that when a YOLOv2 model is used as a bundled object identification model, although the YOLOv2 model can support an application scene with overhigh exposure and poor shooting angle, because an anchor box for detecting a bundled object area in the YOLOv2 model is artificially preset, the YOLOv2 model is not suitable for an animal detection field with a short growth cycle and large body change, but the embodiment of the invention combines an animal generation cycle to correspondingly acquire the age of a day in an image to a model trained by using a training sample of the age of the day, so that the detection precision can be further improved, the detection result is closer to the actual situation, and the accuracy of the result of counting the number of objects is improved.
In still another embodiment of the present invention, there is provided an object number determination apparatus, as shown in fig. 7, including:
the acquisition module 01 is used for acquiring an acquired image which is acquired by the image acquisition device and contains a target object;
the detection module 02 is used for inputting the acquired image into a pre-established bundling identification model and detecting whether the target object in the acquired image is bundled by using the bundling identification model;
the counting module 03 is configured to count the number of the target objects in the acquired image to obtain the number of the target objects if the target objects in the acquired image are not piled.
Further, the ages of the target objects in the collected images are the same; the detection module comprises:
a first acquisition unit configured to acquire the age of the target object;
the determining unit is used for determining the age of the day section where the age of the day is;
the second acquisition unit is used for acquiring a bundling identification model corresponding to the age of day;
and the input unit is used for inputting the acquired image into the bunching identification model corresponding to the age of the day.
Further, the building process of the bundle pile identification model comprises the following steps:
the system comprises a sample acquisition module, a storage module and a display module, wherein the sample acquisition module is used for acquiring a plurality of sample images, the sample images comprise pre-labeled object frames, the object frames comprise at least two target objects which are piled, and the target objects in the acquired images have the same age in days;
an information determination module for determining object frame information of an object frame in each of the sample images;
the training module is used for training the bunching recognition model by using the sample image and the object frame information until the accuracy of the output result of the bunching recognition model is higher than a preset threshold value;
the age of day section determining module is used for determining the age of day section where the age of day is located according to a preset corresponding relation;
and the establishing module is used for establishing the corresponding relation between the age of the day section where the age of the day is located and the bundling identification model.
Further, the information determination module includes:
the detection unit is used for detecting a pre-labeled object frame in the sample image to obtain reference frame information;
the clustering unit is used for clustering the reference frame information to obtain at least one clustering cluster, and the sample images in the clustering cluster correspond to the same reference frame information;
and the determining unit is used for determining the corresponding reference frame information of the sample image in the cluster as the object frame information of the sample image for each sample image.
Further, the training module includes:
the conversion unit is used for converting the sample image into sample images with different preset sizes every iteration preset times of the bundled and piled identification model;
the information determining submodule is used for determining object frame information corresponding to the sample image with the preset size;
and the training submodule is used for training the bunching recognition model by utilizing the sample image with the preset size and the object frame information corresponding to the sample image.
Further, the determining unit includes:
the first determining submodule is used for determining a plurality of age periods according to the preset cycle days;
the calculation submodule is used for calculating a quotient of the age of the day divided by the number of days in a preset period;
and the second determining submodule is used for determining the age of the day corresponding to the rounded quotient.
Further, still include:
and the execution module is used for re-executing the step of acquiring the acquired image which is acquired by the image acquisition device and contains the target object after a preset time period if the target object in the acquired image is piled.
It can be clearly understood by those skilled in the art in the embodiments of the present invention that, for convenience and brevity of description, the specific working processes of the systems, apparatuses and units described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiment of the present invention, an electronic device is further provided, as shown in fig. 8, including a processor 1110, a communication interface 1120, a memory 1130, and a communication bus 1140, where the processor 1110, the communication interface 1120, and the memory 1130 complete communication with each other through the communication bus 1140;
a memory 1130 for storing computer programs;
the processor 1110 is configured to implement the object number determination method according to any one of the above embodiments when executing the program stored in the memory 1130.
In the electronic device provided in the embodiment of the present invention, the processor 1110 implements a playing operation of obtaining a video by executing a program stored in the memory 1130, determines a corresponding frame rate reduction policy according to the playing operation, and plays the video after adjusting frame data corresponding to video data according to the frame rate reduction policy, thereby ensuring that the playing device can play the video well.
The communication bus 1140 mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus 1140 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 8, but this is not intended to represent only one bus or type of bus.
The communication interface 1120 is used for communication between the electronic device and other devices.
The memory 1130 may include a Random Access Memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The processor 1110 may be a general-purpose processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; the integrated circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, or discrete hardware components.
In an embodiment of the present invention, there is further provided a computer-readable storage medium having stored thereon a program of an object quantity determination method processing method, which when executed by a processor, implements the steps of the object quantity determination method described in any one of the above embodiments.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present invention, which enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (16)

1. A method for determining the number of objects, the method comprising:
acquiring an acquired image which is acquired by an image acquisition device and contains a target object;
inputting the acquired image into a pre-established bunching identification model, and detecting whether a target object in the acquired image is bunched or not by using the bunching identification model;
and if the target objects in the acquired image are not piled, counting the number of the target objects in the acquired image to obtain the number of the target objects.
2. The method according to claim 1, wherein the target objects in the captured images have the same age per day; inputting the collected image into a pre-established bundle pile identification model, comprising the following steps:
acquiring the age of the target object;
determining the age period of the day;
acquiring a bundling identification model corresponding to the age of day;
and inputting the acquired image into the bunching identification model corresponding to the age of day.
3. The method for determining the number of objects according to claim 2, wherein the process of establishing the bundle identification model comprises:
obtaining a plurality of sample images, wherein the sample images comprise pre-labeled object frames, the object frames comprise at least two object bunkers, and the object objects in the collected images have the same age in days;
determining object frame information of an object frame in each sample image;
training a bunching recognition model by using the sample image and the object frame information until the accuracy of the output result of the bunching recognition model is higher than a preset threshold value;
determining the age period of the day according to a preset corresponding relation;
and establishing a corresponding relation between the age of the day section where the age of the day is located and the bundling identification model.
4. The method according to claim 3, wherein the step of determining the object frame information of the object frame in each of the sample images includes:
detecting a pre-labeled object frame in the sample image to obtain reference frame information;
clustering the reference frame information to obtain at least one cluster, wherein the sample images in the cluster correspond to the same reference frame information;
and for each sample image, determining the corresponding reference frame information of the sample image in the cluster as the object frame information of the sample image.
5. The method for determining the number of objects according to claim 3, wherein the step of training the bundled recognition model by using the sample images and the object frame information until the accuracy of the output result of the bundled recognition model is higher than a preset threshold value comprises:
converting the sample image into sample images with different preset sizes by the aid of the bunching identification model for each iteration preset time;
determining object frame information corresponding to a sample image with a preset size;
and training the bundle pile recognition model by using the sample image with the preset size and the object frame information corresponding to the sample image.
6. The method for determining the number of objects according to claim 2, wherein the step of determining the age of day in which the age of day is located comprises:
determining a plurality of age periods according to the preset cycle days;
calculating a quotient value of dividing the age of the day by the number of days in a preset period;
and determining the age of the day corresponding to the rounded quotient.
7. The method of determining the number of objects according to claim 1, further comprising:
and if the target object in the acquired image is piled up, re-executing the step of acquiring the acquired image which is acquired by the image acquisition device and contains the target object after a preset time period.
8. An object quantity determination apparatus, comprising:
the acquisition module is used for acquiring an acquired image which is acquired by the image acquisition device and contains a target object;
the detection module is used for inputting the acquired image into a pre-established bundling identification model and detecting whether the target object in the acquired image is bundled by using the bundling identification model;
and the counting module is used for counting the number of the target objects in the acquired image to obtain the number of the target objects if the target objects in the acquired image are not piled.
9. The apparatus according to claim 8, wherein the target objects in the captured images have the same age per day; the detection module comprises:
a first acquisition unit configured to acquire the age of the target object;
the determining unit is used for determining the age of the day section where the age of the day is;
the second acquisition unit is used for acquiring a bundling identification model corresponding to the age of day;
and the input unit is used for inputting the acquired image into the bunching identification model corresponding to the age of the day.
10. The object quantity determination apparatus according to claim 9, characterized in that the apparatus further comprises:
the system comprises a sample acquisition module, a storage module and a display module, wherein the sample acquisition module is used for acquiring a plurality of sample images, the sample images comprise pre-labeled object frames, the object frames comprise at least two target objects which are piled, and the target objects in the acquired images have the same age in days;
an information determination module for determining object frame information of an object frame in each of the sample images;
the training module is used for training the bunching recognition model by using the sample image and the object frame information until the accuracy of the output result of the bunching recognition model is higher than a preset threshold value;
the age of day section determining module is used for determining the age of day section where the age of day is located according to a preset corresponding relation;
and the establishing module is used for establishing the corresponding relation between the age of the day section where the age of the day is located and the bundling identification model.
11. The apparatus according to claim 10, wherein the information determining module includes:
the detection unit is used for detecting a pre-labeled object frame in the sample image to obtain reference frame information;
the clustering unit is used for clustering the reference frame information to obtain at least one clustering cluster, and the sample images in the clustering cluster correspond to the same reference frame information;
and the determining unit is used for determining the corresponding reference frame information of the sample image in the cluster as the object frame information of the sample image for each sample image.
12. The object quantity determination apparatus according to claim 10, wherein the training module includes:
the conversion unit is used for converting the sample image into sample images with different preset sizes every iteration preset times of the bundled and piled identification model;
the information determining submodule is used for determining object frame information corresponding to the sample image with the preset size;
and the training submodule is used for training the bunching recognition model by utilizing the sample image with the preset size and the object frame information corresponding to the sample image.
13. The apparatus according to claim 9, wherein the determination unit includes:
the first determining submodule is used for determining a plurality of age periods according to the preset cycle days;
the calculation submodule is used for calculating a quotient of the age of the day divided by the number of days in a preset period;
and the second determining submodule is used for determining the age of the day corresponding to the rounded quotient.
14. The object quantity determination apparatus according to claim 8, further comprising:
and the execution module is used for re-executing the step of acquiring the acquired image which is acquired by the image acquisition device and contains the target object after a preset time period if the target object in the acquired image is piled.
15. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method for determining the number of objects according to any one of claims 1 to 7 when executing a program stored in a memory.
16. A computer readable medium having non-volatile program code executable by a processor, wherein the program code causes the processor to perform the method of any of claims 1 to 7.
CN201910985368.0A 2019-10-16 2019-10-16 Object number determining method and device, electronic equipment and readable medium Active CN110956609B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910985368.0A CN110956609B (en) 2019-10-16 2019-10-16 Object number determining method and device, electronic equipment and readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910985368.0A CN110956609B (en) 2019-10-16 2019-10-16 Object number determining method and device, electronic equipment and readable medium

Publications (2)

Publication Number Publication Date
CN110956609A true CN110956609A (en) 2020-04-03
CN110956609B CN110956609B (en) 2023-08-04

Family

ID=69975564

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910985368.0A Active CN110956609B (en) 2019-10-16 2019-10-16 Object number determining method and device, electronic equipment and readable medium

Country Status (1)

Country Link
CN (1) CN110956609B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160140399A1 (en) * 2014-11-17 2016-05-19 Canon Kabushiki Kaisha Object detection apparatus and method therefor, and image recognition apparatus and method therefor
US9704054B1 (en) * 2015-09-30 2017-07-11 Amazon Technologies, Inc. Cluster-trained machine learning for image processing
CN108875709A (en) * 2018-07-18 2018-11-23 洛阳语音云创新研究院 One kind flocks together behavioral value method, apparatus, electronic equipment and storage medium
CN109376584A (en) * 2018-09-04 2019-02-22 湖南大学 A kind of poultry quantity statistics system and method for animal husbandry
CN109376604A (en) * 2018-09-25 2019-02-22 北京飞搜科技有限公司 A kind of age recognition methods and device based on human body attitude
CN109545218A (en) * 2019-01-08 2019-03-29 广东小天才科技有限公司 A kind of audio recognition method and system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160140399A1 (en) * 2014-11-17 2016-05-19 Canon Kabushiki Kaisha Object detection apparatus and method therefor, and image recognition apparatus and method therefor
US9704054B1 (en) * 2015-09-30 2017-07-11 Amazon Technologies, Inc. Cluster-trained machine learning for image processing
CN108875709A (en) * 2018-07-18 2018-11-23 洛阳语音云创新研究院 One kind flocks together behavioral value method, apparatus, electronic equipment and storage medium
CN109376584A (en) * 2018-09-04 2019-02-22 湖南大学 A kind of poultry quantity statistics system and method for animal husbandry
CN109376604A (en) * 2018-09-25 2019-02-22 北京飞搜科技有限公司 A kind of age recognition methods and device based on human body attitude
CN109545218A (en) * 2019-01-08 2019-03-29 广东小天才科技有限公司 A kind of audio recognition method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王殿伟等: "改进的YOLOv3红外视频图像行人检测算法", 《西安邮电大学学报》 *

Also Published As

Publication number Publication date
CN110956609B (en) 2023-08-04

Similar Documents

Publication Publication Date Title
AU2019101786A4 (en) Intelligent pig group rearing weighing method and apparatus, electronic device and storage medium
CN110796043B (en) Container detection and feeding detection method and device and feeding system
CN110619333B (en) Text line segmentation method, text line segmentation device and electronic equipment
CN110991222B (en) Object state monitoring and sow oestrus monitoring method, device and system
CN111008561A (en) Livestock quantity determination method, terminal and computer storage medium
CN108875709B (en) Tie-stacking behavior detection method and device, electronic equipment and storage medium
CN112767435A (en) Method and device for detecting and tracking captive target animal
CN112883915B (en) Automatic wheat head identification method and system based on transfer learning
CN110956609A (en) Object quantity determination method and device, electronic equipment and readable medium
CN111405197B (en) Video clipping method, image processing method and device
CN109523509B (en) Method and device for detecting heading stage of wheat and electronic equipment
CN111597937A (en) Fish gesture recognition method, device, equipment and storage medium
CN115761896A (en) Abnormal behavior identification method, system, equipment and medium for live pigs
CN112308061B (en) License plate character recognition method and device
CN116206342B (en) Pig weight detection method, device, equipment and storage medium
CN114492664A (en) Pig checking method, device, equipment and storage medium
CN114492657A (en) Plant disease classification method and device, electronic equipment and storage medium
CN112800856A (en) Livestock position and posture recognition method and device based on YOLOv3
CN112966762A (en) Wild animal detection method and device, storage medium and electronic equipment
CN112200003A (en) Method and device for determining feed feeding amount of pig farm
CN112422618A (en) Position sensing data reporting method, device and system
KR20090068270A (en) Content detection of an image comprising pixels
CN111223137B (en) Method, device, terminal and storage medium for determining quantity of cultured products
CN117456472B (en) Herbivore feed intake monitoring method and device, electronic equipment and storage medium
CN115457036B (en) Detection model training method, intelligent point counting method and related equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 601, 6 / F, building 2, No. 18, Kechuang 11th Street, Daxing District, Beijing, 100176

Applicant after: Jingdong Shuke Haiyi Information Technology Co.,Ltd.

Address before: 601, 6 / F, building 2, No. 18, Kechuang 11th Street, Beijing Economic and Technological Development Zone, Beijing 100176

Applicant before: BEIJING HAIYI TONGZHAN INFORMATION TECHNOLOGY Co.,Ltd.

Address after: 601, 6 / F, building 2, No. 18, Kechuang 11th Street, Daxing District, Beijing, 100176

Applicant after: Jingdong Technology Information Technology Co.,Ltd.

Address before: 601, 6 / F, building 2, No. 18, Kechuang 11th Street, Daxing District, Beijing, 100176

Applicant before: Jingdong Shuke Haiyi Information Technology Co.,Ltd.

GR01 Patent grant
GR01 Patent grant