A bee detection method, system, computer and storage medium
By using the combination of YOLOv8 model and Transformer encoder in bee recognition, the problem of low recognition accuracy and efficiency of traditional methods in complex environments is solved, efficient bee detection and data analysis are achieved, and more accurate identification results are provided .
Patent Information
- Application Number
- CN202411404911.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-10-10
AI Technical Summary
Traditional bee identification methods have low accuracy and efficiency in complex outdoor environments, making it difficult to achieve efficient data analysis and processing, and cannot provide timely and effective decision-making for beekeepers.
A neural network model based on the YOLOv8 model is adopted, combined with the Transformer encoder and perceptron, the bee image data is processed through the feature fusion module and the stitching module, and the high-dimensional feature vector is obtained and recognized.
It improves the accuracy and efficiency of bee detection, can accurately detect small target bee images, optimizes feature extraction, and enhances the model's ability to recognize bee images.
Smart Images

Figure CN118918444B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image detection technology, and in particular to a bee detection method, system, computer and storage medium. Background Art
[0002] Beehives are key tools for beekeeping, and their design and management are directly related to the health of bees and the production of honey. However, traditional beehives have many shortcomings in management and data collection, and mainly rely on manual operation, which is not only labor-intensive but also difficult to achieve refined management. For example, key data such as the entry and exit activities of bees, hive environmental parameters, and honey production often need to be manually checked and recorded regularly, which is inefficient and prone to errors.
[0003] Traditional bee identification methods rely on image processing and artificial intelligence algorithms, such as morphological feature-based identification methods, but the accuracy and efficiency of identification are limited in complex outdoor environments. In addition, bees are small target organisms, and their identification and tracking are difficult in existing intelligent beehive systems, especially in complex backgrounds. It is difficult to achieve efficient data analysis and processing, and it is impossible to provide timely and effective decisions for beekeepers. Summary of the invention
[0004] In view of the deficiencies in the prior art, the object of the present invention is to provide a bee detection method, system, computer and storage medium, aiming to solve the technical problems of poor recognition accuracy and efficiency in the prior art.
[0005] In order to achieve the above object, in a first aspect, the present invention provides a bee detection method, comprising the following steps:
[0006] Get image data of bees;
[0007] A neural network model including a Transformer encoder and a perceptron is established based on the YOLOv8 model, wherein the neural network model further includes a feature fusion module for fusing feature maps output by each C2F module in the YOLOv8 model, and a splicing module for splicing a first output feature of the YOLOv8 model with a second output feature of the feature fusion module;
[0008] Among them, the calculation expression of the feature fusion module is:
[0009] ;
[0010] ;
[0011] In the formula, is the fused feature map, represents the concatenation operation on the channel dimension, is the output feature map after pooling, represents the input feature map of the C2F module, i is the number of C2F modules, represents the size of the pooling window, Represents maximum pooling processing;
[0012] Input the image data into the neural network model, obtain a high-dimensional feature vector based on the splicing module output, and input the high-dimensional feature vector into the Transformer encoder for processing;
[0013] The data processed by the Transformer encoder is input into the perceptron, so as to identify the number and position information of individual bees in the image data based on the perceptron.
[0014] According to one aspect of the above technical solution, the step of obtaining a high-dimensional feature vector based on the splicing module output specifically includes:
[0015] Consistency scaling is performed on the first output feature and the second output feature respectively through the SPPF module;
[0016] The two output features after scaling are spliced based on the splicing module to obtain a high-dimensional feature vector.
[0017] According to one aspect of the above technical solution, the C2F module includes a first convolutional layer, a data segmentation layer connected to the first convolutional layer, two bottleneck layers connected to the data segmentation layer, a fusion layer connected to the two bottleneck layers, and a second convolutional layer connected to the fusion layer;
[0018] The C2F module is specifically used for:
[0019] Performing convolution processing on the input data through the first convolution layer, then segmenting the data based on the data segmentation layer, and then passing the segmented data to the two bottleneck layers respectively;
[0020] The data processed by the two bottleneck layers are fused based on the fusion layer, and finally the fused data is convolved through the second convolution layer.
[0021] According to one aspect of the above technical solution, the neural network model also includes a CBS module, and the CBS module includes a convolution layer, a batch normalization layer, and a SiLU activation function;
[0022] The calculation expression of the batch normalization layer is:
[0023] ;
[0024] In the formula, is the normalized and scaled output feature, and are learnable scaling and offset parameters, respectively. is the input value, is the mean of the mini-batch, is the variance of the mini-batch, is a numerically stable constant.
[0025] According to one aspect of the above technical solution, the neural network model includes:
[0026] a first CBS module for receiving the image data, a second CBS module, a first C2F module, a third CBS module, a second C2F module, a fourth CBS module, a third C2F module, a fifth CBS module, a fourth C2F module, and a first SPPF module connected sequentially to the first CBS module, wherein the first SPPF module is used to output the first output feature;
[0027] The neural network model also includes a second SPPF module connected to the feature fusion module, the feature fusion module is respectively connected to the first C2F module, the second C2F module, the third C2F module, and the fourth C2F module, and the second SPPF module is used to output the second output feature.
[0028] According to one aspect of the above technical solution, the Transformer encoder includes a first normalization layer for receiving the high-dimensional feature vector, a multi-head self-attention layer sequentially connected to the first normalization layer, a first connection layer, a second normalization layer, a first multi-layer perceptron layer, and a second connection layer;
[0029] The perceptron includes a second multi-layer perceptron layer for receiving output features of the Transformer encoder, and a prediction layer connected to the second multi-layer perceptron layer.
[0030] In a second aspect, the present application also provides a bee detection system, comprising:
[0031] An image module, used to obtain image data of bees;
[0032] A neural network model module, used to establish a neural network model including a Transformer encoder and a perceptron based on a YOLOv8 model, wherein the neural network model further includes a feature fusion module for fusing feature maps output by each C2F module in the YOLOv8 model, and a splicing module for splicing a first output feature of the YOLOv8 model with a second output feature of the feature fusion module;
[0033] Among them, the calculation expression of the feature fusion module is:
[0034] ;
[0035] ;
[0036] In the formula, is the fused feature map, represents the concatenation operation on the channel dimension, is the output feature map after pooling, represents the input feature map of the C2F module, i is the number of C2F modules, represents the size of the pooling window, Represents maximum pooling processing;
[0037] A processing module, used for inputting the image data into the neural network model, obtaining a high-dimensional feature vector based on the output of the splicing module, and inputting the high-dimensional feature vector into the Transformer encoder for processing;
[0038] The recognition module is used to input the data processed by the Transformer encoder into the sensor, so as to recognize the number and position information of individual bees in the image data based on the sensor.
[0039] According to one aspect of the above technical solution, the processing module is specifically used for:
[0040] Consistency scaling is performed on the first output feature and the second output feature respectively through the SPPF module;
[0041] The two output features after scaling are spliced based on the splicing module to obtain a high-dimensional feature vector.
[0042] According to one aspect of the above technical solution, the C2F module includes a first convolutional layer, a data segmentation layer connected to the first convolutional layer, two bottleneck layers connected to the data segmentation layer, a fusion layer connected to the two bottleneck layers, and a second convolutional layer connected to the fusion layer;
[0043] The C2F module is specifically used for:
[0044] Performing convolution processing on the input data through the first convolution layer, then segmenting the data based on the data segmentation layer, and then passing the segmented data to the two bottleneck layers respectively;
[0045] The data processed by the two bottleneck layers are fused based on the fusion layer, and finally the fused data is convolved through the second convolution layer.
[0046] In a third aspect, an embodiment of the present application provides a computer, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, a bee detection method as described in the first aspect is implemented.
[0047] In a fourth aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements a bee detection method as described in the first aspect.
[0048] Compared with the prior art, the invention has the following beneficial effects: the different feature maps obtained by each C2F module are combined into a new feature map through the feature fusion module as the first output feature, the feature map obtained by the C2F module of the last layer is used as the second output feature, and the first output feature and the second output feature are spliced together; the output vector of the neural network model module is converted from The feature vector is flattened and converted into 400 1920-dimensional high-dimensional vectors to meet the input requirements of the Transformer encoder, and then the high-dimensional vector is input into the Transformer encoder. The output of the encoder is connected to a multi-layer perceptron. Finally, the multi-layer perceptron can detect and identify bee images. It combines the advantages of YOLOv8 and Transformer encoder in feature extraction, and optimizes the fusion of multi-layer features in the YOLOv8 backbone network to obtain more feature information, so as to accurately detect small target bee images and improve the accuracy and efficiency of bee detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 is a flow chart of a bee detection method in a first embodiment of the present invention;
[0050] Figure 2 This is a schematic diagram of the working process of the feature fusion module in the first embodiment of the present invention;
[0051] Figure 3 A neural network flow chart of the bee detection method in the first embodiment of the present invention;
[0052] Figure 4 It is a structural block diagram of a bee detection system in a second embodiment of the present invention;
[0053] Figure 5 It is a schematic diagram of the structure of a beehive in the second embodiment of the present invention;
[0054] Figure 6 It is a schematic diagram of the structure of the base, main control circuit board, controller and lithium battery of the beehive in the second embodiment of the present invention;
[0055] Figure 7It is a schematic diagram of the structure of the honeycomb and the environmental monitoring sensor in the second embodiment of the present invention;
[0056] Figure 8 This is a schematic diagram of the workflow of a bee detection system in a specific implementation scenario in the second embodiment of the present invention;
[0057] Fig. 9 is a schematic diagram of the hardware structure of a computer in a third embodiment of the present invention;
[0058] The following specific implementation manner will further illustrate the present invention in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION
[0059] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Several embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.
[0060] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be a central element. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be a central element at the same time. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are for illustrative purposes only.
[0061] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.
[0062] Embodiment 1
[0063] See also Figure 1 , which is a bee detection method in the first embodiment of the present invention, comprising the following steps:
[0064] Step S100, obtaining image data of bees. Specifically, in some application scenarios of this embodiment, the image data is data obtained by a camera arranged on a beehive.
[0065] Step S200, based on the YOLOv8 model, a neural network model including a Transformer encoder and a perceptron is established, wherein the neural network model also includes a feature fusion module for fusing feature maps output by each C2F module in the YOLOv8 model, and a splicing module for splicing a first output feature of the YOLOv8 model with a second output feature of the feature fusion module.
[0066] Specifically, in this embodiment, the C2F module includes a first convolutional layer, a data segmentation layer connected to the first convolutional layer, two bottleneck layers connected to the data segmentation layer, a fusion layer connected to the two bottleneck layers, and a second convolutional layer connected to the fusion layer;
[0067] The C2F module is specifically used for:
[0068] Performing convolution processing on the input data through the first convolution layer, then segmenting the data based on the data segmentation layer, and then passing the segmented data to the two bottleneck layers respectively;
[0069] The data processed by the two bottleneck layers are fused based on the fusion layer, and finally the fused data is convolved through the second convolution layer.
[0070] Specifically, the C2F module processes the input through the first convolutional layer, then splits the data and passes it to two bottleneck layers (Bottleneck_1 and Bottleneck_2). The data processed by the two bottleneck layers are fused through the fusion layer and finally processed through the second convolutional layer. In this process, the data is effectively fused between the split operation and the first bottleneck layer, and between the two bottleneck layers through the connection module.
[0071] Step S300, input the image data into the neural network model, obtain a high-dimensional feature vector based on the output of the splicing module, and input the high-dimensional feature vector into the Transformer encoder for processing. Specifically, by annotating the image data collected by the camera, the image data is divided into a training set, a validation set, and a test set. The neural network model is trained with the training set to train the convolutional layer parameters of the backbone network, the parameters of the Transformer encoder, and the multi-layer perceptron parameters at the tail of the model; and the validation set is used to tune the model. The trained model is tested with the test set to obtain the output; the model with excellent test performance is used for bee image recognition.
[0072] Preferably, in this embodiment, the step of obtaining a high-dimensional feature vector based on the splicing module output specifically includes:
[0073] Consistency scaling is performed on the first output feature and the second output feature respectively through the SPPF module;
[0074] The two output features after scaling are spliced based on the splicing module to obtain a high-dimensional feature vector.
[0075] like Figure 2 As shown in Figure 1, the feature fusion module, referred to as the MC2FS module, is used to stitch all C2F feature maps output by different pooling layers. , , as well as Four pooling layers of different sizes are combined to obtain feature map information at different levels, providing the model with richer and more detailed feature representation and enhancing the model's ability to recognize bee images.
[0076] Furthermore, the calculation expression of the feature fusion module is:
[0077] ;
[0078] ;
[0079] In the formula, is the fused feature map, represents the concatenation operation on the channel dimension, is the output feature map after pooling, represents the input feature map of the C2F module, i is the number of C2F modules, represents the size of the pooling window, Represents maximum pooling processing.
[0080] In this embodiment, the SPPF module is composed of a Conv_1 layer, a Maxpooling_1 layer, a MaxPooling_2 layer, a Maxpooling_3 layer, a Concat layer and a Conv_2 layer, wherein the Conv_1 layer, the Conv_2 layer, the MaxPooling_1 layer, the MaxPooling_2 layer and the Maxpooling_3 layer are connected to the Concat layer respectively.
[0081] The MaxPooling layer is the maximum pooling layer, which is used to remove redundant information and expand the receptive field; the Conv_1 layer is a convolutional layer, which is used for image convolution; the Concat layer is used to merge feature maps of the same size but different channel parameters to enhance feature representation; the Conv_2 layer is used to convert the feature dimension to the same dimension as the last layer of the C2F module and used for subsequent feature fusion.
[0082] Specifically, in this embodiment, the neural network model further includes a CBS module, and the CBS module includes a convolutional layer, a batch normalization layer, and a SiLU activation function, forming the basic structure of the CBS module.
[0083] Among them, the calculation expression of the batch normalization layer is:
[0084] ;
[0085] In the formula, is the normalized and scaled output feature, and are learnable scaling and offset parameters, respectively. is the input value, is the mean of the mini-batch, is the variance of the mini-batch, is a numerical stability constant. The above numerical stability constant is a very small constant used for numerical stability. It should be noted that the CBS module is a common module in the YOLOv8 model and will not be described in detail here.
[0086] In addition, in this embodiment, the Transformer encoder includes a first normalization layer for receiving the high-dimensional feature vector, a multi-head self-attention layer sequentially connected to the first normalization layer, a first connection layer, a second normalization layer, a first multi-layer perceptron layer, and a second connection layer;
[0087] The perceptron includes a second multi-layer perceptron layer for receiving output features of the Transformer encoder, and a prediction layer connected to the second multi-layer perceptron layer.
[0088] The Transformer encoder follows the standard Transformer architecture, including normalization layers, multi-head self-attention layers, and a feed-forward neural network.
[0089] For ease of understanding, in this embodiment, the neural network model includes:
[0090] a first CBS module for receiving the image data, a second CBS module, a first C2F module, a third CBS module, a second C2F module, a fourth CBS module, a third C2F module, a fifth CBS module, a fourth C2F module, and a first SPPF module connected sequentially to the first CBS module, wherein the first SPPF module is used to output the first output feature;
[0091] The neural network model also includes a second SPPF module connected to the feature fusion module, the feature fusion module is respectively connected to the first C2F module, the second C2F module, the third C2F module, and the fourth C2F module, and the second SPPF module is used to output the second output feature.
[0092] like Figure 3 As shown, the complete network structure is: image input-CBS-CBS- C2F-CBS-C2F-CBS-C2F-CBS-C2F-SPPF-MC2FS-SPPF-Transformer encoder-multilayer perceptron-output.
[0093] Step S400: input the data processed by the Transformer encoder into the sensor, so as to identify the number and position information of individual bees in the image data based on the sensor.
[0094] In summary, the bee detection method in the above embodiment of the present invention combines different feature maps obtained by each C2F module into a new feature map through the feature fusion module as the first output feature, uses the feature map obtained by the C2F module of the last layer as the second output feature, and splices the first output feature and the second output feature together; the output vector of the neural network model module is converted from The feature vector is flattened and converted into 400 1920-dimensional high-dimensional vectors to meet the input requirements of the Transformer encoder, and then the high-dimensional vector is input into the Transformer encoder. The output of the encoder is connected to a multi-layer perceptron. Finally, the multi-layer perceptron can detect and identify bee images. It combines the advantages of YOLOv8 and Transformer encoder in feature extraction, and optimizes the fusion of multi-layer features in the YOLOv8 backbone network to obtain more feature information, so as to accurately detect small target bee images and improve the accuracy and efficiency of bee detection.
[0095] Embodiment 2
[0096] The second embodiment of the present application also provides a bee detection system, which is used to implement the embodiments and preferred implementations, and will not be repeated hereafter. As used below, the terms "module", "unit", "subunit", etc. can implement a combination of software and / or hardware for a predetermined function. Although the systems described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and contemplated.
[0097] like Figure 4 As shown, the system includes: an image module 100, a neural network model module 200, a processing module 300, and a recognition module 400.
[0098] The image module 100 is used to obtain image data of bees;
[0099] The neural network model module 200 is used to establish a neural network model including a Transformer encoder and a perceptron based on the YOLOv8 model, wherein the neural network model also includes a feature fusion module for fusing the feature graphs output by each C2F module in the YOLOv8 model, and a splicing module for splicing the first output feature of the YOLOv8 model with the second output feature of the feature fusion module;
[0100] The processing module 300 is used to input the image data into the neural network model, obtain a high-dimensional feature vector based on the output of the splicing module, and input the high-dimensional feature vector into the Transformer encoder for processing;
[0101] The recognition module 400 is used to input the data processed by the Transformer encoder into the sensor, so as to recognize the number and position information of individual bees in the image data based on the sensor.
[0102] Specifically, in this embodiment, the processing module 300 is specifically used for:
[0103] Consistency scaling is performed on the first output feature and the second output feature respectively through the SPPF module;
[0104] The two output features after scaling are spliced based on the splicing module to obtain a high-dimensional feature vector.
[0105] Further, in this embodiment, the C2F module includes a first convolutional layer, a data segmentation layer connected to the first convolutional layer, two bottleneck layers connected to the data segmentation layer, a fusion layer connected to the two bottleneck layers, and a second convolutional layer connected to the fusion layer;
[0106] The C2F module is specifically used for:
[0107] Performing convolution processing on the input data through the first convolution layer, then segmenting the data based on the data segmentation layer, and then passing the segmented data to the two bottleneck layers respectively;
[0108] The data processed by the two bottleneck layers are fused based on the fusion layer, and finally the fused data is convolved through the second convolution layer.
[0109] For ease of understanding, in this embodiment, reference Figure 5-Figure 8, which shows the appearance structure and installation deployment of the hardware monitoring equipment in the implementation scheme corresponding to the bee detection system in the present invention, and demonstrates the workflow of the bee detection system.
[0110] Among them, the beehive structure of the hardware monitoring equipment is as follows Figure 5 to Figure 7 As shown, it includes a solar panel 1, a controller and a lithium battery 2, a main control circuit board 3, an environment monitoring sensor 4 in the beehive, a camera 5, a nest door including a servo 6, and a weighing sensor 7.
[0111] A solar panel 1 is placed on the top of the beehive. The solar panel 1 uses a single crystal solar panel with a specification of 18V20W. The solar panel 1 is connected to the controller and the lithium battery 2. The controller and the lithium battery 2 supply power to the main control circuit board 3 through the DC interface. The main control circuit board 3 uses a low-power STM32L431 chip. In order to achieve online upgrades, an additional flash memory is connected to the main control circuit board 3 to store the upgrade program issued by the server. The environmental monitoring sensor 4 in the beehive is connected to the main control circuit board 3 through a double-headed Type-C cable. The environmental monitoring sensor 4 includes a circuit board and a temperature and humidity sensor, a carbon dioxide sensor, and a sound sensor welded on the circuit board. The environmental monitoring sensor 4 is placed in a special honeycomb. By moving the honeycomb, the environmental parameters of any point in the beehive can be measured. The 5-megapixel zoom camera 5 is connected to the network transmission module on the main control circuit board 3 through a network cable. The nest door 6 with a servo is connected to the main control circuit board 3 through a 1.25mm 4P interface. Four weighing sensors 7 are respectively installed on the four feet of the beehive base, and the four weighing sensors 7 are connected to the main control circuit board 3 via USB. The GPS positioning module is directly welded on the main control circuit board and transmits data to the main control circuit board 3 via the serial port. The main control circuit board 3 includes dual DC interfaces and dual network ports. The dual DC interfaces realize two power supply modes: solar energy and mains electricity. The dual network ports can connect two cameras to view different bee pictures by adjusting the focal length.
[0112] The workflow of the bee detection system is as follows Figure 8As shown, the main control circuit board 3 collects information such as temperature and humidity, sound frequency, carbon dioxide concentration, weight, location, and bee image in the beehive, and uploads this information to the MySQL database of the server through the TCP protocol with the help of the network transmission module. Through feature extraction and multi-core learning, multi-source data is integrated to establish an early warning model, and early warning is given for abnormal situations such as swarming and sudden drop in temperature. The opening and closing angle of the nest door is controlled in time, and the time interval of the camera capturing images is adjusted to maximize the capture of image information under abnormal conditions. The WeChat applet can follow the beehive by scanning the code, view the specific environmental parameters and location information of each beehive of concern, and realize honey traceability. At the same time, the abnormal situation information when the early warning model is triggered can be read from the database of the server. When the early warning model is more and more perfect or a new control instruction is added, the main control circuit board 3 can be upgraded online through the server.
[0113] In summary, the bee detection system in the above embodiment of the present invention combines the advantages of YOLOv8 and Transformer encoders in feature extraction, optimizes the fusion of multi-layer features in the YOLOv8 backbone network to obtain more feature information, thereby accurately detecting small target bee images, so as to improve the accuracy and efficiency of bee detection.
[0114] It should be noted that each module can be a functional module or a program module, and can be implemented by software or hardware. For modules implemented by hardware, each module can be located in the same processor; or each module can be located in different processors in any combination.
[0115] Embodiment 3
[0116] A third embodiment of the present application provides a computer, which may include a processor 81 and a memory 82 storing computer program commands.
[0117] Specifically, the processor 81 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0118] Among them, the memory 82 may include a large-capacity memory for data or commands. By way of example and not limitation, the memory 82 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 82 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 82 may be inside or outside the data processing device. In a specific embodiment, the memory 82 is a non-volatile memory. In a specific embodiment, the memory 82 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically alterable ROM (EAROM) or a flash memory (FLASH), or a combination of two or more of these. Under appropriate circumstances, the RAM can be a static random access memory (SRAM) or a dynamic random access memory (DRAM), wherein the DRAM can be a fast page mode dynamic random access memory (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.
[0119] The memory 82 may be used to store or cache various data files that need to be processed and / or used for communication, as well as possible computer program commands executed by the processor 81 .
[0120] The processor 81 implements any one of the bee detection methods in the above embodiments by reading and executing computer program commands stored in the memory 82 .
[0121] In some embodiments, the computer may further include a communication interface 83 and a bus 80. Fig. 9 As shown, the processor 81, the memory 82, and the communication interface 83 are connected via a bus 80 and communicate with each other.
[0122] The communication interface 83 is used to implement communication between the modules, devices, units and / or equipment in the embodiment of the present application. The communication interface 83 can also implement data communication with other components such as: external devices, image / data acquisition equipment, databases, external storage, and image / data processing workstations.
[0123] The bus 80 includes hardware, software or both, and couples the components of the computer to each other. The bus 80 includes but is not limited to at least one of the following: a data bus, an address bus, a control bus, an expansion bus, and a local bus. By way of example and not limitation, bus 80 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses or a combination of two or more of these. Where appropriate, bus 80 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.
[0124] Embodiment 4
[0125] The fourth embodiment of the present application provides a readable storage medium having computer program commands stored thereon; when the computer program commands are executed by a processor, any one of the bee detection methods in the above embodiments is implemented.
[0126] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0127] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A bee detection method, characterized in that: The following steps are involved: Get image data of bees; A neural network model including a Transformer encoder and a perceptron is established based on the YOLOv8 model, wherein the neural network model further includes a feature fusion module for fusing feature maps output by each C2F module in the YOLOv8 model, and a splicing module for splicing a first output feature of the YOLOv8 model with a second output feature of the feature fusion module; Among them, the calculation expression of the feature fusion module is: ; ; In the formula, is the fused feature map, represents the concatenation operation on the channel dimension, is the output feature map after pooling, represents the input feature map of the C2F module, i is the number of C2F modules, represents the size of the pooling window, Represents maximum pooling processing; Input the image data into the neural network model, obtain a high-dimensional feature vector based on the splicing module output, and input the high-dimensional feature vector into the Transformer encoder for processing; Inputting the data processed by the Transformer encoder into the sensor to identify the number and position information of individual bees in the image data based on the sensor; The C2F module includes a first convolutional layer, a data segmentation layer connected to the first convolutional layer, two bottleneck layers connected to the data segmentation layer, a fusion layer connected to the two bottleneck layers, and a second convolutional layer connected to the fusion layer; The C2F module is specifically used for: Performing convolution processing on the input data through the first convolution layer, then segmenting the data based on the data segmentation layer, and then passing the segmented data to the two bottleneck layers respectively; Based on the fusion layer, the data processed by the two bottleneck layers are fused, and finally the fused data is convolved by the second convolution layer; The neural network model includes: a first CBS module for receiving the image data, a second CBS module, a first C2F module, a third CBS module, a second C2F module, a fourth CBS module, a third C2F module, a fifth CBS module, a fourth C2F module, and a first SPPF module connected sequentially to the first CBS module, wherein the first SPPF module is used to output the first output feature; The neural network model also includes a second SPPF module connected to the feature fusion module, the feature fusion module is respectively connected to the first C2F module, the second C2F module, the third C2F module, and the fourth C2F module, and the second SPPF module is used to output the second output feature.
2. The bee detection method according to claim 1, characterized in that: The step of obtaining a high-dimensional feature vector based on the splicing module output specifically includes: Consistency scaling is performed on the first output feature and the second output feature respectively through the SPPF module; The two output features after scaling are spliced based on the splicing module to obtain a high-dimensional feature vector.
3. The bee detection method according to claim 1, characterized in that: The neural network model also includes a CBS module, and the CBS module includes a convolution layer, a batch normalization layer, and a SiLU activation function; The calculation expression of the batch normalization layer is: ; In the formula, is the normalized and scaled output feature, and are learnable scaling and offset parameters, respectively. is the input value, is the mean of the mini-batch, is the variance of the mini-batch, is a numerically stable constant.
4. The bee detection method according to claim 1, characterized in that: The Transformer encoder includes a first normalization layer for receiving the high-dimensional feature vector, a multi-head self-attention layer sequentially connected to the first normalization layer, a first connection layer, a second normalization layer, a first multi-layer perceptron layer, and a second connection layer; The perceptron includes a second multi-layer perceptron layer for receiving output features of the Transformer encoder, and a prediction layer connected to the second multi-layer perceptron layer.
5. A bee detection system, characterized in that: include: An image module, used to obtain image data of bees; A neural network model module, used to establish a neural network model including a Transformer encoder and a perceptron based on a YOLOv8 model, wherein the neural network model further includes a feature fusion module for fusing feature maps output by each C2F module in the YOLOv8 model, and a splicing module for splicing a first output feature of the YOLOv8 model with a second output feature of the feature fusion module; Among them, the calculation expression of the feature fusion module is: ; ; In the formula, is the fused feature map, represents the concatenation operation on the channel dimension, is the output feature map after pooling, represents the input feature map of the C2F module, i is the number of C2F modules, represents the size of the pooling window, Represents maximum pooling processing; A processing module, used for inputting the image data into the neural network model, obtaining a high-dimensional feature vector based on the output of the splicing module, and inputting the high-dimensional feature vector into the Transformer encoder for processing; A recognition module, used for inputting the data processed by the Transformer encoder into the sensor, so as to recognize the number and position information of individual bees in the image data based on the sensor; The C2F module includes a first convolutional layer, a data segmentation layer connected to the first convolutional layer, two bottleneck layers connected to the data segmentation layer, a fusion layer connected to the two bottleneck layers, and a second convolutional layer connected to the fusion layer; The C2F module is specifically used for: Performing convolution processing on the input data through the first convolution layer, then segmenting the data based on the data segmentation layer, and then passing the segmented data to the two bottleneck layers respectively; Based on the fusion layer, the data processed by the two bottleneck layers are fused, and finally the fused data is convolved by the second convolution layer; The neural network model includes: a first CBS module for receiving the image data, a second CBS module, a first C2F module, a third CBS module, a second C2F module, a fourth CBS module, a third C2F module, a fifth CBS module, a fourth C2F module, and a first SPPF module connected sequentially to the first CBS module, wherein the first SPPF module is used to output the first output feature; The neural network model also includes a second SPPF module connected to the feature fusion module, the feature fusion module is respectively connected to the first C2F module, the second C2F module, the third C2F module, and the fourth C2F module, and the second SPPF module is used to output the second output feature.
6. A computer comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the bee detection method according to any one of claims 1 to 4 is implemented.
7. A storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the bee detection method as described in any one of claims 1 to 4 is implemented.
Citation Information
Cited By
Bee counting method and device based on lightweight density regression and semi-supervised learning
CN122244807A
A honeybee counting method and device based on lightweight density regression and semi-supervised learning
CN122244807B
