Red deer identification and detection method, system, equipment and medium
By acquiring images using visible light and infrared dual-light sensors and combining them with an illumination-adaptive enhancement network and an improved YOLOv8 model, the robustness and false negative rate of UAV remote sensing deer identification technology in all-weather environments were solved. This enabled adaptive fusion of multimodal images and fine-grained identification, improving detection accuracy and monitoring efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING FORESTRY UNIVERSITY
- Filing Date
- 2026-01-22
- Publication Date
- 2026-05-01
AI Technical Summary
Existing UAV remote sensing technology for identifying red deer has poor robustness in all-weather environments, especially with a high false negative rate in nighttime infrared images. It lacks sufficient coordination between feature focusing mechanisms and multi-scale structures, and multi-modal image features are not effectively fused, resulting in a lack of fine-grained identification of key biological attributes.
Images are acquired using visible light and infrared dual-light sensors. An improved YOLOv8 deep learning model is constructed through illumination adaptive enhancement network processing. The model combines GAM and CBAM fusion attention mechanism, inserts a multi-scale detection head, and integrates an attribute prediction sub-branch within the detection head to achieve adaptive fusion of multimodal images and identification of key biological attributes.
It achieves robust detection and attribute analysis in complex natural scenarios under all weather conditions, reduces the false negative rate, improves detection accuracy and biological attribute recognition capabilities, and expands the spatiotemporal dimensions and application value of monitoring.
Smart Images

Figure CN121963256A_ABST
Abstract
Description
A method, system, device and medium for identifying and detecting red deer Technical Field
[0001] This invention relates to the field of computer vision technology, and in particular to a method, system, device and medium for recognizing and detecting red deer. Background Technology
[0002] With the widespread application of UAV remote sensing technology in wildlife monitoring, target detection methods combined with deep learning have become an important means of automated identification. Among them, the YOLO series of algorithms, due to their excellent real-time performance and accuracy, are being explored for processing image data collected by UAVs. To further improve model performance, existing technologies often introduce attention mechanisms (such as CBAM, GAM, etc.) into the network, or enhance multi-scale detection capabilities by adding detection heads, aiming to achieve the identification of animals such as red deer in complex natural scenes.
[0003] However, existing methods still have significant shortcomings when applied to UAV remote sensing for deer identification. First, UAV imagery is susceptible to interference from changes in lighting, weather conditions, and complex backgrounds, especially at night or in low-light environments, where visible light-dependent systems almost completely fail. General models lack targeted preprocessing mechanisms, resulting in poor feature extraction robustness. Second, to achieve 24-hour monitoring, some studies have attempted to introduce infrared thermal imaging, but infrared images generally suffer from low contrast, blurred texture details, and easy confusion between target and background thermal radiation features, leading to a sharp decline in performance when directly applying visible light-based models. Furthermore, deer targets in images are often small-scale, and existing network structures are insufficient in representing small target features, resulting in a high false negative rate. This problem is even more pronounced in relatively low-resolution infrared images. In addition, the introduction of attention mechanisms is often singular and isolated, failing to achieve complementary advantages between different attention mechanisms, lacking deep collaboration with multi-scale detection structures, and failing to adaptively fuse and focus image features from different modalities of visible light and infrared. Finally, existing methods typically only detect bounding boxes and fail to combine key biological attributes of red deer (such as whether they have antlers, body size, etc.) for fine-grained identification, which limits the model's discriminative ability and application value. This deficiency is particularly evident when judging based solely on infrared shape at night.
[0004] Therefore, there is an urgent need for a comprehensive solution that can simultaneously address issues such as all-weather environmental adaptability, multimodal image fusion, small target detection, effective feature focusing, and fine-grained attribute recognition. Summary of the Invention
[0005] The purpose of this invention is to provide a method, system, device, and medium for identifying and detecting red deer, in order to solve the problems faced by existing UAV remote sensing red deer identification technology, such as poor environmental adaptability due to large differences in day and night imaging conditions, high false negative rate of small targets (especially in nighttime infrared images), insufficient coordination between feature focusing mechanism and multi-scale structure, ineffective fusion of multimodal (visible light / infrared) image features, and lack of simultaneous fine-grained identification of key biological attributes (especially when visible light texture information is lacking at night). This invention aims to achieve robust and accurate detection and attribute analysis of red deer targets in complex natural scenes under all weather conditions.
[0006] To achieve the above objectives, this invention provides a method for identifying and detecting red deer, comprising the following steps: Step S1: Using a visible light and infrared dual-light sensor mounted on a drone, orthophotos of the red deer's activity area are collected during the day and at night, and the orthophotos are input into an illumination adaptive enhancement network for processing to obtain enhanced images; Step S2: The enhanced images are labeled, the red deer target is outlined, and biological attribute labels are recorded for it, including whether it has antlers, its size class, and its relative age group; after forming the dataset, it is divided into a training set, a validation set, and a test set; Step S3: An improved YOLOv8 deep learning network is constructed. The learning model is trained, and the model takes the preprocessed enhanced image as input. The improvement is that an attention mechanism module for GAM and CBAM fusion is inserted between the feature fusion network and the detection head, as well as in the multi-scale feature fusion path inside the detection head. The model contains four detection heads of different scales: a micro-target detection head, a small-scale target detection head, a medium-scale target detection head, and a large-scale target detection head. The constructed model is trained using the training set, and the auxiliary loss is calculated using biological attribute labels during training. Step S4: The performance of the trained model is evaluated using the test set.
[0007] Preferably, the specific construction and training method of the illumination adaptive enhancement network is as follows: The network encoder contains four downsampling stages, each stage consisting of two consecutive... The network consists of convolutional layers, batch normalization layers, and SiLU activation functions, and downsampling is performed using convolutions with a stride of 2. The network decoder contains four upsampling stages. Each stage first upsamples the feature map by a factor of 2 using bilinear interpolation, then concatenates the feature maps passed from the corresponding stage of the encoder through skip connections, and finally passes them through two... Convolutional layers perform feature fusion; the output layer of the illumination-adaptive enhancement network is a single layer. The convolutional layer has 3 output channels and uses the sigmoid activation function; the training objective function of the illumination adaptive augmentation network is a composite loss. The calculation formula is as follows: ; ; ; ;in, For multi-scale structural similarity loss, The perceptual loss is based on feature maps extracted from a pre-trained VGG16 network. For physical model constraint loss, , , These are the weighting coefficients for each loss term. For true and clear images, The output image is for the illumination adaptive enhancement network. and The first Brightness comparison and contrast-structure comparison at different scales. For the total number of scales, , These are the weighting coefficients. For the VGG16 network Feature extraction function for a selected layer , , The first The number of channels, height, and width of the layer feature map. This represents the dark channel prior operation, used to constrain the output image. The dark channel value is set close to 0 to simulate the physical properties of a clear, fog-free image.
[0008] Preferably, the improved YOLOv8 deep learning model has a network structure comprising a backbone network, a neck network, and a detection head connected in sequence, as follows: The backbone network sequentially includes: an input layer, a first CBS module, a second CBS module, and a first... Module, Third CBS Module, First Module, Fourth CBS Module, Second Module, Fifth CBS Module, Second The neck network comprises a module, an SPPF module, and a first GAM+CBAM fusion attention mechanism module; the neck network contains three feature fusion paths: the first feature fusion path sequentially includes: the third Module, First Upsampling Module, First Stitching Module, Sixth CBS Module, Fourth The module includes a second GAM+CBAM fusion attention mechanism module; the second feature fusion path sequentially includes: a second upsampling module, a second stitching module, a seventh CBS module, and a fifth... The module and the third GAM+CBAM fusion attention mechanism module; the third feature fusion path includes, in sequence: the eighth CBS module, the third splicing module, and the sixth The detection head includes a first GAM+CBAM fusion attention mechanism module and a fourth GAM+CBAM fusion attention mechanism module; the detection head contains four detection modules: a micro-target detection head, a small-scale target detection head, a medium-scale target detection head, and a large-scale target detection head; wherein, the output of the first GAM+CBAM fusion attention mechanism module is simultaneously connected to the third... The module consists of a large-scale target detection head and a small-scale target detection head. The output of the second GAM+CBAM fusion attention mechanism module is connected to the micro-target detection head. The output of the third GAM+CBAM fusion attention mechanism module is connected to the small-scale target detection head. The output of the fourth GAM+CBAM fusion attention mechanism module is connected to the medium-scale target detection head.
[0009] Preferably, the internal structure of each of the four detection heads includes the following three parallel prediction branches: a bounding box regression branch, used to predict the bounding box coordinates of the target, with an output dimension of 4, corresponding to the center point coordinates of the bounding box. ,width and height The confidence prediction branch is used to predict the confidence of the presence of a target within the bounding box, with an output dimension of 1; the category probability prediction branch is used to predict the probability that the target belongs to the red deer category, with an output dimension of 1; among them, the micro-target detection head, small-scale target detection head, and medium-scale target detection head, in addition to the three basic branches, also include an attribute prediction sub-branch, which is used to predict biological attribute labels based on input features.
[0010] Preferably, the specific structure of the attribute prediction sub-branch is as follows: global average pooling is performed on the input feature map to obtain a feature vector; the feature vector is input into a sub-network containing two fully connected layers; the first fully connected layer reduces the feature dimension to 1 / 4 of the input dimension, and the second fully connected layer restores the dimension; the output layer, depending on the specific task, uses the Sigmoid activation function to output the probability of whether there are angles, or uses the Softmax activation function to output the classification probability distribution of body size level and relative age group.
[0011] Preferably, the connection relationships of each module in the neck network are as follows: Third The input of the module is connected to the output of the first GAM+CBAM fusion attention mechanism module; the third The output of the module is simultaneously connected to the inputs of the first upsampling module and the second upsampling module; the output of the first upsampling module is connected to the first input of the first splicing module, and the output of the second 6×C2f module is connected to the second input of the first splicing module; the output of the first splicing module is sequentially connected to the sixth CBS module and the fourth... Module; Fourth The output of the first module is connected to the input of the second GAM+CBAM fusion attention mechanism module; the output of the second upsampling module is connected to the first input of the second stitching module. The output of the module is connected to the second input of the second splicing module; the output of the second splicing module is connected in sequence to the seventh CBS module and the fifth CBS module. Module; Fifth The output of the module is connected to the input of the third GAM+CBAM fusion attention mechanism module; the fifth The output of the module is also connected to the input of the eighth CBS module; the output of the eighth CBS module is connected to the first input of the third splicing module. The output of module A is connected to the second input of the third splicing module; the output of the third splicing module is connected in sequence to the sixth... The module and the fourth GAM+CBAM fusion attention mechanism module.
[0012] Preferably, the total loss function for model training for: ; ; ; ;in, For bounding box regression loss, For intersection, union, and comparison, To predict the Euclidean distance between the center point of the bounding box and the center point of the ground truth bounding box, To cover the diagonal distance of the minimum closed area of the two frames, For the weight function, As a measure of aspect ratio consistency, For the predicted bounding box parameters, For the parameters of the true bounding box, For category classification loss, For the sample size, For sample index, For real-world labeling, deer is 1, background is 0. The probability that the model predicts the animal to be a red deer. Loss for attribute prediction, To determine whether there is a binary cross-entropy loss with angular attributes, The cross-entropy loss is the size-level attribute. The cross-entropy loss is relative to the age group attribute. , , The weights for the loss of each attribute, The coefficient used to balance the weights between attribute prediction loss and detection loss.
[0013] This invention also provides a red deer identification and detection system, comprising: an image acquisition module for acquiring daytime and nighttime orthophotos of the red deer's activity area using a visible light and infrared dual-light sensor mounted on a drone; an image enhancement module connected to the image acquisition module, which incorporates an illumination-adaptive enhancement network for performing illumination-adaptive enhancement processing on the received orthophotos to obtain enhanced images; and a data management module connected to the image enhancement module for labeling the enhanced images, outlining the red deer target, and recording biological attribute labels including whether it has antlers, its size class, and relative age group, forming a dataset and dividing it into training and validation sets. The module consists of a test set and a model building and training module, connected to the data management module. It builds an improved YOLOv8 deep learning model and trains it using the training set. The model incorporates an attention mechanism module that fuses GAM and CBAM at multiple scales, between the feature fusion network and the detection head, and within the detection head. It includes four detection heads at different scales and uses biological attribute labels to calculate auxiliary loss during training. The detection evaluation module, connected to the model building and training module, evaluates the performance of the trained model using the test set. The central control module coordinates the data transmission and processing flow between these modules.
[0014] The present invention also provides a computer device, including: a memory and a processor; the memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described method for recognizing and detecting a deer.
[0015] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above-described method for identifying and detecting a deer.
[0016] Therefore, the present invention adopts the above-mentioned method, system, equipment and medium for identifying and detecting red deer, and the beneficial technical effects are as follows: (1) The present invention effectively overcomes the imaging interference such as uneven daytime illumination and fog by introducing an illumination adaptive enhancement network designed specifically for UAV images; at the same time, by integrating visible light and infrared dual light sensors, a data acquisition system supporting all-weather monitoring is constructed. This provides high-quality, all-time input for subsequent detection. The innovative four-scale detection head structure (especially the dedicated micro and small-scale target detection head), combined with the GAM+CBAM fusion attention mechanism deployed on the key feature fusion path, enables the model to more accurately capture and enhance the discriminative features of different scales, especially the small red deer targets with weak features in infrared images, thereby significantly reducing the false detection rate and false detection rate in the complex natural background of day and night.
[0017] (2) Unlike existing technologies that simply add attention modules, this invention deeply integrates the global channel attention advantage of GAM with the spatial attention advantage of CBAM and precisely embeds it into the key nodes of the multi-scale feature fusion network (neck network). This design enables the model to adaptively focus on the key areas of the deer target not only at the global level, but also during the local feature extraction process for different detection scales, effectively suppressing background noise. In particular, it can adaptively enhance different feature representations of visible light and infrared images (such as texture vs. thermal radiation), achieving an organic unity between the attention mechanism and the multi-scale feature pyramid structure, thereby improving the overall detection accuracy under all-weather conditions.
[0018] (3) This invention surpasses the traditional detection mode that only outputs bounding boxes. By integrating attribute prediction sub-branches into each detection head, the model can simultaneously predict key biological attributes such as whether the red deer has antlers, its size class, and its relative age group while locating the deer. This not only directly provides structured data for population structure analysis and improves monitoring efficiency, but also enables the model to perform a certain degree of biological attribute inference even at night when relying solely on infrared images, greatly expanding the spatiotemporal dimension and application value of the monitoring data. These attribute features themselves, as strong semantic information, also enhance the ability to distinguish between different types of red deer, realizing the mutual promotion of detection tasks and fine-grained recognition tasks.
[0019] (4) This invention achieves effective fusion and synergistic utilization of visible light and infrared dual-modal images through unified data processing and model architecture. During the training process, the model learns the characteristics of red deer in both modalities, enabling it to utilize rich visible light texture and color information during the day and robustly rely on infrared thermal radiation information for detection and identification at night. Ultimately, this forms a truly meaningful 24-hour automatic red deer monitoring solution that does not require switching models, significantly improving the automation level and practical effectiveness of wildlife monitoring technology. Attached Figure Description
[0020] Figure 1 is a flowchart of a deer identification and detection method according to the present invention; Figure 2 is a diagram of the overall network structure of the improved YOLOv8; Figure 3 is a diagram of the internal structure of the detection head. Detailed Implementation
[0021] The technical solution of the present invention will be further described below with reference to the accompanying drawings and embodiments.
[0022] Unless otherwise defined, the technical or scientific terms used in this invention shall have the ordinary meaning as understood by one of ordinary skill in the art to which this invention pertains.
[0023] Example 1, as shown in Figures 1-3, is a method for recognizing and detecting red deer, as follows: 1. Data set preparation and preprocessing.
[0024] 1.1 Data Acquisition and Planning.
[0025] To construct a representative all-weather image dataset of red deer, systematic day and night drone aerial photography operations were conducted in a nature reserve from June to October 2023.
[0026] Data acquisition equipment: DJI Mavic 3E Enterprise drone, equipped with a 4 / 3-inch CMOS visible light sensor and a high-resolution infrared thermal imaging sensor (such as the Zenmuse H20N payload) to achieve simultaneous acquisition of dual-light data.
[0027] Flight parameters: Daytime flight: Flight altitude 80m (relative to ground), ground resolution (GSD) approximately 2cm / pixel. Forward overlap 80%, lateral overlap 70%.
[0028] Night flight: Activate infrared sensors and adjust the flight altitude to 60m to improve the detection capability of thermal signals of small targets. The overlap ratio requirement is the same as during the day.
[0029] Data collection time: During the day, data collection was conducted within 2 hours after sunrise and 2 hours before sunset; at night, data collection was conducted from complete darkness after sunset to before sunrise, to cover all weather conditions (sunny, cloudy, foggy, and dark).
[0030] The collection area covered four typical habitats in the core area of the reserve: open grassland, larch forest, mixed forest edge, and riparian shrubland, with a total coverage area of approximately 15 square kilometers.
[0031] Raw data: A total of 2800 raw aerial images were acquired (1500 visible light images and 1300 infrared images). After POS data-assisted stitching and orthorectification, 2000 visible light and infrared orthophotos (GeoTIFF format) suitable for target detection were obtained (approximately 1000 visible light images and 1000 infrared images). The size of a single image is [not specified]. Pixel (visible light) or Pixel (infrared).
[0032] 1.2 Illumination-adaptive enhancement processing.
[0033] To address common issues in UAV imagery such as low contrast, uneven lighting, day-night imaging differences, and visual degradation during dawn, dusk, or foggy weather, all original orthophotos (including visible and infrared images) are input into a self-designed illumination adaptive enhancement network for processing.
[0034] Network architecture details: This network adopts an encoder-decoder structure, specifically constructed as follows: Encoder: Contains four downsampling stages, each stage consisting of two consecutive... It consists of convolutional layers, batch normalization layers (Batch Norm), and SiLU activation functions, and uses convolution with a stride of 2 for downsampling to gradually extract and compress features.
[0035] The decoder consists of four upsampling stages. Each stage first upsamples the feature map by a factor of 2 using bilinear interpolation, then concatenates the feature maps passed from the corresponding encoder stage via skip connections. Finally, it passes the feature maps through two... Convolutional layers perform feature fusion to gradually restore spatial details.
[0036] Output layer: The network ends with a single... The convolutional layer has 3 output channels (RGB three channels for visible light images, and single-channel pseudo-color or repeated three channels for infrared images), and uses the Sigmoid activation function to map pixel values to the range [0, 1], outputting the enhanced image.
[0037] The number of feature map channels in each stage of the encoder are 64, 128, 256, and 512, respectively. Before skip connections, the encoder features are first processed by a... Convolution adjusts the number of channels to match the feature dimensions of the decoder.
[0038] Loss function and training details: 500 well-lit and clear visible light images and 500 infrared images with good contrast were manually selected from the original data as "real and clear image" pairs.
[0039] Composite loss weighting coefficient , , Set them to 1.0, 0.1, and 0.05 respectively.
[0040] The network's training objective function is a composite loss. The calculation formula is as follows: ; ; ; This loss function is applicable to augmentation training for both visible light and infrared images. For infrared images, The project is based on feature maps extracted by a VGG16 network pre-trained on a large natural image dataset. This network is a feature extractor pre-trained on the public general dataset ImageNet, which is also capable of perceiving edge and structural information of thermal radiation images. The dark channel prior constraint in the term helps to suppress background noise caused by atmospheric thermal radiation homogenization in infrared images and enhance the thermal contrast between the target and the background.
[0041] in, For multi-scale structural similarity loss, The perceptual loss is based on feature maps extracted from a pre-trained VGG16 network. For physical model constraint loss, , , These are the weighting coefficients for each loss term. For true and clear images, Output images to the network. and The first Brightness comparison and contrast-structure comparison at different scales. For the total number of scales, , These are the weighting coefficients. For the VGG16 network Feature extraction function for a selected layer , , The first The number of channels, height, and width of the layer feature map. This represents the dark channel prior operation, used to constrain the output image. The dark channel value is set close to 0 to simulate the physical properties of a clear, fog-free image.
[0042] Using the Adam optimizer, with a learning rate of 1×10⁻⁶. -4 Batch size 8, training for 100 epochs. After every 20 epochs, evaluate the SSIM metric on the validation set; if there is no improvement for 5 consecutive epochs, the learning rate is halved.
[0043] 1.3 Data annotation and dataset construction.
[0044] The open-source annotation tool LabelImg was used to perform fine-grained annotations on 2000 enhanced images (including visible light and infrared images).
[0045] Labeling Specifications: Bounding Box: A tight bounding box that selects all visible, complete individuals of the red deer in the image. For partially occluded targets, the bounding box is reasonably estimated based on the visible parts (such as the head and shoulders). In infrared images, the bounding box is selected based on the target's thermal profile.
[0046] Biological attribute label: presence of horns: binary classification, determined by observing head features ("Horns" includes individuals with complete horns or horn stumps). In infrared images, the judgment is mainly based on the protruding morphology of the head's thermal profile combined with other knowledge.
[0047] Size classification: three categories ("small", "medium", "large"), based on the average size of the red deer population in the area, combined with the relative proportion of the individual to known surrounding features (such as shrubs approximately 1.5 meters tall). In infrared images, estimation is based on the relative area and outline of the hotspot.
[0048] Relative age groups are categorized into three groups ("juvenile", "sub-adult", and "adult"), determined by a combination of body size, body proportions (such as head-to-body ratio), presence or absence of horns, and developmental status. In infrared images, the size classification information is primarily used for auxiliary inference.
[0049] Annotation Results and Quality Control: Graduate students with wildlife biology backgrounds independently completed the annotations. Inconsistent annotations were discussed and standards were unified. Ultimately, approximately 7,000 red deer individuals were annotated across 2,000 enhanced images (approximately 1,000 visible light images and 1,000 infrared images). The average number of target instances per image was 3-4, consistent with the actual target distribution in large-scale drone aerial monitoring scenarios. A random sample of 10% of the annotations was reviewed by senior animal ecology experts, confirming an overall annotation accuracy rate >98%.
[0050] 2. Target detection model construction.
[0051] 2.1 Improved YOLOv8 network structure design.
[0052] Based on Ultralytics YOLOv8n (nano version), targeted improvements were made to construct a lightweight, high-performance model suitable for all-weather deer detection. The overall network structure includes a backbone network, a neck network, and a head network connected in sequence. The specific design and connection relationship are as follows: (1) Backbone network structure.
[0053] The backbone network is responsible for extracting multi-scale features from the input image. The specific module order is as follows: Input layer: receives... Preprocessed and enhanced images.
[0054] The first CBS module contains convolution (Conv), batch normalization (Batch Norm), and SiLU activation functions.
[0055] The second CBS module further extracts shallow features.
[0056] First Module: Contains 3 Basic unit, enhancing feature reuse and information flow.
[0057] The third CBS module performs downsampling and feature transformation.
[0058] First Modules: Contains 6 Basic units are used to extract mid-to-high-level semantic features.
[0059] Fourth CBS module: Downsample again to expand the receptive field.
[0060] second Module: Further refine feature representation.
[0061] The fifth CBS module: prepares features for subsequent modules.
[0062] second Module: Performs feature refinement.
[0063] SPPF Module: A fast version of spatial pyramid pooling, integrating multi-scale contextual information.
[0064] The first GAM+CBAM fusion attention mechanism module performs channel and spatial attention weighting on the deepest features output by the backbone network to enhance the expression of key features. Its output is simultaneously fed into the neck network and the large-scale target detection head.
[0065] (2) Neck network structure.
[0066] The neck network employs an improved multi-path feature pyramid network (FPN+PAN) structure to achieve multi-scale feature fusion, specifically including three feature fusion paths: the first feature fusion path (corresponding to the large-scale feature flow) includes: the third... Module → First Upsampling Module (2x) → First Concatenation Module (concatenated with corresponding layer features from the backbone network) → Sixth CBS Module → Fourth Module → Second GAM+CBAM fusion attention mechanism module. The output features of this path are used for the small target detection head.
[0067] The second feature fusion path (corresponding to the mesoscale feature flow) includes, in sequence: the second upsampling module (2x) → the second concatenation module (concatenated with the main mid-layer features) → the seventh CBS module → the fifth Module → Third GAM+CBAM fusion attention mechanism module. The output features of this path are used for small-scale target detection heads.
[0068] The third feature fusion path (corresponding to the small-scale feature flow) includes, in sequence: the eighth CBS module → the third splicing module (sponging with the shallow features of the backbone) → the sixth Module → Fourth GAM+CBAM fusion attention mechanism module. The output features of this path are used for the mesoscale target detection head.
[0069] (3) Detection head structure.
[0070] The detection head contains four independent detection modules, each responsible for predicting targets at different scales: Small target detection head: Processing... Feature map, detection pixel area is smaller than The smallest of goals.
[0071] Small-scale target detection head: processing Feature map.
[0072] Mesoscale target detection head: processing Feature map.
[0073] Large-scale target detection head: processing Feature maps are used to detect large, obvious targets in an image.
[0074] (4) Attention module connection mechanism.
[0075] The output of the first GAM+CBAM module is simultaneously connected to the third neck network. The module and large-scale object detection head enable the deepest semantic information to directly guide large-scale detection and participate in feature fusion.
[0076] The output of the second GAM+CBAM module is connected to the micro-target detection head to enhance the discriminative features of micro-targets.
[0077] The output of the third GAM+CBAM module is connected to the small-scale target detection head.
[0078] The output of the fourth GAM+CBAM module is connected to the mesoscale target detection head.
[0079] This design ensures that features of different scales undergo targeted attention before being fed into the detection head, effectively suppressing background noise and improving the feature response of the target area.
[0080] (5) Predictive branch inside the detection head.
[0081] Each detection head contains three parallel basic prediction branches: Bounding box regression branch: the output dimension is 4, corresponding to the coordinates of the center point of the bounding box. ,width and height .
[0082] Confidence prediction branch: The output dimension is 1, predicting the confidence that a target exists within the bounding box.
[0083] Category probability prediction branch: The output dimension is 1, predicting the probability that the target belongs to the category of red deer (this task is a binary classification: red deer vs. background).
[0084] Furthermore, to simultaneously achieve fine-grained attribute recognition, an additional attribute prediction sub-branch is integrated into the micro, small-scale, and medium-scale detection heads. Its specific structure is as follows: global average pooling (GAP) is performed on the feature map input to the detection head to obtain a... eigenvectors, Indicates dimension.
[0085] The vector is fed into a subnetwork containing two fully connected (FC) layers: the first FC layer reduces the feature dimension to... And use the ReLU activation function.
[0086] The second fully connected layer restores the dimensions to match the attribute label dimensions.
[0087] The output layer uses different activation functions depending on the specific attribute task: for "whether there is a corner" (binary classification), the Sigmoid activation function is used to output a single probability value.
[0088] For "body size class" and "relative age group" (both are three-class categories), the Softmax activation function is used to output the probability distribution of the three categories.
[0089] (6) Details of neck network connection.
[0090] To ensure the clarity of the feature flow, the connection relationships of each module in the neck network are as follows: Third The input of the module is connected to the output of the first GAM+CBAM fusion attention mechanism module.
[0091] third The output of the module is connected to the input of both the first upsampling module and the second upsampling module.
[0092] The output of the first upsampling module is connected to the first input of the first splicing module, and the second... The output of the module is connected to the second input of the first splicing module.
[0093] The output of the first splicing module is connected sequentially to the sixth CBS module and the fourth CBS module. Module.
[0094] fourth The output of the module is connected to the input of the second GAM+CBAM fusion attention mechanism module.
[0095] The output of the second upsampling module is connected to the first input of the second splicing module. The output of the module is connected to the second input of the second splicing module.
[0096] The output of the second splicing module is connected sequentially to the seventh CBS module and the fifth CBS module. Module.
[0097] fifth The output of the module is connected to the input of the third GAM+CBAM fusion attention mechanism module.
[0098] fifth The module's output is also connected to the input of the eighth CBS module.
[0099] The output of the eighth CBS module is connected to the first input of the third splicing module. The output of the module is connected to the second input of the third splicing module.
[0100] The output of the third splicing module is connected sequentially to the sixth... The module and the fourth GAM+CBAM fusion attention mechanism module.
[0101] 2.2 Model connection topology.
[0102] The specific data flow of the network is as follows: Input image ( Features are extracted from the backbone network, processed by SPPF, and then processed by the first GAM+CBAM module to output features. .
[0103] On the one hand, directly input large-scale target detection head ( (Scale), on the other hand, it enters the neck network.
[0104] In the neck network, After a After the module, sampling is split into two paths. One path is fused with the mid-layer features of the main backbone, processed, and then focused by the second GAM+CBAM module before being output to the micro-target detection head. (Scale). Another path continues to fuse with shallower features, and is ultimately focused by the third and fourth GAM+CBAM modules respectively, outputting to the small- and medium-scale target detection heads (scale). and scale).
[0105] 3. Model training.
[0106] 3.1 Training environment and configuration.
[0107] Hardware: Single NVIDIA GeForce RTX 4090 graphics card (24GB VRAM), Intel Core i9-13900K processor, 64GB DDR5 memory.
[0108] Software: Ubuntu 22.04 LTS operating system, Python 3.9, PyTorch 2.0.0, CUDA 11.8.
[0109] 3.2 Training strategies and hyperparameters.
[0110] Optimizer: SGD with Nesterov Momentum was used, with momentum set to 0.937 and weight decay to 5e-4.
[0111] Learning rate scheduling: A cosine annealing strategy is employed. The initial learning rate is set to 0.01, with a 3-epoch warm-up period to linearly increase the learning rate from 0.0 to 0.01. Subsequently, over 300 total epochs, the learning rate decreases according to a cosine function until the final learning rate of 0.001 is reached.
[0112] Batch size: Set to 16.
[0113] Data augmentation: Mosaic enhancement (first 150 epochs), random horizontal flipping (probability 0.5), random brightness / contrast / saturation adjustment (±30%) for visible light images, random thermal contrast adjustment and slight thermal noise simulation, random scaling (0.5-1.5x), and random cropping for infrared images are used to improve the model's generalization ability to different imaging conditions and modal differences between day and night.
[0114] Early Stopping: Monitor the validation set mAP@0.5. If there is no improvement after 30 consecutive epochs, terminate training and restore the model weights with the best validation set metrics.
[0115] 3.3 Composite Loss Function.
[0116] The total loss function for model training is defined as the weighted sum of the detection loss and the attribute prediction loss: ; ; ; ;in, For bounding box regression loss, For intersection, union, and comparison, To predict the Euclidean distance between the center point of the bounding box and the center point of the ground truth bounding box, To cover the diagonal distance of the minimum closed area of the two frames, For the weight function, As a measure of aspect ratio consistency, For the predicted bounding box parameters, For the parameters of the true bounding box, For category classification loss, For the sample size, For sample index, For real-world labeling, deer is 1, background is 0. The probability that the model predicts the animal to be a red deer. Loss for attribute prediction, To determine whether there is a binary cross-entropy loss with angular attributes, The cross-entropy loss is the size-level attribute. The cross-entropy loss is relative to the age group attribute. , , The weights for the loss of each attribute are set to 1.0, 0.8, and 0.8, respectively. The coefficient for balancing the weights between attribute prediction loss and detection loss is set to 0.5.
[0117] 4. Results and Analysis.
[0118] 4.1 Evaluation Indicators.
[0119] The model performance was evaluated on an independent test set, with key metrics including: Detection performance: Average Precision (AP) and its mean (mAP). The AP at an IoU threshold of 0.5 (AP@0.5) and the average AP (AP@0.5:0.95) were calculated for IoU thresholds ranging from 0.5 to 0.95 with a step size of 0.05. Precision and recall were also reported.
[0120] Attribute prediction performance: For each attribute, calculate its classification accuracy.
[0121] 4.2 Quantitative experimental results.
[0122] To verify the effectiveness of the complete model of this invention, it was compared with the baseline model on the same mixed modal test set, as well as on separate 'daytime visible light subset' and 'nighttime infrared subset'.
[0123] As shown in Table 1, the complete model of this invention achieved the best performance on the full test set, with an mAP@0.5 of 0.928, representing a 6.4 percentage point improvement over the baseline model trained only with visible light data and a 4.8 percentage point improvement over the baseline model trained with mixed data but without structural improvements. This demonstrates that the network structure improvements proposed in this invention (four-scale detector head, GAM+CBAM attention fusion, and attribute prediction branch) have significant advantages in effectively fusing and utilizing multimodal data. Furthermore, the model shows a more significant improvement on the more stringent mAP@0.5:0.95 metric, indicating higher localization accuracy of its predicted bounding boxes. The number of parameters increased by only 21.9%, maintaining good lightweight characteristics.
[0124] Table 1 Performance Comparison (Full Test Set)
[0125] As shown in Table 2, the model of this invention exhibits excellent performance in daytime visible light scenarios (mAP@0.5=0.925), indicating that its daytime performance was not sacrificed due to the introduction of infrared data and the handling of nighttime tasks. In nighttime infrared scenarios, the performance of this invention (mAP@0.5=0.802) far exceeds that of the model trained only with visible light and is significantly better than the baseline model trained only with mixed data but without improving the network structure (0.802 vs. 0.635). This strongly demonstrates that: 1) mixed modality training is the foundation for obtaining nighttime recognition capabilities; 2) the network structure improvement of this invention can more fully mine the discriminative features in infrared data, improving nighttime detection performance by 26.3% and effectively solving the problem of high false negative rates at night.
[0126] Table 2 Performance Comparison by Scenario
[0127] As shown in Table 3, the model of this invention performs exceptionally well in small target detection, with mAP@0.5 improved by 29.4% and recall rate improved by 20.7% compared to the baseline model. This verifies the effectiveness of the newly added small target detection head and the attention module deployed on the shallow feature path. Working together, they enhance the ability to extract and focus on image details and small hotspot features, alleviating the problem of missed detection of small deer targets in UAV imagery, especially in infrared imagery with limited resolution.
[0128] Table 3. Small target detection performance (full test set)
[0129] As shown in Table 4, the model demonstrated good performance in predicting all three biological attributes. Overall, the accuracy rate for "whether there are horns" was the highest (94.2%), due to the distinct morphological features of this characteristic. Predicting "body size class" and "relative age group" was more challenging. Looking at different scenarios, the accuracy rate for all attributes was higher under daytime visible light than under nighttime infrared light, which is intuitive, as visible light provides richer texture and morphological details. However, the key value lies in the fact that even at night when only thermal radiation information is available, the model still maintains a high accuracy rate for attribute inference (e.g., 89.8% for "whether there are horns"). This demonstrates that the attribute prediction sub-branch has successfully learned cross-modal, biologically relevant deep semantic features, greatly expanding the information dimension of nighttime monitoring.
[0130] Table 4. Prediction accuracy of biological attributes (full test set)
[0131] 4.3 Ablation Experiment Analysis.
[0132] To clarify the specific contribution of each improved module in this invention to the final performance, a systematic ablation study was designed and conducted. All experiments used the exact same dataset partitioning, training strategy, and evaluation criteria to ensure fair comparability of results. The following modules were added sequentially to the baseline model, and performance changes were observed: Experiment A (baseline): Original YOLOv8n model, trained using only visible light data.
[0133] Experiment B: Based on Experiment A, an illumination-adaptive enhancement network is added to preprocess the input image (visible light only).
[0134] Experiment C: Based on Experiment B, training was performed using mixed-modal (visible light + infrared) data, with the model structure remaining unchanged.
[0135] Experiment D: Based on Experiment C, the detection head of the model is expanded from three scales to four scales.
[0136] Experiment E: Based on Experiment D, insert a GAM+CBAM fusion attention mechanism module into the network.
[0137] Experiment F (Complete Model): Based on Experiment E, attribute prediction sub-branches are integrated into micro, small, and medium-scale detection heads.
[0138] As shown in Table 5, the ablation experiments systematically verified the effectiveness of each improved module. Experiment C (introducing mixed-modality data training) was the turning point for this scheme to achieve "all-weather" capability, with a significant performance improvement. Subsequent improvements (D, E, F) built upon this foundation, successively optimizing the detection scale, introducing an attention mechanism, and adding an attribute recognition task, continuously and steadily improving the overall performance of the model. Finally, the complete model (F) integrated all improvements and achieved optimal performance. The entire ablation chain demonstrates that all components of this invention work together, are indispensable, and ultimately synergistically achieve high-precision all-weather deer detection and attribute recognition.
[0139] Table 5 Ablation Experiment Results (Full Test Set)
[0140] Example 2: A red deer identification and detection system, comprising: an image acquisition module for acquiring daytime and nighttime orthophotos of the red deer's activity area using a visible light and infrared dual-light sensor mounted on a drone; an image enhancement module connected to the image acquisition module, which incorporates an illumination-adaptive enhancement network to perform illumination-adaptive enhancement processing on the received orthophotos to obtain enhanced images; and a data management module connected to the image enhancement module for labeling the enhanced images, outlining the red deer target, and recording biological attribute labels including whether it has antlers, its size class, and relative age group, forming a dataset and dividing it into a training set and a validation set. The module consists of a test set and a model building and training module, connected to the data management module, used to build an improved YOLOv8 deep learning model and train it on the training set. The model inserts an attention mechanism module that fuses GAM and CBAM into the multi-scale feature fusion path between the feature fusion network and the detection head, as well as within the detection head. It includes four detection heads of different scales and uses biological attribute labels to calculate auxiliary loss during training. The detection evaluation module, connected to the model building and training module, is used to evaluate the performance of the trained model using the test set. The central control module is used to coordinate the data transmission and processing flow between the above modules.
[0141] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0142] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-including system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.
[0143] More specific examples of computer-readable media (a non-exhaustive list) include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.
[0144] It is worth noting that all contents not described in detail in this invention are existing technologies and are well known to those skilled in the art.
[0145] Therefore, the present invention employs the above-mentioned method, system, device and medium for red deer identification and detection. By integrating multimodal (visible light / infrared) image data, illumination adaptive enhancement, an improved multi-scale detection network structure adapted to all weather conditions, a deep fusion attention mechanism and parallel biological attribute prediction, the accuracy, robustness and information richness of red deer detection in complex all-weather scenarios are significantly improved.
[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the technical solutions of the present invention, and these modifications or equivalent substitutions cannot cause the modified technical solutions to deviate from the spirit and scope of the technical solutions of the present invention.
Claims
1. A method for identifying and detecting red deer, characterized in that, Includes the following steps: Step S1: Using a visible light and infrared dual-light sensor mounted on a drone, collect daytime and nighttime orthophotos of the red deer's activity area. Input the orthophotos into an illumination-adaptive enhancement network for processing to obtain enhanced images. Step S2: Annotate the enhanced images, outlining the red deer targets and recording their biological attribute labels, including whether they have antlers, their size class, and their relative age group. After forming the dataset, divide it into training, validation, and test sets. Step S3: Construct and train an improved YOLOv8 deep learning model. This model takes the pre-processed enhanced images as input. The improvement lies in inserting an attention mechanism module that fuses GAM and CBAM between the model's feature fusion network and the detection head, as well as along the multi-scale feature fusion path within the detection head. The model includes four detection heads at different scales: a micro-target detection head, a small-scale target detection head, a medium-scale target detection head, and a large-scale target detection head. Train the constructed model using the training set, calculating the auxiliary loss using the biological attribute labels during training. Step S4: Evaluate the performance of the trained model using the test set.
2. The method for identifying and detecting a red deer according to claim 1, characterized in that, The specific construction and training method of the illumination adaptive enhancement network are as follows: The network encoder contains four downsampling stages, each consisting of two consecutive... The network consists of convolutional layers, batch normalization layers, and SiLU activation functions, and downsampling is performed using convolutions with a stride of 2. The network decoder contains four upsampling stages. Each stage first upsamples the feature map by a factor of 2 using bilinear interpolation, then concatenates the feature maps passed from the corresponding stage of the encoder through skip connections, and finally passes them through two... Convolutional layers perform feature fusion; the output layer of the illumination-adaptive enhancement network is a single layer. The convolutional layer has 3 output channels and uses the sigmoid activation function; the training objective function of the illumination adaptive augmentation network is a composite loss. The calculation formula is as follows: ; ; ; ;in, For multi-scale structural similarity loss, The perceptual loss is based on feature maps extracted from a pre-trained VGG16 network. For physical model constraint loss, 、 、 These are the weighting coefficients for each loss term. For true and clear images, The output image is for the illumination adaptive enhancement network. and The first Brightness comparison and contrast-structure comparison at different scales. For the total number of scales, 、 These are the weighting coefficients. For the VGG16 network Feature extraction function for a selected layer 、 、 The first The number of channels, height, and width of the layer feature map. This indicates a priori operation for the dark channel.
3. The method for identifying and detecting a red deer according to claim 1, characterized in that, The improved YOLOv8 deep learning model has a network structure consisting of a backbone network, a neck network, and a detection head connected in sequence. The specific structure is as follows: The backbone network sequentially includes: an input layer, a first CBS module, a second CBS module, and a first... Module, Third CBS Module, First Module, Fourth CBS Module, Second Module, Fifth CBS Module, Second The neck network comprises a module, an SPPF module, and a first GAM+CBAM fusion attention mechanism module; the neck network contains three feature fusion paths: the first feature fusion path sequentially includes: the third Module, First Upsampling Module, First Stitching Module, Sixth CBS Module, Fourth The module includes a second GAM+CBAM fusion attention mechanism module; the second feature fusion path sequentially includes: a second upsampling module, a second stitching module, a seventh CBS module, and a fifth... The module and the third GAM+CBAM fusion attention mechanism module; the third feature fusion path includes, in sequence: the eighth CBS module, the third splicing module, and the sixth The module and the fourth GAM+CBAM fusion attention mechanism module; The detection head comprises four detection modules: a micro-target detection head, a small-scale target detection head, a medium-scale target detection head, and a large-scale target detection head; the output of the first GAM+CBAM fusion attention mechanism module is simultaneously connected to the third... The module consists of a large-scale target detection head and a small-scale target detection head. The output of the second GAM+CBAM fusion attention mechanism module is connected to the micro-target detection head. The output of the third GAM+CBAM fusion attention mechanism module is connected to the small-scale target detection head. The output of the fourth GAM+CBAM fusion attention mechanism module is connected to the medium-scale target detection head.
4. The method for identifying and detecting a red deer according to claim 3, characterized in that, The internal structure of each of the four detection heads contains the following three parallel prediction branches: a bounding box regression branch, which predicts the bounding box coordinates of the target, with an output dimension of 4, corresponding to the center point coordinates of the bounding box. ,width and height The confidence prediction branch is used to predict the confidence of the presence of a target within the bounding box, with an output dimension of 1; the category probability prediction branch is used to predict the probability that the target belongs to the red deer category, with an output dimension of 1; among them, the micro-target detection head, small-scale target detection head, and medium-scale target detection head, in addition to the three basic branches, also include an attribute prediction sub-branch, which is used to predict biological attribute labels based on input features.
5. The method for identifying and detecting a red deer according to claim 4, characterized in that, The specific structure of the attribute prediction sub-branch is as follows: global average pooling is performed on the input feature map to obtain a feature vector; the feature vector is input into a sub-network containing two fully connected layers; the first fully connected layer reduces the feature dimension to 1 / 4 of the input dimension, and the second fully connected layer restores the dimension; depending on the specific task, the output layer uses the Sigmoid activation function to output the probability of whether there are angles, or uses the Softmax activation function to output the classification probability distribution of body size level and relative age group.
6. The method for identifying and detecting a red deer according to claim 3, characterized in that, The connection relationships of each module in the neck network are as follows: Third The input of the module is connected to the output of the first GAM+CBAM fusion attention mechanism module; third The output of the module is connected to the input of both the first upsampling module and the second upsampling module; the output of the first upsampling module is connected to the first input of the first splicing module, and the second... The output of the module is connected to the second input of the first splicing module; the output of the first splicing module is connected in sequence to the sixth CBS module and the fourth CBS module. Module; fourth The output of the first module is connected to the input of the second GAM+CBAM fusion attention mechanism module; the output of the second upsampling module is connected to the first input of the second stitching module. The output of the module is connected to the second input of the second splicing module; the output of the second splicing module is connected in sequence to the seventh CBS module and the fifth CBS module. Module; fifth The output of the module is connected to the input of the third GAM+CBAM fusion attention mechanism module; the fifth The output of the module is also connected to the input of the eighth CBS module; the output of the eighth CBS module is connected to the first input of the third splicing module. The output of module A is connected to the second input of the third splicing module; the output of the third splicing module is connected in sequence to the sixth... The module and the fourth GAM+CBAM fusion attention mechanism module.
7. The method for identifying and detecting a red deer according to claim 1, characterized in that, Total loss function of model training for: ; ; ; ;in, For bounding box regression loss, For intersection, union, and comparison, To predict the Euclidean distance between the center point of the bounding box and the center point of the ground truth bounding box, To cover the diagonal distance of the minimum closed area of the two frames, For the weight function, As a measure of aspect ratio consistency, For the parameters of the prediction box, For the parameters of the true bounding box, For category classification loss, For the sample size, For sample index, For real-world labeling, deer is 1, background is 0. The probability that the model predicts the animal to be a red deer. Loss for attribute prediction To determine whether there is a binary cross-entropy loss with angular attributes, The cross-entropy loss is the size-level attribute. The cross-entropy loss is relative to the age group attribute. 、 、 The weights for the loss of each attribute, The coefficient used to balance the weights between attribute prediction loss and detection loss.
8. A red deer identification and detection system, characterized in that, include: The image acquisition module is used to acquire daytime and nighttime orthophotos of the red deer's activity area using a dual-light sensor of visible light and infrared light carried by the drone. The image enhancement module, connected to the image acquisition module, has a built-in illumination adaptive enhancement network for performing illumination adaptive enhancement processing on the received orthophoto to obtain an enhanced image; The data management module, connected to the image enhancement module, is used to annotate the enhanced images, outline the red deer target, and record biological attribute labels including whether it has antlers, size level, and relative age group, forming a dataset and dividing it into training set, validation set, and test set; The model building and training module, connected to the data management module, is used to build an improved YOLOv8 deep learning model and train it with the training set. The model inserts an attention mechanism module that fuses GAM and CBAM into the multi-scale feature fusion path between the feature fusion network and the detection head, as well as within the detection head. It contains four detection heads of different scales and uses biological attribute labels to calculate auxiliary loss during training. The detection evaluation module, connected to the model building and training module, is used to evaluate the performance of the trained model using the test set. The central control module is used to coordinate the data transmission and processing flow between the above modules.
9. A computer device, comprising: Memory and processor; The memory stores a computer program, characterized in that when the processor executes the computer program, it implements the steps of the deer identification and detection method according to any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When a computer program is executed by a processor, it implements the steps of a deer identification and detection method according to any one of claims 1-7.
Citation Information
Patent Citations
Wild animal detection method fusing unmanned aerial vehicle thermal infrared image and visible light image
CN121305621A