Bee counting method, device and electronic equipment
By generating bee density maps through image processing and network models, the accuracy and applicability issues of bee counting are resolved, efficient and accurate bee population estimation is achieved, and interference with bee colonies is reduced.
Patent Information
- Application Number
- CN202210376339.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-11
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2042-04-11
AI Technical Summary
Existing bee counting methods are not accurate, not applicable, and the monitoring process is complicated. Traditional methods rely on manpower and frequently open the boxes, which interferes with the physiological activities of the bee colony and has low labor efficiency.
Image processing technology is used to collect bee colony distribution images and input them into a preset network model to generate a bee colony density map. The number of feature areas is counted to estimate the number of bees. The VGG-16 model is used for training and optimization to reduce the difficulty and error of data labeling.
Accurately estimating the number of bees in the presence of bee aggregation and obstruction improves the accuracy and applicability of counting, simplifies the process, and reduces disturbance to the bee colony.
Smart Images

Figure CN114863251B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing and recognition, and in particular to a bee counting method, device and electronic equipment. Background Art
[0002] Bees pollinate crops, improving their yield and quality, and playing a vital role in modern agriculture. Beekeeping is a fundamental and crucial component of the apiculture industry. Counting bees helps beekeepers assess a colony's strength, reproductive status, and disease risk. Therefore, monitoring bee colonies is crucial for the industry.
[0003] However, current beekeeping is mostly based on traditional, decentralized family operations, and the scale and mechanization of the bee industry need to be improved. Traditional beekeeping methods rely on manpower and experience, requiring beekeepers to open each hive and inspect the honeycombs within to monitor the bee population. Frequent opening of hives not only reduces labor efficiency but also excessively interferes with the normal physiological activities of the bee colony. For beekeepers, maintaining the overall health and stability of the hive is essential for successful production, but this operation consumes time and energy, resulting in low returns. With the development of modern information technologies such as artificial intelligence and sensors, the use of intelligent devices to obtain bee colony information can help beekeepers achieve efficient monitoring of bee colony numbers. This not only reduces the workload of traditional beekeeping methods and improves beekeeper efficiency, but also reduces the frequency of hive openings and minimizes human interference with the bee colony. However, existing methods still suffer from limitations such as low accuracy, limited applicability, and complex monitoring processes. Summary of the Invention
[0004] The embodiments of the present application provide a bee counting method, device, and electronic device. The method can accurately estimate the number of bees even when bees are clustered or obstructed, and can accurately detect the number of bees in complex background environments. The method has the characteristics of high accuracy, strong applicability, and simple process.
[0005] In a first aspect, the present invention provides the following technical solutions through an embodiment of the present invention:
[0006] A bee counting method includes: collecting a bee colony distribution image at a preset area; inputting the bee colony distribution image into a preset network model to obtain a bee colony density map corresponding to the bee colony distribution image, the bee colony density map including a background area and a feature area, each feature area corresponding to the position of a bee in the bee colony distribution image, and the pixel value of the pixel point in the feature area is different from the pixel value of the pixel point in the background area; and obtaining the number of bees in the bee colony distribution image by counting the number of feature areas in the bee colony density map.
[0007] Preferably, the preset network model is trained according to the following steps: obtaining sample data, the sample data including: multiple swarm distribution sample images and a swarm density map corresponding to each swarm distribution sample image; based on the sample data, training a pre-constructed initial network model to obtain the preset network model.
[0008] Preferably, the bee colony density map corresponding to each bee colony distribution sample image is obtained by the following steps: marking the positions of the bees in the bee colony distribution sample image to obtain the position coordinates of each bee in the bee colony distribution sample image; and obtaining the bee colony density map based on the position coordinates of each bee in the bee colony distribution sample image.
[0009] Preferably, obtaining the bee swarm density map based on the position coordinates of each bee in the bee swarm distribution image includes: obtaining a feature matrix for characterizing the distribution of bees in the bee swarm distribution image based on the position coordinates of each bee in the bee swarm distribution image; and convolving the feature matrix with a preset two-dimensional Gaussian kernel to obtain the bee swarm density map.
[0010] Preferably, after obtaining the preset network model, the method further includes: obtaining test data, the test data including: multiple swarm distribution test images and a swarm density test graph corresponding to each swarm distribution test image; inputting the swarm distribution test image into the preset network model to obtain a swarm density estimation graph; determining the error between the swarm density test graph and the swarm density estimation graph based on the swarm density test graph, the swarm density estimation graph and a preset loss function; and optimizing the network weight parameters in the preset network model based on the error.
[0011] Preferably, the plurality of bee colony distribution sample images include: bee colony distribution images of bees at different growth stages.
[0012] Preferably, the preset network model is a VGG-16 model.
[0013] Preferably, the feature area includes a pixel point, the pixel value of the pixel point is 1, and the pixel value of the background area pixel point is 0. The method of obtaining the number of bees in the bee colony distribution map by counting the number of feature areas in the bee colony density map includes: summing all pixel values in the bee colony density map to obtain the number of bees.
[0014] In a second aspect, the present invention provides the following technical solution through an embodiment of the present invention:
[0015] A bee counting device, comprising:
[0016] A bee colony distribution image acquisition module is used to acquire bee colony distribution images in a preset area;
[0017] a swarm density map acquisition module, configured to input the swarm distribution image into a preset network model to obtain a swarm density map corresponding to the swarm distribution image, wherein the swarm density map includes a background area and a feature area, each feature area corresponds to the position of a bee in the swarm distribution image, and the pixel values of the pixels in the feature area are different from the pixel values of the pixels in the background area;
[0018] The bee quantity calculation module is used to obtain the number of bees in the bee colony distribution image by counting the number of characteristic areas in the bee colony density map.
[0019] In a third aspect, the present invention provides the following technical solution through an embodiment of the present invention:
[0020] An electronic device comprises a memory and a processor, wherein the memory is coupled to the processor and stores instructions. When the instructions are executed by the processor, the electronic device executes the steps of any one of the methods described in the first aspect.
[0021] One or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages:
[0022] The counting method provided by the embodiments of the present invention collects a bee colony distribution image and inputs the image into a preset network model. This automatically generates a bee colony density map corresponding to the bee colony distribution image. The bee colony density map includes background regions and feature regions. Each feature region corresponds to the location of a bee in the bee colony distribution image. The pixel values of pixels in the feature regions differ from those in the background regions. By counting the number of feature regions in the bee colony density map, the number of bees in the collected bee colony distribution image can be determined. This counting method does not require pre-foreground segmentation of the image and can determine the total number of bees without segmentation, thus avoiding errors introduced by the segmentation process. Furthermore, since the distribution and density of bees are constantly changing, many bees may be occluded when bees cluster together. This method effectively circumvents this problem by counting the feature regions. Furthermore, using a density map to describe the bees in the distribution image reduces the difficulty and time of data annotation. Consequently, this method can accurately estimate the number of bees even when bees cluster together or are obscured. It can also accurately detect bee counts in complex background environments, demonstrating high accuracy, strong applicability, and a simple process. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following is a brief introduction to the drawings required for use in the description of the embodiments. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0024] Figure 1 A flowchart of a bee counting method provided in an embodiment of the present invention;
[0025] Figure 2 A schematic diagram of coordinate marking of a bee colony distribution image provided by an embodiment of the present invention;
[0026] Figure 3 A schematic diagram of a bee colony density map generation process provided by an embodiment of the present invention;
[0027] Figure 4 A schematic diagram of a bee colony distribution image and a bee colony density map corresponding to the bee colony distribution image provided by an embodiment of the present invention;
[0028] Figure 5 A schematic diagram of the structure of the VGG-16 model provided in an embodiment of the present invention;
[0029] Figure 6 A flowchart of a bee counting process provided by an embodiment of the present invention;
[0030] Figure 7 A schematic structural diagram of a bee counting device provided in an embodiment of the present invention;
[0031] Figure 8 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0032] After research, the inventors found that traditional bee counting methods have at least the following problems: 1. Most algorithms require foreground segmentation, which is a challenging task in itself, and inaccurate segmentation can have a huge impact on the results; 2. The distribution and density of bees are constantly changing. When bees gather together, most of them will be obscured, and traditional counting methods cannot handle such situations well.
[0033] In view of this, the embodiments of the present application provide a bee counting method, device and electronic device. This method can accurately estimate the number of bees even when the bees are gathered or obstructed, and can accurately detect the number of bees in complex background environments. It has the characteristics of high accuracy, strong applicability and simple process.
[0034] The overall idea of the technical solution of the embodiment of this application is as follows:
[0035] A bee colony distribution image at a preset area is collected; the bee colony distribution image is input into a preset network model to obtain a bee colony density map corresponding to the bee colony distribution image, wherein the bee colony density map includes a background area and a feature area, each feature area corresponds to the position of a bee in the bee colony distribution image, and the pixel value of the pixel point in the feature area is different from the pixel value of the pixel point in the background area; the number of bees in the bee colony distribution image is obtained by counting the number of feature areas in the bee colony density map.
[0036] In order to better understand the above technical solution, the above technical solution will be described in detail below with reference to the accompanying drawings and specific implementation methods.
[0037] In a first aspect, an embodiment of the present invention provides a bee counting method, specifically, as follows: Figure 1 As shown, the method includes the following steps S101 to S103.
[0038] Step S101, collecting a bee colony distribution image in a preset area;
[0039] Step S102: Inputting the bee swarm distribution image into a preset network model to obtain a bee swarm density map corresponding to the bee swarm distribution image, wherein the bee swarm density map includes a background area and a feature area, each feature area corresponds to the position of a bee in the bee swarm distribution image, and the pixel value of the pixel point in the feature area is different from the pixel value of the pixel point in the background area;
[0040] Step S103 , obtaining the total number of bees in the bee colony distribution image by counting the number of characteristic regions in the bee colony density map.
[0041] In a specific implementation, the preset area may be any fixed location where honey is relatively concentrated, such as inside a beehive, inside a beehive, etc. The method for collecting the bee colony distribution image may be to capture it by a camera, or to capture it by a camera, etc.
[0042] The swarm distribution image is input into the preset network model to obtain a swarm density map corresponding to the swarm distribution image. Specifically, the preset network model mentioned in this application can be trained according to the following steps: obtaining sample data, the sample data including: multiple swarm distribution sample images and a swarm density map corresponding to each swarm distribution sample image; based on the sample data, training the pre-constructed initial network model to obtain the preset network model.
[0043] This application takes collecting bees in a beehive as an example. In a specific embodiment, multiple bee colony distribution sample images can be obtained by collecting bees in the beehive at different times, for example: collecting bee colony sample distribution images at morning, noon, and evening.
[0044] Furthermore, to improve the applicability of the preset network model and prevent overfitting, the multiple sample bee colony distribution images in this application may also include: bee colony distribution images at different growth stages. Specifically, the different growth stages here can represent: bees when they are newly formed, after a period of formation, and in the late stages of formation. Because the number of bees varies to a certain extent at different growth stages, if training is only performed on honey from the same period, the bee colony density map obtained based on the model may be less accurate when the bee colony distribution images obtained are of bees from different periods, that is, the data fluctuates greatly and the measurement is inaccurate.
[0045] In a specific embodiment, the swarm density map corresponding to each swarm distribution sample image is obtained by the following steps: marking the positions of the bees in the swarm distribution sample image to obtain the position coordinates of each bee in the swarm distribution sample image, and obtaining the swarm density map based on the position coordinates of each bee in the swarm distribution image.
[0046] Specifically, by selecting bee colony distribution images at different periods in a beehive as a data set, for each bee colony distribution image, the position of each bee in the image is marked, and the position coordinate information of each bee in each image is obtained.
[0047] Optionally, you can use matlab to mark the position of each bee, and the marked position can be at the center of the bee's body. In addition, the marking method can be to mark each bee with a cross, such as Figure 2 As shown, the position of the cross represents the coordinates of the bee, so that the real bee image of the original image can be obtained and the bee feature distribution of the original image can be retained.
[0048] In a specific embodiment, obtaining a swarm density map based on the position coordinates of each bee in the swarm distribution sample image includes: obtaining a feature matrix for characterizing the distribution of bees in the swarm distribution image based on the position coordinates of each bee in the swarm distribution image.
[0049] For a bee distribution image with marked positions, the corresponding bee colony density map can be generated based on the coordinate marks of the bees in the image as follows:
[0050] In the bee colony distribution image, assuming that there is a coordinate mark at the pixel xi, it can be expressed as a unit impulse function δ(x―x i), where x represents any two-dimensional image coordinate, then an image containing N bee position marks can be expressed as the following function:
[0051]
[0052] Through the above formula 1, a feature matrix for characterizing the distribution of bees in the bee colony distribution image is obtained.
[0053] like Figure 3 (a) is the original picture of a single bee. Figure 3 (b) is the density map of a single bee. Specifically, since the bee colony density map includes background areas and feature areas, each feature area corresponds to the position of a bee in the bee colony distribution image. The pixel values of the pixels in the feature area are different from the pixel values of the pixels in the background area, as shown in Figure 2. Figure 3 As shown in (c), assuming that the bee colony density map is a binary image, the feature area (the coordinate mark of the bee) corresponds to the area with a binary number of 1, and the background area corresponds to the area with a binary number of 0. Through the above function, the feature matrix reflecting the distribution of bees is obtained, that is, the bee colony density map.
[0054] Furthermore, in order to make the feature area have the characteristics of a smooth density function, H(x) needs to be smoothed. Specifically, the feature matrix is convolved with a preset two-dimensional Gaussian kernel to obtain the bee colony density map, wherein H(x) is convolved with a preset two-dimensional Gaussian kernel, and the formula is as follows:
[0055] F(x)=H(x)*G σ (x) (2)
[0056] G in Formula 2 σ Represents the Gaussian kernel function, * represents the convolution operation, wherein the preset two-dimensional Gaussian kernel can be a standardized two-dimensional Gaussian kernel, and the swarm density processed by the adaptive Gaussian kernel is as follows: Figure 3 Assume that the feature region contains a pixel point, the pixel value of the pixel point is 1, and the pixel value of the background region pixel point is 0. The density map corresponding to a feature region is as follows: Figure 3 (d) shows that the sum of the probabilities of each bee occupying a pixel over the entire region is 1. Here, each feature region is smoothed, using a Gaussian kernel with the same standard deviation to label each bee in the image. The probability of each bee occupying the entire region of the pixel is obtained, resulting in a bee colony density map.
[0057] Specifically, the feature area includes a pixel point, the pixel value of the pixel point is 1, and the pixel value of the background area pixel point is 0. The number of bees in the bee swarm distribution image is obtained by counting the number of feature areas in the bee swarm density map, including: summing all pixel values in the bee swarm density map to obtain the number of bees, that is, the number of all bee targets in the image can be obtained by summing all pixel values in the bee swarm density map, and the formula is as follows:
[0058] Count=∑F(x) (3)
[0059] Since the pixel value occupied by a bee is 1, the pixel value obtained by summing according to the above formula 3 is the total number of bees. Figure 4 A bee swarm distribution image and a bee swarm density map corresponding to the bee swarm distribution image are shown.
[0060] In a specific embodiment, the initial network model can be a VGG-16 model, such as Figure 5 As shown in the figure, the model consists of 13 convolutional layers and 3 fully connected layers. The convolutional layers of VGG-16 can be divided into 5 modules, each of which is followed by a max pooling operation with a kernel size of 2×2 and a stride of 2. All convolutional layers use a 3×3 convolution kernel with a stride and padding of 1. ReLU is used as the activation function after each convolutional layer.
[0061] The method of training a pre-built initial network model based on the sample data to obtain a preset network model includes initializing network weight parameters in the VGG-16 model, wherein the network weight parameters can be any preset values. The obtained sample data, i.e., multiple swarm distribution sample images and a swarm density map corresponding to each swarm distribution sample image, are input into the VGG-16 model to obtain a learned VGG-16 model, wherein the learned VGG-16 model includes a mapping relationship between the swarm distribution images and the swarm density map.
[0062] Furthermore, in order to obtain a more accurate preset network model, after obtaining the learned VGG-16 model, it also includes: obtaining test data, the test data including: a swarm distribution test image and a swarm density test map corresponding to the swarm distribution test image; inputting the swarm distribution test image into the preset network model to obtain a swarm density estimation map; determining the error between the swarm density test map and the swarm density estimation map according to the swarm density test map, the swarm density estimation map and a preset loss function; and optimizing the network weight parameters in the preset network model based on the error.
[0063] Specifically, the method of obtaining test data is the same as the method of obtaining sample data mentioned above, that is, obtaining a bee colony distribution test image, and obtaining the position coordinates of each bee in the bee colony distribution test image by marking the positions of the bees in the bee colony distribution test image; based on the position coordinates of each bee in the bee colony distribution test image, a bee colony density test map is obtained.
[0064] The swarm distribution test image is input into the learned VGG-16 model, and the swarm density estimation map is obtained based on the algorithm in the model. The error between the swarm density test map and the swarm density estimation map is then measured using a preset loss function.
[0065] It should be noted that the process of inputting the swarm distribution test image into the learned VGG-16 model is as follows: multiple swarm distribution test images are input into the learned VGG-16 model in sequence, so that the model obtains the swarm density test map corresponding to the previous swarm distribution test image, and updates the network weight parameters in the model according to the error between the swarm density test map and the swarm density estimation map, and then calculates the next swarm distribution test image.
[0066] Optionally, the Euclidean distance is used as a preset loss function to calculate the error between the bee colony density test graph and the bee colony density estimation graph. The loss function can be calculated by the following formula:
[0067]
[0068] Where Θ represents the weight parameter to be optimized in the network model, N represents the total number of images in the test data, Xi represents the i-th input image, Fi and F(Xi;Θ) are the swarm density test map and swarm density estimate for the i-th image, respectively. Using Equation 4, we obtain the error.
[0069] Specifically, assuming that epoch represents the maximum number of tests set, after each test is completed and the error is obtained, it is necessary to determine whether the current test number i is greater than the maximum number of tests set, epoch. If not, the current test number is incremented by 1, and the network weight parameters are updated based on the latest error. The next swarm distribution test image is input to obtain the network weight parameters. The network weight parameters are iteratively updated until all swarm distribution test images in the test data are input in sequence, completing the test process. For example, the method for updating the network weight parameters can be: stochastic gradient descent (SDG) method.
[0070] like Figure 6As shown, a simplified flowchart of the training process of the initial network model is provided for this application. First, the network model is created, the network weight parameters are initialized, sample data is input into the initial network model, the learned network weight parameters are obtained, test data is input into the learned network weight parameters, and a swarm density estimation graph is obtained. The error between the swarm density estimation graph and the swarm training density graph is calculated according to the loss function, and the network weight parameters are updated based on the error using back propagation calculation (i.e., SDG gradient descent method). This application can realize end-to-end loss function calculation and back propagation calculation.
[0071] A bee counting method provided by an embodiment of the present invention is used to count the number of bees in any still image, with at least the following advantages: 1. It can estimate the number of bees without segmenting the foreground; 2. It can estimate the number of bees even in the presence of occlusion; 3. It uses density maps to describe the bees in the image, which reduces the difficulty and time of data annotation; 4. It does not require high quality images of the collected bee colony distribution and is highly tolerant of changes in the image background. Furthermore, because the present invention calibrates the model algorithm based on error, the preset network model obtained using the training method provided by the present invention has improved counting accuracy and robustness.
[0072] In summary, the bee counting method provided in this application can accurately estimate the number of bees even when the bees are gathered together or obstructed, and can accurately detect the number of bees in complex background environments. It has the characteristics of high accuracy, strong applicability and simple process.
[0073] In the second aspect, based on the same inventive concept, this embodiment provides a bee counting device, such as Figure 7 Shown, including:
[0074] A bee colony distribution image acquisition module 401 is used to acquire bee colony distribution images in a preset area;
[0075] A swarm density map acquisition module 402 is configured to input a swarm distribution image into a preset network model to obtain a swarm density map corresponding to the swarm distribution image. The swarm density map includes a background region and a feature region. Each feature region corresponds to the position of a bee in the swarm distribution image. The pixel values of pixels in the feature region are different from the pixel values of pixels in the background region.
[0076] The bee number calculation module 403 is used to obtain the number of bees in the bee colony distribution image by counting the number of characteristic areas in the bee colony density map.
[0077] As an optional embodiment, the preset network model is trained according to the following steps: obtaining sample data, the sample data including: multiple swarm distribution sample images and a swarm density map corresponding to each swarm distribution sample image; based on the sample data, training a pre-constructed initial network model to obtain a preset network model.
[0078] As an optional embodiment, the swarm density map corresponding to each swarm distribution sample image is obtained by the following steps: initial position marking of the bees in the swarm distribution sample image to obtain the position coordinates of each bee in the swarm distribution sample image; a density map acquisition submodule is used to obtain the swarm density map based on the position coordinates of each bee in the swarm distribution image.
[0079] As an optional embodiment, the swarm density map is obtained based on the position coordinates of each bee in the swarm distribution sample image, including: obtaining a feature matrix for characterizing the distribution of bees in the swarm distribution image based on the position coordinates of each bee in the swarm distribution image; and convolving the feature matrix with a preset two-dimensional Gaussian kernel to obtain a swarm density map.
[0080] As an optional embodiment, after obtaining the preset network model, the method further includes: obtaining test data, the test data including: multiple swarm distribution test images and a swarm density test map corresponding to each swarm distribution test image; inputting the swarm distribution test image into the preset network model to obtain a swarm density estimation map; determining the error between the swarm density test map and the swarm density estimation map based on the swarm density test map, the swarm density estimation map and a preset loss function; and optimizing the network weight parameters in the preset network model based on the error.
[0081] As an optional embodiment, the plurality of bee colony distribution sample images include: bee colony distribution images of bees at different growth stages.
[0082] As an optional embodiment, the preset network model is a VGG-16 model.
[0083] As an optional embodiment, the feature area includes a pixel point, the pixel value of the pixel point is 1, and the pixel value of the pixel point in the background area is 0. The number of bees in the bee colony distribution map is obtained by counting the number of feature areas in the bee colony density map, including: summing all pixel values in the bee colony density map to obtain the number of bees.
[0084] The above modules can be implemented by software codes, in which case the above modules can be stored in the memory of the control device. The above modules can also be implemented by hardware such as integrated circuit chips.
[0085] The bee counting device provided in the embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0086] On the third aspect, based on the same inventive concept, Figure 8 As shown, this embodiment provides an electronic device 500, which includes a memory 501 and a processor 502, wherein the memory 501 is coupled to the processor 502, and the memory 501 stores instructions. When the instructions are executed by the processor 502, the electronic device executes the steps of any one of the methods described in the first aspect above.
[0087] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0088] Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if such changes and modifications fall within the scope of the claims and their equivalents, the present invention is intended to include such changes and modifications.
Claims
1. A bee counting method, characterized in that: include: Collecting bee colony distribution images in a preset area, wherein the preset area is inside a beehive or a beehive, and the bee colony distribution images are obtained by collecting bees in the preset area at different times; Inputting the bee swarm distribution image into a preset network model to obtain a bee swarm density map corresponding to the bee swarm distribution image, wherein the bee swarm density map includes a background area and a feature area, each feature area corresponds to the position of a bee in the bee swarm distribution image, and the pixel value of the pixel point in the feature area is different from the pixel value of the pixel point in the background area; Obtaining the number of bees in the bee colony distribution image by counting the number of characteristic areas in the bee colony density map; The preset network model is obtained by training according to the following steps: obtaining sample data, the sample data including: a plurality of bee colony distribution sample images and a bee colony density map corresponding to each bee colony distribution sample image; training a pre-constructed initial network model based on the sample data to obtain the preset network model; The plurality of bee colony distribution sample images include bee colony distribution images at different growth stages of bees.
2. The method according to claim 1, wherein The bee colony density map corresponding to each bee colony distribution sample image is obtained by the following steps: Marking the positions of the bees in the bee colony distribution sample image to obtain the position coordinates of each bee in the bee colony distribution sample image; The bee colony density map is obtained based on the position coordinates of each bee in the bee colony distribution sample image.
3. The method according to claim 2, wherein The step of obtaining the bee colony density map based on the position coordinates of each bee in the bee colony distribution sample image includes: Based on the position coordinates of each bee in the bee colony distribution image, a feature matrix is obtained for characterizing the distribution of bees in the bee colony distribution image; The feature matrix is convolved with a preset two-dimensional Gaussian kernel to obtain the bee colony density map.
4. The method according to claim 1, wherein After obtaining the preset network model, the method further includes: Acquire test data, the test data comprising: a plurality of bee colony distribution test images and a bee colony density test graph corresponding to each bee colony distribution test image; Inputting the bee colony distribution test image into the preset network model to obtain a bee colony density estimation map; Determining an error between the bee colony density test graph and the bee colony density estimation graph according to the bee colony density test graph, the bee colony density estimation graph, and a preset loss function; The network weight parameters in the preset network model are optimized based on the error.
5. The method according to claim 1, wherein The preset network model is the VGG-16 model.
6. The method according to claim 1, wherein The characteristic region includes a pixel point, the pixel value of the pixel point is 1, and the pixel value of the background region pixel point is 0. The number of bees in the bee colony distribution image is obtained by counting the number of characteristic regions in the bee colony density map, including: The number of bees is obtained by summing up all pixel values in the bee colony density map.
7. A bee counting device, characterized in that: The device comprises: A bee colony distribution image acquisition module is used to acquire bee colony distribution images in a preset area, wherein the preset area is inside a beehive or a beehive, and the bee colony distribution images are acquired by collecting bees in the preset area at different times; a swarm density map acquisition module, configured to input the swarm distribution image into a preset network model to obtain a swarm density map corresponding to the swarm distribution image, wherein the swarm density map includes a background area and a feature area, each feature area corresponds to the position of a bee in the swarm distribution image, and the pixel values of the pixels in the feature area are different from the pixel values of the pixels in the background area; A bee number calculation module, configured to obtain the number of bees in the bee colony distribution image by counting the number of characteristic areas in the bee colony density map; The preset network model is trained according to the following steps: obtaining sample data, the sample data including: multiple bee colony distribution sample images and a bee colony density map corresponding to each bee colony distribution sample image; based on the sample data, training a pre-constructed initial network model to obtain the preset network model; the multiple bee colony distribution sample images including: bee colony distribution images of bees at different growth periods.
8. An electronic device, characterized in that: The electronic device includes a memory and a processor, wherein the memory is coupled to the processor and stores instructions. When the instructions are executed by the processor, the electronic device executes the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Insect identification early warning method and system
CN107463958A
Target quantity determination method, device and equipment and storage medium
CN111178235A