Method, device and equipment for detecting number of objects in farm and storage medium
Through real-time video stream detection and tracking technology, the detection area is dynamically adjusted, which solves the problem of low efficiency of traditional methods, achieves accurate statistics of the number of livestock and poultry in the farm, and adapts to complex environments.
Patent Information
- Application Number
- CN202311424167.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-30
- Publication Date
- 2024-10-22
AI Technical Summary
The traditional livestock and poultry quantity detection method is inefficient and cannot accurately and reliably obtain the number of livestock and poultry in the farm. Especially in complex environments, it is difficult to avoid the problem of livestock and poultry being blocked by objects.
By acquiring the real-time video stream in the farm, detecting living objects in the video frame, tracking changes in object position, adjusting the detection area, counting the number of living objects in the farm, and using deep learning models and Kalman filters to achieve position mapping and detection Dynamic adjustment of areas.
It achieves accurate and reliable counting of the number of livestock and poultry in the farm, reduces the impact of environmental factors, and improves the accuracy and reliability of detection.
Smart Images

Figure CN118822933A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a method, device, equipment and storage medium for detecting the number of objects in a farm. Background Art
[0002] my country is a large livestock and poultry breeding country, with a large number of livestock and poultry and a wide variety of species. With the continuous expansion of the livestock and poultry breeding industry, it is necessary to conduct real-time detection of the number of livestock and poultry in the farm to prevent accidents such as livestock and poultry getting lost. Traditional livestock and poultry number detection methods rely on a lot of manpower and material resources, are inefficient, and the effect is difficult to guarantee. Automated detection of livestock and poultry numbers is the trend of future development.
[0003] In the related technology, real-time detection of the number of livestock and poultry in a farm by using a camera depends on the angle and position of the camera. In addition, the environment in the farm is complex, and the livestock and poultry may be obscured by objects, making it impossible to accurately and reliably obtain the number of livestock and poultry in the farm. Summary of the invention
[0004] The present invention provides a method, device, equipment and storage medium for detecting the number of objects in a breeding farm.
[0005] According to a first aspect of the present disclosure, a method for detecting the number of objects in a farm is provided, the method comprising:
[0006] Acquire a real-time video stream obtained by collecting video of living objects in the farm;
[0007] Determine the tracking result of each living object in the current video frame according to the object detection result of the current video frame in the real-time video stream; wherein the tracking result is used to indicate the position mapping relationship between the living objects in any adjacent video frames;
[0008] Determine position change information of each living object in the first detection area according to the tracking result, and adjust the first detection area according to the position change information to obtain a second detection area; wherein the first detection area is a detection area obtained by detecting the living object based on the video frame before the current video frame;
[0009] The number of living objects in the farm is counted based on the number of each living object in the second detection area.
[0010] According to a second aspect of the present disclosure, a device for detecting the number of objects in a farm is provided, the device comprising:
[0011] An acquisition module is used to acquire a real-time video stream obtained by video acquisition of living objects in the farm;
[0012] A determination module, configured to determine the tracking results of each living object in the current video frame according to the object detection result of the current video frame in the real-time video stream; wherein the tracking result is used to indicate the position mapping relationship between the living objects in any adjacent video frames;
[0013] an adjustment module, configured to determine position change information of each living object in the first detection area according to the tracking result, and adjust the first detection area according to the position change information to obtain a second detection area; wherein the first detection area is a detection area obtained by detecting the living object based on the video frame before the current video frame;
[0014] A statistical module is used to count the number of living objects in the farm based on the number of each living object in the second detection area.
[0015] According to a third aspect of the present disclosure, an electronic device is provided, which includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the program, the method described above is implemented.
[0016] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the above method of the present disclosure is implemented.
[0017] The embodiments of the present disclosure provide a method, device, equipment and storage medium for detecting the number of objects in a breeding farm. The method acquires a real-time video stream obtained by performing video acquisition of living objects in the breeding farm; determines the tracking result of each living object in the current video frame according to the object detection result of the current video frame in the real-time video stream; wherein the tracking result is used to indicate the position mapping relationship between the living objects in any adjacent video frames; determines the position change information of each living object in a first detection area according to the tracking result, and adjusts the first detection area according to the position change information to obtain a second detection area; wherein the first detection area is a detection area obtained by detecting the living objects based on the video frame before the current video frame; and counts the number of living objects in the breeding farm based on the number of each living object in the second detection area. The embodiment of the present application first tracks the living objects by acquiring real-time video streams of the living objects in the farm, then determines the position change information of each living object in the first detection area based on the tracking results, and adjusts the first detection area according to the position change information to obtain a second detection area, and finally obtains the number of living objects in the farm based on the number of each living object in the second detection area. Therefore, the embodiment of the present application can accurately and reliably count the number of living objects in the farm, and is not affected by environmental factors in the farm. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Further details, features and advantages of the present disclosure are disclosed in the following description of exemplary embodiments in conjunction with the accompanying drawings, in which:
[0019] Figure 1 A flow chart of a method for detecting the number of objects in a farm provided by an exemplary embodiment of the present disclosure;
[0020] Figure 2 A flow chart of a method for detecting the number of objects in a farm provided by another exemplary embodiment of the present disclosure;
[0021] Figure 3 A flow chart of a method for detecting the number of objects in a farm provided by another exemplary embodiment of the present disclosure;
[0022] Figure 4 A schematic diagram of a detection frame provided for another exemplary embodiment of the present disclosure;
[0023] Figure 5 A schematic block diagram of functional modules of a device for detecting the number of objects in a farm provided by an exemplary embodiment of the present disclosure;
[0024] Figure 6 A structural block diagram of an electronic device provided for an exemplary embodiment of the present disclosure;
[0025] Figure 7 A structural block diagram of a computer system provided for an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0026] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0027] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0028] The term "including" and its variations used in this document are open inclusions, that is, "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one other embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions of other terms will be given in the description below. It should be noted that the concepts of "first", "second", etc. mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0029] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0030] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0031] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0032] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0033] As an optional but non-limiting implementation, in response to receiving an active request from the user, the method of sending a prompt message to the user may be, for example, a pop-up window, in which the prompt message may be presented in text. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device. It is understandable that the above notification and the process of obtaining user authorization are only illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0034] The present disclosure provides a method for detecting the number of objects in a farm. Figure 1 As shown, the method may include the following steps:
[0035] Step 101, obtaining a real-time video stream obtained by capturing video of living objects in a breeding farm.
[0036] In a possible embodiment, a camera is installed in a farm, and a real-time video stream of living objects in the farm is obtained through the camera in the farm. The real-time video stream is used to detect the living objects. It should be noted that the real-time video stream can be processed by denoising and contrast enhancement, which is not limited here.
[0037] Step 102: Determine the tracking result of each living object in the current video frame according to the object detection result of the current video frame in the real-time video stream.
[0038] In a possible embodiment, after acquiring the real-time video stream, the object of the current video frame in the video stream is detected, and then the tracking result of each living object in the current video frame is determined based on the object detection result of the current video frame in the real-time video stream, wherein the tracking result is used to indicate the position mapping relationship between the living objects in any adjacent video frames.
[0039] Step 103: determine the position change information of each living object in the first detection area according to the tracking result, and adjust the first detection area according to the information to obtain a second detection area.
[0040] In a possible embodiment, after determining the tracking results of each living object in the current video frame, the position change information of each living object in the first detection area is determined according to the tracking results, and then the first detection area is adjusted according to the tracking results to obtain a second detection area. The first detection area is a detection area obtained by detecting the living object based on the video frame before the current video frame.
[0041] Step 104: Count the number of living objects in the farm based on the number of each living object in the second detection area.
[0042] In a possible embodiment, after determining the position change information of each living object in the first detection area, the first detection area is adjusted according to the position change information to obtain a second detection area, and then the number of each living object in the second detection area is added to count the number of living objects in the farm. When the number of living objects in the farm changes, an alarm message is generated.
[0043] The above-mentioned method, device, equipment and storage medium for detecting the number of objects in the farm obtain a real-time video stream obtained by video acquisition of living objects in the farm; determine the tracking results of each living object in the current video frame according to the object detection result of the current video frame in the real-time video stream; wherein the tracking result is used to indicate the position mapping relationship between the living objects in any adjacent video frames; determine the position change information of each living object in the first detection area according to the tracking result, and adjust the first detection area according to the position change information to obtain a second detection area; wherein the first detection area is a detection area obtained by detecting the living objects based on the video frame before the current video frame; and count the number of living objects in the farm based on the number of each living object in the second detection area. The embodiment of the present application first tracks the living objects by acquiring real-time video streams of the living objects in the farm, then determines the position change information of each living object in the first detection area based on the tracking results, and adjusts the first detection area according to the position change information to obtain a second detection area, and finally obtains the number of living objects in the farm based on the number of each living object in the second detection area. Therefore, the embodiment of the present application can accurately and reliably count the number of living objects in the farm, and is not affected by environmental factors in the farm.
[0044] Based on the above embodiments, in another embodiment provided by the present disclosure, Figure 2 As shown, the above step 102 may further include the following steps:
[0045] Step 201 , performing living object detection on each video frame in the real-time video stream to obtain object detection results for each video frame.
[0046] After acquiring the real-time video stream, live object detection is performed on each video frame in the real-time video stream to obtain object detection results for each video frame. The object detection results for each video frame are used to track the live objects in each video frame.
[0047] In a possible embodiment, a deep learning model is used to identify living objects in each frame and mark them. In order to avoid recognition errors caused by factors such as recognition model, camera position, and lighting, data enhancement techniques are applied during the detection process, such as random rotation, scaling, and cropping, to increase the robustness and generalization of the model, which is not limited here.
[0048] The formula for detecting living objects is:
[0049]
[0050] Among them, x n Represents the nth frame image, and the BBox function represents the living object result for the nth frame image. represents the two-dimensional region where living object i is identified by living object detection in the n-th frame image.
[0051] Step 202: determine the position of the living object in the previous video frame in any adjacent video frames in the current video frame based on the object detection result to obtain a tracking result.
[0052] After obtaining the object detection results of each video frame, the living object in each video frame is tracked based on the object detection results to obtain a tracking result, wherein the tracking result is used to indicate the position mapping relationship between the living objects in any adjacent video frames.
[0053] In a possible embodiment, after determining the object detection results of each video frame, the living object in each video frame is tracked based on the object detection results to obtain the tracking results. The object detection results of the previous video frame of the current video frame are processed by the action model to obtain the predicted position of the living object in the previous video frame in the current video frame. The main goal of tracking is to match the same living object in consecutive frames. This step is achieved through the action model, and the action model can predict the position of the living object in the next frame. The action model is implemented based on the Kalman filter, and its method mainly constructs hidden states: target point x coordinate, target point y coordinate, target point x direction speed, target point y direction speed. Then, the detection results of the target in the previous few frames are used as observation parameters, input into the model, and the x coordinate and y coordinate positions of the target in the next frame are predicted. Finally, the object detection results of the current video frame are corrected based on the predicted position to obtain the corrected result.
[0054] After obtaining the correction result, the correction result and the object detection result of the previous video frame are processed by the bipartite graph matching algorithm to obtain the position mapping relationship between the living object in the current video frame and the living object in the previous video frame. Finally, the tracking result is determined based on the position mapping relationship.
[0055] In a possible embodiment, the bipartite graph model is (G, S, E), where S = (S n ,SD n ), SD n is the tracking result of a region corresponding to the previous video frame, and the region contains at least one living object. n Indicates the detection result of a living object identified by living object detection in the n-th frame image.
[0056] for There is i∈S i n ,j∈SD j n , x n ∈SDn , G represents the set of all the object detection results identified in the current image frame, and E represents the tracking result SD determined by the tracking model j n The collection and living object S i n According to the definition of bipartite graph, each test result in set S belongs to only one object set (belonging to S n or SD n ). n With SD n There is a unique mapping relationship E between the targets ij . This relationship will S n Each i in corresponds to SD n J in.
[0057] In this embodiment, the position mapping relationship between the living object in the current video frame and the living object in the previous video frame is obtained by a bipartite graph matching algorithm, and the tracking result is finally determined by the position mapping relationship. The use of a bipartite graph matching algorithm makes the tracking result more accurate, thereby improving the accuracy and reliability of the method for detecting the number of objects in the farm.
[0058] Based on the above embodiments, in another embodiment provided by the present disclosure, Figure 3 As shown, the above step 103 may further include the following steps:
[0059] Step 301 : sampling the detection position of the living object in the first detection area of each living object detection result to obtain a position sampling result.
[0060] In a possible embodiment, the tracking result SD in the area n A random sample of x is obtained by random sampling from a normal distribution Indicated in SD i n The nth sampling point in the region. i n Random sampling is performed according to the normal distribution. Assuming that the statistic d(X,Y) obeys the multivariate normal distribution, the estimated value calculation formula is:
[0061]
[0062] Among them, μ is the sample mean and ∑ is the covariance matrix.
[0063] Step 302: Based on the living object detection result tracking result, determine the area label of the living object corresponding to the living object detection result position sampling result at the current moment.
[0064] In a possible embodiment, the formula for calculating the region label is:
[0065]
[0066] l (x,y),n Indicates the nth frame, at position (x,y) at the label. n and n represents the corresponding pixel coordinates, Represents the anchor A of the point (x, y) to the label l in the n-1th frame n-1 The Euclidean distance of the anchor point A is selected using the coordinate area SD l n-1 The center point of .
[0067] In a possible embodiment, the number of SDn obtained according to the tracking result of the region is i, and n position points are sampled from each region SDn. For example, there are regions 1 and 2, and 6 points are sampled in each region. The sampling points of region 1 are: position point 1, position point 2, position point 3, position point 4, position point 5, and position point 6. The sampling points of region 2 are: position point 1, position point 2, position point 3, position point 4, position point 5, and position point 6. The live object detection result region label of each position point in region 1 and region 2 is determined, and the live object detection result region label is used to indicate the position change information of the live object in the first detection region.
[0068] Step 303: determine an adjustment strategy for the first detection area of the living object detection result based on the living object detection result area label, and adjust the first detection area of the living object detection result based on the living object detection result adjustment strategy to obtain a second detection area of the living object detection result.
[0069] In a possible embodiment, after determining the region label of the living object corresponding to the position sampling result of the living object detection result at the current moment, the region labels are grouped to obtain a plurality of label groups.
[0070] Exemplarily, if the area label of position point 1, position point 2, position point 3, position point 4 and position point 5 in area 1 is 2, the area labels of position point 1, position point 2, position point 3, position point 4 and position point 5 are determined as a label group, and the area labels in the label group are the same, indicating that the actual area where position point 1, position point 2, position point 3, position point 4 and position point 5 are located is area 2.
[0071] An adjustment strategy for the first detection area is determined based on the number of area labels in each label group, and a third detection area corresponding to the first label group is determined when it is determined that the plurality of label groups include a first label group whose number of labels is greater than or equal to a first threshold.
[0072] In a possible embodiment, the first threshold is H merge , the number of labels in the first label group is when hour, Indicates in the area Labeled as L i x The number of labels, when the number exceeds the threshold, The region is labeled L i x , determine the third detection area corresponding to the first tag group, and merge the third detection area with the first detection area.
[0073] After the merging is completed, update the number of target objects contained in the second detection area:
[0074] S new =∑SD merged .
[0075] When it is determined that the number of tags included in the plurality of tag groups is less than or equal to the second threshold, the first detection area is split into regions.
[0076] In one possible embodiment, is the second threshold, when And SD n-1 Contains target count > 1, When the first detection area is marked as label L i x The area marked as L is split i x The area is determined as the second detection area.
[0078] After the split is completed, update the number of target objects contained in the second detection area:
[0079]
[0080] After completing the merger or split, update area, The region is updated according to the following formula:
[0081]
[0082] In a possible embodiment, the merged and split regions are represented by polygonal detection boxes. Figure 4 The detection frame schematic diagram is shown as an example. Figure 4As shown, each detection frame represents a living object in an area and displays the number of living objects. The number of living objects in the farm is counted by counting the number of living objects displayed in each detection frame.
[0083] In this embodiment, the second detection area is obtained by splitting or merging the first detection area. The second detection area reflects the number of living objects in an area. The first detection area can be continuously adjusted to generate the second detection area as the living objects move. The generated second detection area can accurately count the number of living objects in the area, thereby improving the reliability and accuracy of the method for detecting the number of objects in the farm.
[0084] In the case of dividing each functional module according to each function, an embodiment of the present disclosure provides a device for detecting the number of objects in a farm, and the device for detecting the number of objects in a farm may be a server or a chip applied to a server. Figure 5 A schematic block diagram of the functional modules of a device for detecting the number of objects in a farm provided as an exemplary embodiment of the present disclosure.
[0085] like Figure 5 As shown, the object quantity detection device in the farm includes:
[0086] An acquisition module 501 is used to acquire a real-time video stream obtained by collecting video of living objects in a breeding farm;
[0087] A determination module 502 is used to determine the tracking results of each living object in the current video frame according to the object detection result of the current video frame in the real-time video stream; wherein the tracking result is used to indicate the position mapping relationship between the living objects in any adjacent video frames;
[0088] An adjustment module 503 is used to determine position change information of each living object in the first detection area according to the tracking result, and adjust the first detection area according to the position change information to obtain a second detection area; wherein the first detection area is a detection area obtained by detecting the living object based on the video frame before the current video frame;
[0089] The statistical module 504 is used to count the number of living objects in the farm based on the number of each living object in the second detection area.
[0090] An embodiment of the present disclosure also provides an electronic device, comprising: at least one processor; and a memory for storing instructions executable by the at least one processor; wherein the at least one processor is configured to execute the instructions to implement the above method disclosed in the embodiment of the present disclosure.
[0091] Figure 6The structure diagram of an electronic device provided by an exemplary embodiment of the present disclosure is shown in FIG. Figure 6 As shown, the electronic device 600 includes at least one processor 601 and a memory 602 coupled to the processor 601 , and the processor 601 can execute corresponding steps in the above method disclosed in the embodiment of the present disclosure.
[0092] The processor 601 may also be referred to as a central processing unit (CPU), which may be an integrated circuit chip having signal processing capabilities. Each step in the method disclosed in the embodiment of the present disclosure may be completed by an integrated logic circuit of hardware in the processor 601 or by instructions in the form of software. The processor 601 may be a general-purpose processor, a digital signal processor (DSP), an ASIC, a field-programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present disclosure may be directly embodied as being executed by a hardware decoding processor, or may be executed by a combination of hardware and software modules in a decoding processor. The software module may be located in a memory 602, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, or other mature storage media in the art. The processor 601 reads the information in the memory 602 and completes the steps of the method in combination with its hardware.
[0093] In addition, when various operations / processes according to the present disclosure are implemented by software and / or firmware, they can be transmitted from a storage medium or a network to a computer system having a dedicated hardware structure, such as Figure 7 The computer system 700 shown is installed with the programs constituting the software. When the various programs are installed, the computer system can perform various functions, including the functions described above. Figure 7 A structural block diagram of a computer system provided for an exemplary embodiment of the present disclosure.
[0094] Computer system 700 is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0095] like Figure 7 As shown, the computer system 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the computer system 700 can also be stored. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0096] A plurality of components in the computer system 700 are connected to the I / O interface 705, including: an input unit 706, an output unit 707, a storage unit 708, and a communication unit 709. The input unit 706 may be any type of device capable of inputting information to the computer system 700, and the input unit 706 may receive input digital or character information, and generate key signal inputs related to user settings and / or function control of the electronic device. The output unit 707 may be any type of device capable of presenting information, and may include, but is not limited to, a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 708 may include, but is not limited to, a disk, an optical disk. The communication unit 709 allows the computer system 700 to exchange information / data with other devices over a network such as the Internet, and may include, but is not limited to, a modem, a network card, an infrared communication device, a wireless communication transceiver, and / or a chipset, such as a Bluetooth™ device, a WiFi device, a WiMax device, a cellular communication device, and / or the like.
[0097] The computing unit 701 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 701 performs the various methods and processes described above. For example, in some embodiments, the above methods disclosed in the embodiments of the present disclosure may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 708. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 600 via the ROM 702 and / or the communication unit 709. In some embodiments, the computing unit 701 may be configured to perform the above methods disclosed in the embodiments of the present disclosure by any other appropriate means (e.g., by means of firmware).
[0098] The embodiment of the present disclosure further provides a computer-readable storage medium, wherein when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the above method disclosed in the embodiment of the present disclosure.
[0099] The computer-readable storage medium in the disclosed embodiments may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. The computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or equipment, or any suitable combination of the foregoing. More specifically, the computer-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0100] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0101] The embodiments of the present disclosure further provide a computer program product, including a computer program, wherein when the computer program is executed by a processor, the above method disclosed in the embodiments of the present disclosure is implemented.
[0102] In embodiments of the present disclosure, computer program codes for performing the operations of the present disclosure may be written in one or more programming languages or combinations thereof, including but not limited to object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer.
[0103] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0104] The modules, components or units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the names of the modules, components or units do not, in some cases, limit the modules, components or units themselves.
[0105] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0106] The above descriptions are only some embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, a technical solution formed by replacing the above features with the technical features with similar functions disclosed in the present disclosure (but not limited to).
[0107] Although some specific embodiments of the present disclosure have been described in detail by way of example, it should be understood by those skilled in the art that the above examples are for illustration only and are not intended to limit the scope of the present disclosure. It should be understood by those skilled in the art that the above embodiments may be modified without departing from the scope and spirit of the present disclosure. The scope of the present disclosure is defined by the appended claims.
Claims
1. A method for detecting the number of objects in a breeding farm, characterized in that: The method comprises: Acquire a real-time video stream obtained by collecting video of living objects in the farm; Determine the tracking result of each living object in the current video frame according to the object detection result of the current video frame in the real-time video stream; wherein the tracking result is used to indicate the position mapping relationship between the living objects in any adjacent video frames; Determine position change information of each living object in the first detection area according to the tracking result, and adjust the first detection area according to the position change information to obtain a second detection area; wherein the first detection area is a detection area obtained by detecting the living object based on the video frame before the current video frame; The number of living objects in the farm is counted based on the number of each living object in the second detection area.
2. The method according to claim 1, characterized in that Determining the tracking result of the living object according to the object detection result of each video frame in the real-time video stream includes: Performing live object detection on each video frame in the real-time video stream to obtain object detection results for each video frame; The position of the living object in the previous video frame in any adjacent video frames is determined based on the object detection result to obtain the tracking result.
3. The method according to claim 2, characterized in that The determining, based on the object detection result, a position of the living object in the previous video frame in any adjacent video frame in the current video frame to obtain the tracking result includes: Processing the object detection result of the previous video frame of the current video frame by the action model to obtain the predicted position of the living object in the previous video frame in the current video frame; Correcting the object detection result of the current video frame based on the predicted position to obtain a corrected result; Processing the correction result and the object detection result of the previous video frame by a bipartite graph matching algorithm to obtain a position mapping relationship between the living object in the current video frame and the living object in the previous video frame; Based on the position mapping relationship, the tracking result is determined.
4. The method according to claim 1, characterized in that: The number of the first detection area is multiple; determining the position change information of each living object in the first detection area according to the tracking result, and adjusting the first detection area according to the position change information to obtain the second detection area, including: Sampling the detection position of the living object in each of the first detection areas to obtain a position sampling result; Based on the tracking result, determining a region label of the living object corresponding to the position sampling result at the current moment; wherein the region label is used to indicate position change information of the living object in the first detection area; An adjustment strategy for the first detection area is determined based on the area label, and the first detection area is adjusted based on the adjustment strategy to obtain the second detection area.
5. The method according to claim 4, characterized in that The determining the adjustment strategy of the first detection area based on the area label includes: Grouping the region labels to obtain a plurality of label groups; wherein the region labels in each label group are the same; An adjustment strategy for the first detection area is determined based on the number of area labels in each of the label groups.
6. The method according to claim 5, characterized in that The step of determining the adjustment strategy of the first detection area based on the number of area labels in each of the label groups includes: When it is determined that the plurality of tag groups include a first tag group having a number of tags greater than or equal to a first threshold, determining a third detection area corresponding to the first tag group; The third detection area and the first detection area are merged.
7. The method according to claim 5, characterized in that The step of determining the adjustment strategy of the first detection area based on the number of area labels in each of the label groups includes: When it is determined that the number of tags included in the plurality of tag groups is less than or equal to the second threshold, the first detection area is split into regions.
8. The method according to claim 1, characterized in that The method further comprises: When the number of living objects in the breeding farm changes, an alarm message is generated.
9. A device for detecting the number of objects in a breeding farm, characterized in that: The device comprises: An acquisition module is used to acquire a real-time video stream obtained by video acquisition of living objects in the farm; A determination module, configured to determine the tracking results of each living object in the current video frame according to the object detection result of the current video frame in the real-time video stream; wherein the tracking result is used to indicate the position mapping relationship between the living objects in any adjacent video frames; an adjustment module, configured to determine position change information of each living object in the first detection area according to the tracking result, and adjust the first detection area according to the position change information to obtain a second detection area; wherein the first detection area is a detection area obtained by detecting the living object based on the video frame before the current video frame; A statistical module is used to count the number of living objects in the farm based on the number of each living object in the second detection area.
10. An electronic device, characterized in that: include: at least one processor; a memory for storing the at least one processor-executable instruction; The at least one processor is configured to execute the instructions to implement the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the method as claimed in any one of claims 1 to 8.
