Semi-supervised target detection method for identifying wild animal species by infrared trigger camera
By generating high-quality pseudo-labels through a teacher-student dual network structure and augmentation strategy, and combining the CIoU loss function and hard example mining mechanism, the problems of false triggering and high labeling costs in infrared trigger cameras are solved, and efficient and stable wildlife species identification is achieved.
Patent Information
- Application Number
- CN202511481195.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-16
- Publication Date
- 2026-01-20
AI Technical Summary
Existing infrared trigger cameras in wildlife monitoring result in a large amount of invalid information due to false triggering. Manual annotation is costly, and semi-supervised target detection methods suffer from problems such as gradient explosion, large false label noise, model underfitting, and unstable training.
A teacher-student dual-network structure is adopted. High-quality pseudo-labels are generated through weak/strong augmented dual views, supervised hot start and transfer learning. The label sample set is optimized by combining CIoU loss function and hard example mining mechanism to perform semi-supervised object detection.
It significantly reduces the cost of manual annotation, improves the quality of pseudo-labels and training stability, enhances the model's discrimination and localization capabilities, accelerates convergence speed, and achieves high-precision identification of wild animal species.
Smart Images

Figure CN121366426A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the field of wild animal monitoring and species identification, and particularly relates to a semi-supervised target detection method for wild animal species identification of infrared trigger cameras. BACKGROUND
[0002] Infrared trigger cameras are widely used in wild animal ecological monitoring due to their low power consumption, strong day and night imaging capability and flexible deployment. However, long-term operation will collect a large amount of image data, about 70% of which is invalid information caused by natural factors such as wind blowing, light changes or rain and snow weather. Artificial screening and labeling not only consumes time and effort, but also is costly. Existing species identification methods based on deep learning have to some extent promoted the process of automatic identification, but generally rely on a large number of high-quality artificial labeled samples. In the wild animal monitoring scene, the labeled data is scarce, the cost of acquisition is high, and the cycle is long, which limits the continuous improvement of model performance and its popularization in practical application. To solve the above problems, some studies propose to use the semi-supervised target detection method Soft Teacher to reduce the dependence on artificial labeling by constructing a teacher-student dual network structure and using the teacher model to generate pseudo-labels for unlabeled samples. However, this method still has obvious shortcomings in practical application: The model lacks a warm-up process, is prone to gradient explosion, and is under-fitted and unstable in training due to excessive noise of early pseudo-labels; The teacher model prediction result is unreliable, generating a large number of false positive samples, causing the student model to have a sharp decline in performance in training. In view of the above, a semi-supervised target detection method for wild animal species identification of infrared trigger cameras is proposed. SUMMARY
[0003] Therefore, the application aims to provide a semi-supervised target detection method for wild animal species identification of infrared trigger cameras to solve the problems of lack of warm-up process in the model, prone to gradient explosion, under-fitting and unstable training due to excessive noise of early pseudo-labels, and unreliable teacher model prediction result, generating a large number of false positive samples, causing the student model to have a sharp decline in performance in training.
[0004] To achieve the above purpose, the application adopts the following technical solution: a semi-supervised target detection method for wild animal species identification of infrared trigger cameras, comprising the following steps: S1, constructing a training set, dividing image and video data into a labeled sample set (1a) and an unlabeled sample set (1b); S2, a teacher-student dual network model is constructed, including a teacher model (2a) and a student model (2b), and a weak / strong augmented dual view is performed on the labeled sample set (1a) and the unlabeled sample set (1b); S3, supervised warm-up training is performed on the labeled sample set (1a), and the obtained detector weight is migrated to the teacher model (2a) and the student model (2b) as the initialization parameter of the semi-supervised target detector; S4, the student model (2b) weight is copied as the teacher model (2a) weight, and the teacher model is updated in an exponential moving average manner; S5, the teacher model (2a) performs inference on the unlabeled sample set (1b), generates and screens pseudo-labeled samples available for the student model (2b) to learn; S6, the labeled sample set (1a) is optimized, a difficult example mining mechanism is introduced, the model is preferentially trained on samples with high difficulty, and in the boundary box regression process, a CIoU loss function is used to jointly constrain the overlap, center point distance and width-height ratio between the target box and the real box; S8, joint training, the pseudo-labeled samples in S5 and the labeled sample set (1a) optimized in S6 are jointly input into the student model (2b) for joint training, so as to improve the high precision and strong robustness of the detector in a complex environment; S9, iteratively execute S4-S8 until the convergence condition is met, and output the final model.
[0005] Further, the labeled sample set (1a) and the unlabeled sample set (1b) both contain species categories and boundary box information.
[0006] Further, the labeled sample set (1a) is an equalized labeled data subset constituted by extracting min(3000, Nc) for each species c; the rest of the data is the unlabeled sample set (1b).
[0007] Further, the teacher model (2a) and the student model (2b) use the same benchmark detector, including a feature extraction network, a feature fusion network, a region candidate network, a RoIAlign layer and a detection head, the feature fusion network fuses multi-scale features, the region candidate network generates candidate regions to provide potential target positions, the RoIAlign layer accurately aligns the candidate regions and the feature map, and the detection head is composed of a classification branch (2c) and a boundary box regression branch (2d), which are respectively used for class prediction and position regression.
[0008] Further, the weak / strong augmented dual-view includes label data augmentation and unlabeled data augmentation. The label data augmentation randomly scales, flips and color-disturbs the images of the label sample set (1a); the unlabeled data augmentation includes teacher view weak augmentation and student view strong augmentation. The teacher view weak augmentation includes random scaling, flipping and TTA; the student view strong augmentation, in the processing mode of label data augmentation, adds random erasing and random geometric disturbance.
[0009] Further, the TTA includes: The same image generates three sets of scaled views, taking 1333x400, 1333x800 and 1333x1200; At each scale, two types of views are generated respectively, "flipped" and "not flipped"; The teacher model independently reasons each view and matches and fuses at the result level; By counting the consistency of the candidate box under multiple views, the stability score is calculated, and only the candidate box with a stability higher than 0.85 is kept as the pseudo-label input to the student model (2b).
[0010] Further, the pseudo-label sample generation process is as follows: S51, input processing, the unlabeled sample set (1b) is input to the teacher model (2a), and the candidate box and class prediction result are obtained after reasoning; S52, pseudo-label generation, based on the class probability and boundary box coordinates in the prediction result, the high-confidence detection result is selected as the pseudo-label; S53, pseudo-label screening, by setting a confidence threshold and consistency discrimination conditions, low-quality predictions are removed to ensure the reliability of the pseudo-label; S54, pseudo-label mapping: the screened pseudo-label is passed to the student model for consistency learning in the joint training stage.
[0011] Further, the joint training includes loss function design, the process of which is as follows: S81, in each iteration, a part of labeled data and unlabeled data are sampled simultaneously, the ratio is 1:4 in the semi-supervised partial experiment and 1:1 in the full experiment; S82, the student model receives two types of input and calculates the supervised loss and unsupervised loss respectively; S83, the total loss is used to update the student model parameters S84, the teacher model parameters are updated by the exponential moving average method to update the teacher model mechanism.
[0012] Further, the loss function design formula is as follows: L total=L sup +λ u · L unsup wherein: λ u is an unsupervised loss weight, in the proportion experiment λ u is 4, in the full experiment λ u is 2; L total is a total loss; L unsup is an unsupervised loss: L sup is a supervised loss.
[0013] Further, the supervised loss is composed of a classification loss based on label data and a CIoU bounding box regression loss, and combined with an OHEM strategy to select difficult examples, and the unsupervised loss is based on a classification consistency loss and a bounding box regression loss based on unlabeled data, and the loss is the same as the original Faster RCNN.
[0014] Beneficial effects: 1. Significantly reduce the cost of manual annotation, the present application adopts a semi-supervised learning framework Soft teacher, makes full use of large-scale unlabeled samples, and guides the student model training through the pseudo-label generated by the teacher model. Only a small amount of labeled data can support the training of a high-precision detection model, significantly reducing the dependence on large-scale manual labeling, thereby reducing the labeling cost and time overhead.
[0015] Improve the quality of pseudo-labels and training stability, the present application introduces a hot start and transfer learning mechanism in the teacher model, so that it has stable recognition and regression ability before the semi-supervised stage starts, thereby ensuring the reliability of the pseudo-labels. Combined with TTA stability calculation and threshold screening, low-stability pseudo-labels are effectively filtered, noise interference is reduced, and the stability and convergence efficiency of the training are improved.
[0016] Enhance the discrimination and positioning ability of the model, in the semi-supervised training, the present application introduces an online difficult example mining strategy in the label data branch, ensures that the model focuses on learning high-loss samples, and improves the discrimination ability for boundary ambiguous and class similar samples. At the same time, a CIoU loss function is used to consider the overlap, center distance and aspect ratio in the bounding box regression process, so that the detection frame is closer to the real target, and the detection accuracy is significantly improved.
[0017] The convergence speed is accelerated and the overall performance is improved, the gradient explosion and underfitting under the cold start condition are effectively avoided through the supervised hot start and semi-supervised weight initialization, the semi-supervised detector can quickly enter a stable state at the initial training stage, and the overall convergence speed of the model is accelerated. Experimental results show that the method can still achieve a performance level close to that of full-supervised training under limited label conditions, and the overall precision is further improved after a large amount of unlabeled data is added.
[0018] The final model output by the application is compatible with local, edge and cloud deployment modes, and can be adapted to various application scenarios such as scientific research analysis, real-time early warning in nature reserves and cross-region multi-camera cooperative monitoring. Through structured and visual output results, researchers can quickly search and use them. BRIEF DESCRIPTION OF DRAWINGS
[0019] The accompanying drawings, which form a part of the disclosure, serve to provide a further understanding of the application, and the illustrative embodiments thereof, its description and illustrations serve to explain the application and are not intended to limit the application unduly. In the drawings: Figure 1 It is the overall flow chart of the application; Figure 2 It is the data distribution graph of different species in the data of the application; Figure 3 It is the data distribution graph of different image resolutions in the data of the application; Figure 4 It is a schematic diagram of the data preparation module of the application; Figure 5 It is a schematic diagram of the teacher-student double network structure and the supervised hot start and semi-supervised weight initialization of the application; Figure 6 It is a structure diagram of the semi-supervised benchmark model Faster RCNN of the application; Figure 7 It is a schematic diagram of the weak / strong augmented double view mechanism and the teacher model inference and pseudo-label generation module of the application; Figure 8 It is a schematic diagram of the label optimization and loss constraint module of the application; Figure 9 It is an application schematic diagram of the model output and deployment module 8 of the application; Figure 10 It is a general setting diagram of the supervised training parameters of the application; Figure 11 It is a learning strategy diagram of the supervised training parameters of the application; Figure 12 It is a general setting diagram of the semi-supervised training parameters of the application; Figure 13 It is a learning strategy diagram of the semi-supervised training parameters of the application. Detailed Implementation
[0020] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of the present invention can be combined with each other, and the described embodiments are only some embodiments of the present invention, not all embodiments.
[0021] It should be noted that the descriptions of "left," "right," "left side," "right side," "upper part," "lower part," "top," and "bottom" in this invention are defined based on the orientation or positional relationships shown in the accompanying drawings. They are merely for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the described structure must be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0022] In the description of this invention, unless otherwise expressly specified and limited, the terms "installation," "connection," and "joining" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal communication between two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0023] Referring to the accompanying drawings, this embodiment provides a semi-supervised target detection method for wildlife species identification using infrared-triggered cameras; like Figure 1 As shown, the data sequentially passes through the data preparation module 1 (1a labeled sample set and 1b unlabeled sample set), the teacher-student dual network structure module 2 (2a teacher model and 2b student model), the supervised warm start and semi-supervised weight initialization module 3, the teacher inference and pseudo-label generation module 4, the label optimization and loss constraint module 5, the joint training module 6, the teacher model update module 7, and finally the model output and deployment module 8.
[0024] like Figure 2 and Figure 3 As shown, data preparation module 1 constructs a training set, dividing the image and video data into a labeled sample set (1a) and an unlabeled sample set (1b).
[0025] Data source: The data used in this embodiment are all from infrared trigger cameras deployed in multiple nature reserves in Shanxi Province, Heilongjiang Province, and Jilin Province; The data collection period spanned from 2012 to 2024, covering different seasons, climatic conditions, and diurnal light differences. Capture mode, hot infrared trigger is adopted, and the camera is automatically started when animal activity occurs in the monitoring area; Shooting strategy, most devices use "three shots per shot" mode, that is, three high-definition still images are generated in one trigger, and a video is recorded synchronously; 2. Data size: total number of labeled samples: 357,605 images, covering 26 species categories, including wild animals (leopard cat, red fox, northeast leopard, northeast tiger, northeast rabbit, badger, raccoon, black bear, flower-faced cat, yellow-throated marten, yellow weasel, red deer, sika deer, macaque, bird, roe deer, squirrel, wild boar, musk deer, pheasant, brown bear), people, cars, cows, sheep. The number of images in each category is shown in Figure 2 .
[0026] Image attributes: resolution, not fixed, covering multiple specifications such as 492x367 pixels to 7680x4320 pixels. Common resolutions and quantities are shown in Figure 3 , and the number of other specifications decreases in turn, showing a long-tailed distribution; Day and night ratio: both day and night images are taken, with about 30% of night images; Background complexity: image background is complex, including vegetation obstruction, rainy and snowy weather, water mist, strong light changes (direct sunlight, shadow changes, night infrared lighting, etc.), and animals partially leaving the field of view.
[0027] Annotation details: annotation method: "machine preliminary identification + manual review" and pure manual annotation are combined to ensure annotation quality. Annotation content: each labeled sample contains species category label and corresponding bounding box coordinate information.
[0028] As shown in Figure 4 , the data is divided: De-duplication and sampling: for each species c, extract min(3000, N c) to form an balanced label data subset, defined as label sample set (1a). The remaining data is defined as unlabeled sample set (1b).
[0029] Training set and validation set division: S 3000 is divided into Labeled train and Labeled valid , Valid fix with random seed 42, and is fixed.
[0030] Proportion experiment and full amount experiment data division: (1) The proportion experiment takes R={1%, 2%, 5%, 10%, 20%, 30%, 40%}. For each τ∈R, from Labeled trainA proportionally random sample (with a random number seed of 42) is used to create a labeled dataset, denoted as Labeled. train_τ The remaining data is treated as an unlabeled dataset and denoted as Labeled. train_u The evaluation is unified under Labeled valid The above will be carried out.
[0031] (2) The full-scale experiment used 100% Labeled train As labeled data, all samples from the unlabeled sample set (1b) are used as unlabeled data for training; the evaluation is performed on labeled data. valid conduct.
[0032] like Figures 5 to 7 As shown, the teacher-student dual network structure building module 2 is used to build a teacher-student dual network model, including a teacher model (2a) and a student model (2b), and to perform weak / strong augmented dual views on the labeled sample set (1a) and the unlabeled sample set (1b).
[0033] The benchmark detector, Faster R-CNN, is used in both the teacher model (2a) and the student model (2b). Its overall structure includes: Feature extraction network: ResNet-50 was used; Feature Fusion Network: Employing a Feature Pyramid Network (FPN) to achieve multi-scale feature fusion, thereby enhancing the detection capability for targets at different scales; Region Proposal Network (RPN): Generates candidate regions, providing potential target locations; RoIAlign layer: precisely aligns candidate regions with feature maps to avoid quantization errors; The detection head consists of a classification branch (2c) and a bounding box regression branch (2d), which are used for category prediction and location regression, respectively.
[0034] Model weight updates: Teacher model (2a): Always in inference state, does not participate in backpropagation. Its parameter updates are completed through the EMA (Exponential Moving Average) mechanism. Student model (2b): In normal training state, parameters are updated through backpropagation. During training, the student model continuously learns supervision information from labeled data and pseudo-labels, and its parameter EMA values are used to iteratively update the teacher model.
[0035] Data preprocessing: All input images undergo the following standardization operations before being fed into the model: Color space conversion: convert the original BGR channel to RGB channel; Mean / variance normalization: subtract the mean [123.675, 116.28, 103.53] and divide by the standard deviation [58.395, 57.12, 57.375] for each pixel by channel to achieve normalization processing. Size alignment: fill the image to meet the size constraints required by the network input, and the width and height of the filled image are both integer multiples of 32 (pad_size_divisor=32) to adapt to the hierarchical feature alignment requirements of the Feature Pyramid Network (FPN).
[0036] As shown in Figure 7 Weak / strong augmented dual-view and pseudo-label mapping; Label data augmentation: used when the student model processes label data, including the following operations: RandomResize with Multi-Scale Training: During training, randomly select a resolution within the pre-set multi-scale range (e.g. 1333x400 to 1333x1200) for input images to perform equal scaling. This strategy not only serves as data augmentation, but also enables multi-scale training, allowing the model to adapt to different target sizes and scenarios, improving the detection robustness of small and large targets.
[0037] RandomFlip: flip the image horizontally with a probability of 0.5 to increase sample diversity.
[0038] RandAugment: randomly select one of the following operators to execute: ColorTransform: overall color channel transformation and slight jitter; AutoContrast: automatic contrast stretching; Equalize: histogram equalization; Sharpness: sharpness adjustment; Posterize: color scale compression; Solarize: solarization effect; Color: saturation adjustment; Contrast: contrast adjustment; Brightness: brightness adjustment.
[0039] Unlabeled data augmentation: the same unlabeled image is divided into two views for input.
[0040] (1) Teacher view weak augmentation (Weak augmentation): input the teacher model and use weak augmentation strategy; In the full experiment, TTA is introduced to improve the stability of pseudo-labels by aggregating multiple weak views.
[0041] Conventional weak augmentation scenario: in some experiments, the teacher model input uses the basic weak augmentation method, including: 1) RandomResize: Randomly select a resolution within a preset multi-scale range (1333x400 to 1333x1200) for equal scaling, keeping the target aspect ratio unchanged; 2) RandomFlip: Flip the image horizontally with a probability of 0.5 to increase sample diversity.
[0042] TTA scenario: In the full experiment, the TTA strategy is introduced. This strategy includes: 1) Multi-scale view generation: Take 1333x400, 1333x800 and 1333x1200 to generate three sets of scaled views for the same image; 2) Flip combination: Generate two types of views, "flip" and "no flip", at each scale to further expand view diversity; 3) Cross-view inference and aggregation: The teacher model independently infers each view and matches and fuses the results at the result level; 4) Stability calculation and screening: Calculate the stability score by counting the consistency of the candidate box under multiple views, and only keep the candidate box with a stability score higher than 0.85 as the pseudo-label input to the student model.
[0043] (2) Student view strong augmentation (Strong augmentation): Input the student model, and increase: RandomErasing: Randomly erase 1-5 regions (single block area ≤20%) to enhance the anti-occlusion ability of the model; RandAugment: Randomly select one of the following operations to perform, increasing the diversity of sample deformation: Rotate: Small angle rotation (about ±5° to ±15°) around the center of the image ShearX / ShearY: Shear along the horizontal or vertical direction, and adjust the boundary box through affine mapping; TranslateX / TranslateY: Translate the image in the horizontal or vertical direction, and crop the part that exceeds, and translate the boundary box synchronously.
[0044] As shown in Figure 5 , the supervised warm start and semi-supervised weight initialization module 3 uses the labeled sample set (1a) for supervised warm start training, and migrates the obtained detector weight to the teacher model (2a) and the student model (2b) as the initialization parameters of the semi-supervised target detector.
[0045] This module aims to solve the problems of gradient explosion, excessive pseudo-label noise and underfitting of the teacher-student dual network at the initial stage of semi-supervised training. By introducing transfer learning and hot start strategy, the parameters of the teacher model are stabilized before the start of the semi-supervised stage, enabling it to generate higher quality pseudo-labels, thereby improving the stability and accuracy of subsequent training, including three aspects.
[0046] Supervised hot start: (1) Before entering the semi-supervised training, use the labeled sample set (1a) to supervise the training of the detection model; (2) Supervised training until the model converges, obtaining a detector weight with stable species identification and boundary box regression ability; (3) The output weight of this stage represents the best supervised performance under limited labeled sample conditions.
[0047] (4) The data preprocessing method is the same as the teacher-student dual network structure construction module.
[0048] Semi-supervised weight initialization: (1) Migrate the detector weight obtained by supervised hot start to the teacher model (2a) and the student model (2b); (2) As the initialization parameter of the semi-supervised target detector, it is used to drive subsequent pseudo-label generation and teacher-student joint training; (3) Weight migration enables the teacher model to generate higher quality pseudo-labels in the initial stage, avoiding excessive pseudo-label noise under random initialization.
[0049] Connect with subsequent modules: (1) After hot start and weight migration initialization, the teacher model (2a) performs inference and pseudo-label generation in the teacher model inference and pseudo-label generation module 4, and the student model (2b) performs supervised and semi-supervised joint training in the joint training module 6; (2) The teacher model (2a) and the student model (2b) are continuously updated in the subsequent iteration process to ensure that the semi-supervised learning framework forms a closed loop.
[0050] The technical benefits include: improved pseudo-label quality: the teacher model obtains stable weights from supervised training, significantly improving the accuracy of pseudo-label generation and reducing the proportion of incorrect pseudo-labels; stable training process: effectively avoiding gradient explosion and underfitting in the cold start phase, ensuring smooth semi-supervised training; accelerated convergence speed: initial parameters are derived from the supervised detector, enabling semi-supervised training to quickly enter a stable convergence phase in the early stages, reducing training oscillations; reduced label dependence: under limited label samples, training effects are optimized through warm start and weight transfer, reducing dependence on large-scale label data; enhanced generalization performance: in complex outdoor environments (such as sudden changes in light, rain and snow, and vegetation occlusion), the model can still maintain high detection accuracy, demonstrating stronger robustness and generalization ability.
[0051] like Figure 7 As shown, the teacher model inference and pseudo-label generation module 4 copies the weights of the student model (2b) to the weights of the teacher model (2a) and updates the teacher model using an exponential moving average. The teacher model (2a) infers from the unlabeled sample set (1b) to generate and filter pseudo-labeled samples that can be learned by the student model (2b). This module utilizes unlabeled samples (1b) to generate pseudo-labels through inference by the teacher model (2a), and then provides these pseudo-labels to the student model (2b) for joint training. This is achieved through high-confidence screening and visual... Figure 1 By adhering to consistency constraints, this invention can fully mine the potential information in unlabeled data under limited labeled sample conditions. The implementation steps are as follows: 1. Input processing: Unlabeled samples (1b) are first processed uniformly (color space conversion, normalization, size alignment) and then input into the teacher model (2a). The teacher model uses weak augmentation for inference to keep the prediction results as close as possible to the true distribution and reduce the bias caused by excessive perturbation.
[0052] Pseudo-tag generation (1) The teacher model performs target detection on the weakly augmented input image and outputs the predicted class probability and bounding box position; (2) In the full experiment, TTA was further used to generate multiple views through multi-scale scaling and flipping, and the prediction results were aggregated. The final results were processed by non-maximum suppression (NMS) to obtain a more stable and more confident set of candidate boxes.
[0053] (3) The TTA parameters are set as follows: Scaling scales: 1333×400, 1333×800, and 1333×1200; View strategy: No flip and horizontal flip; Result processing: The prediction results of each view at each scale are merged and then NMS is used, with IoU set to 0.5.
[0054] Pseudo-label filtering: (1) Initial filtering: the candidate targets output by the teacher model first need to meet the confidence level of not less than 0.5, and these candidate targets are reserved for subsequent consistency training and jitter stability verification; the targets lower than 0.5 are directly discarded; (2) Candidate region filtering: in the RPN stage, only the candidate regions with a confidence level not less than 0.9 are reserved, and they are used as the supervision signal of the student model in the RPN training stage; (3) Classification branch filtering: in the classification stage, only the candidate boxes with a class prediction score greater than or equal to 0.9 are reserved to ensure that the pseudo-labels entering the student model have a high confidence level, thereby reducing the risk of misguidance.
[0055] (4) Boundary box jitter consistency verification: the candidate boxes meeting the initial threshold (0.5) are subjected to 10 times of random jitter (Box Jitter), each time the boundary box is disturbed within a scale range of 6%. If the prediction result variance of the jittered boundary box is less than 0.02, it is determined that the target box is stable and is reserved; otherwise, it is discarded.
[0056] (5) Geometric constraint: after completing the jitter consistency verification, the target boxes with a width and height less than 0.01 are further removed to avoid generating unreasonable or invalid small boxes.
[0057] Pseudo-label mapping: (1) The generated pseudo-labels include the class label and the boundary box coordinates of the target; (2) These pseudo-labels are input into the student model (2b) together with the original image as the supervision signal of the unlabeled sample; (3) Under strong augmented views, the student model needs to keep the prediction consistent with the teacher pseudo-labels, thereby realizing consistency learning.
[0058] Technical effects include: improving the reliability of pseudo-labels: through confidence filtering and TTA aggregation, the noise level of pseudo-labels is effectively reduced; improving the efficiency of semi-supervised learning: a large amount of unlabeled data is converted into usable training samples after pseudo-label mapping, expanding the supervision signal; reducing the risk of misguidance: low confidence or unstable prediction is discarded or ignored, avoiding the performance collapse of the student model in the early stage of training due to false pseudo-labels; enhancing the robustness of the model: multi-view reasoning and consistency constraints make the student model better adapt to complex environments (occlusion, light changes, night images), improving the overall detection accuracy and generalization ability.
[0059] As Figure 8As shown, the label optimization and loss constraint module 5 optimizes the label sample set (1a), introduces a difficult example mining mechanism, makes the model preferentially learn the samples with high difficulty in training, and uses the CIoU loss function in the boundary box regression process to jointly constrain the overlap, center point distance and width-height ratio between the target box and the real box. The function of this module is to introduce difficult example mining and CIoU loss optimization for the label data (1a) to improve the discrimination ability and positioning accuracy of the model on real label samples. In the part of the unlabeled data (1b), the original loss and the conventional sampling are still maintained to avoid instability caused by the interference of false label noise. Through this differentiated processing mechanism, the present application fully utilizes the labeled samples while stably exploiting the potential value of the unlabeled samples. The implementation steps are as follows: 1. Label data optimization (1) Difficult example mining In each training batch, the samples are sorted according to the classification loss and the boundary box regression loss; Preferentially select high-loss samples (difficult examples) for backpropagation and discard simple samples; Effectively improve the discrimination ability of the student model on boundary ambiguous and similar class samples.
[0060] (2) CIoU loss optimization Introduce CIoU loss in the boundary box regression process, considering overlap, center point distance and width-height ratio; Compared with traditional L1 or IoU loss, CIoU can better constrain the geometric relationship between the target box and the real box, and improve the detection positioning accuracy 2. Unlabeled data processing (1) Use the pseudo-label generated by the teacher model for the unlabeled samples (1b); (2) Maintain the original loss function and the conventional sampling mechanism without additional introduction of OHEM or CIoU; (3) This can avoid the negative impact of false pseudo-label noise on the training process.
[0061] The technical effects include: improving the value of labeled samples: through difficult example mining, the student model pays more attention to high-loss samples, enhancing the discrimination ability; improving the positioning accuracy: CIoU loss makes the boundary box closer to the real target, and the detection effect is better; robustly utilizing unlabeled data: maintaining the original loss and sampling for the unlabeled part to avoid the negative impact of false pseudo-labels; improving the overall performance: the labeled and unlabeled data use differentiated optimization strategies, which improves the precision, stability and generalization of the semi-supervised framework.
[0062] S8, the joint training module 6 is used for joint training, and the pseudo-label sample in S5 and the label sample set (1a) optimized in S6 are jointly input into the student model (2b) for joint training, so as to improve the high precision and strong robustness of the detector in a complex environment; The purpose of this module is to jointly input the label data 1a and the pseudo-label data (generated and optimized by modules 4 and 5) into the student model (2b) for joint training. Through the fusion of supervised learning and semi-supervised consistency learning, the present application can fully exploit the potential information of unlabeled data under the condition of limited labeled data, and improve the overall detection performance. The following aspects are achieved: 1. Input composition Supervised branch: use label data (1a), RoI loss function includes classification loss (cross-entropy loss, Cross-Entropy Loss) and bounding box regression loss (CIoU Loss, enabled for labeled data in semi-supervised training). At the same time, combine OHEM strategy to select difficult samples for back propagation.
[0063] Unsupervised branch: use unlabeled data (1b), use pseudo-label generated by teacher model and optimized (module 5) as supervision signal. The student model predicts under strong augmented view and keeps consistency constraint with the teacher pseudo-label.
[0064] Loss function design Supervised loss L sup : classification loss based on label data + CIoU bounding box regression loss, combined with OHEM strategy to select difficult examples. This loss includes: L sup = L sup_roi_cls + α · L sup_roi_reg + L sup_rpn_cls + L sup_rpn_cls Wherein, the RPN loss is the same as the original Faster RCNN.
[0065] L sup_cls : classification loss, uses cross-entropy loss, and combines OHEM strategy to preferentially select difficult examples from candidate samples for back propagation; L sup_reg : bounding box regression loss, uses CIoU Loss, which comprehensively constrains the overlap, center distance and aspect ratio of the real box and the predicted box; α: Weight coefficient of CIoU, the contribution of CIoU in supervised loss, the value is 8.0.
[0066] (2) Unsupervised loss L unsup : Classification consistency loss and bounding box regression loss based on unlabeled data, the loss is the same as the original Faster RCNN; (3) Total loss L total As follows: L total L sup λ u · L unsup Wherein λ u is the unsupervised loss weight, in the proportion experiment λ u is 4, in the full experiment λ u is 2.
[0067] Training process (1) In each iteration, a part of labeled data and unlabeled data are sampled at the same time, the proportion is 1:4 in the semi-supervised experiment, and the proportion is 1:1 in the full experiment; (2) The student model receives two kinds of input and calculates the supervised loss and unsupervised loss respectively; (3) The total loss is used to update the student model parameters; (4) The teacher model parameters are updated through the EMA mechanism, refer to the teacher model update module 7.
[0068] Technical effects include: effectively fuse label and unlabeled information: while ensuring the stability of supervised training, gradually introduce unlabeled samples, improve data utilization. Improve the reliability of pseudo-label use: through confidence weighting and loss balancing, reduce the influence of false pseudo-labels, avoid unstable training. Enhance model discrimination ability: OHEM and CIoU loss only act on labeled data, further improve the model on key samples and positioning accuracy.
[0069] Finally, the S4~S8 are iteratively executed until the convergence condition is met, and the final model is output.
[0070] The teacher model updating module 7 is to update the parameters of the teacher model (2a) to maintain stability and robustness in the semi-supervised training process. Unlike the student model, the teacher model does not directly participate in backpropagation, but is updated indirectly through the evolution of the parameters of the student model. The EMA mechanism is adopted to keep the teacher model balanced between the latest parameters of the student model and the historical parameters, thereby ensuring the reliability of the teacher model in generating pseudo-labels.
[0071] Updating mechanism (1) The teacher model does not calculate the gradient and does not perform backpropagation; (2) After each iteration, the parameters of the teacher model are updated as follows: θ T According to the following formula: θ T ← m · θ T +(1- m )· θ S wherein, θ S denotes the student model parameters, m is the momentum coefficient, set to 0.999.
[0072] Characteristics (1) The teacher model is always in inference state during the training process, and is only responsible for predicting unlabeled data and generating pseudo-labels; (2) The student model updates its parameters through supervised and unsupervised loss in each iteration, and the updated results are transmitted to the teacher model through EMA smoothing; (3) The teacher model is not affected by single training fluctuations or noisy pseudo-labels due to the introduction of EMA.
[0073] Model weight interaction relationship (1) From the joint training module 6: the student model updates its parameters in joint training; (2) Feedback to the teacher model inference and pseudo-label generation module 4: the updated teacher model uses the latest weights to generate higher quality pseudo-labels in the next iteration.
[0074] Technical effects include: improving pseudo-label stability: the teacher model is updated by EMA, the parameter changes smoothly, reducing the pseudo-label jitter caused by short-term fluctuations of the student model. Ensure the robustness of the training process: the teacher model is not directly affected by gradient noise, which helps to improve the reliability and consistency of pseudo-label generation. Strengthen the positive feedback loop: the updated weights of the teacher model can generate better pseudo-labels, which in turn promote the optimization of the student model, forming a virtuous cycle. Improve overall convergence performance: the smooth updating mechanism of the teacher model avoids training interruption and performance collapse, ensuring stable convergence of the semi-supervised detection process.
[0075] As shown in Figure 9 , the model output and deployment module is responsible for outputting, exporting and deploying the final species identification model after semi-supervised training is completed. The purpose is to put the detector optimized by teacher-student joint optimization into practical application scenarios, realize real-time or offline automatic recognition of infrared trigger camera captured images, and thus improve the efficiency of wildlife monitoring and reduce labor costs.
[0076] Model output (1) After training is completed, export the final optimized teacher model parameters θ T .
[0077] (2) The output model weight includes feature extraction network, feature fusion network, region proposal network, detection head (classification branch and bounding box regression branch); (3) Save the model configuration file (including data preprocessing, augmentation strategy, confidence threshold, NMS parameter, etc.) to ensure that the inference configuration is consistent between the inference environment and the training environment.
[0078] Inference and application (1) Offline inference mode: batch processing of historical infrared trigger camera images, automatically identifying species categories and locations; (2) Online inference mode: deploy the model to the field monitoring platform, perform real-time detection and recognition on the images uploaded by the infrared trigger camera, and trigger an alarm or automatically archive when a target species is detected.
[0079] Deployment mode (1) Local deployment: run on a research workstation or laboratory server, suitable for centralized processing of large-scale data; (2) Edge deployment: run on infrared trigger camera terminals or edge computing devices (such as Jetson, Raspberry Pi, etc. low-power platforms) to realize front-end real-time recognition; (3) Cloud deployment: upload the model to the cloud computing platform, combine big data storage and distributed inference to meet the needs of cross-regional multi-camera collaborative monitoring.
[0080] Output result format, each image output species category label, bounding box coordinates and confidence score; At the same time support visual output (draw detection box and class name on the image), convenient for researchers to quickly browse.
[0081] Technical effects include: efficient application: put the semi-supervised optimized detector into actual wild animal monitoring, significantly reducing the workload of manual screening and labeling; Multi-scene adaptation: support offline batch processing and online real-time inference, adapt to two types of needs of scientific research analysis and reserve early warning; Flexible deployment: compatible with local, edge and cloud deployment, meet the calculation and transmission conditions in different environments; Result traceable: the output recognition result has both structured and visualized forms, which is convenient for scientific research statistics and intuitive presentation.
[0082] Implementation environment and training parameter description 1. System environment The semi-supervised species identification method of the application is implemented under the Soft Teacher framework and runs on the MMDetection platform (mmdet=3.3.0). The experiment is completed in the following software and hardware environment: Operating system: Ubuntu 22.04 (Linux kernel); Deep learning framework: PyTorch 2.1.0 + CUDA 12.1; Dependency library: cuDNN 8.9.7, TorchVision 0.16.0+cu121; Python environment: Python 3.8; Target detection framework: MMDetection v3.3.0, integrated Soft Teacher semi-supervised detector.
[0083] Training parameters Supervised training, general settings are as shown in Figure 10 .
[0084] Training epoch and learning rate reduction strategy, settings are as shown in Figure 11 .
[0085] Semi-supervised training, general settings are as shown in Figure 12 .
[0086] Training iteration and learning rate reduction strategy, settings are as shown in Figure 13 .
[0087] The above disclosed embodiments of the present application are only used to help explain the present application. The embodiments do not describe all the details of the present application, and the present application is not limited to the specific embodiments described. According to the content of the present specification, many modifications and changes can be made. The present specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present application, so that those skilled in the art can well understand and utilize the present application.
Claims
1. A semi-supervised object detection method for infrared-triggered camera wildlife species identification, characterized in that, The method comprises the following steps: S1, constructing a training set, dividing image and video data into a labeled sample set (1a) and an unlabeled sample set (1b); S2, constructing a teacher-student dual network model, including a teacher model (2a) and a student model (2b), and performing weak / strong augmentation double views on the labeled sample set (1a) and the unlabeled sample set (1b); S3, performing supervised warm start training on the labeled sample set (1a), and migrating the obtained detector weight to the teacher model (2a) and the student model (2b) as the initialization parameter of the semi-supervised target detector; S4, copying the student model (2b) weight as the teacher model (2a) weight, and updating the teacher model in an exponential moving average manner; S5, the teacher model (2a) performs inference on the unlabeled sample set (1b), generates and screens pseudo-labeled samples available for the student model (2b) to learn; S6, optimizing the labeled sample set (1a), introducing a difficult example mining mechanism, so that the model preferentially learns samples with higher difficulty in training, and in the boundary box regression process, a CIoU loss function is used to jointly constrain the overlap, center point distance and width-height ratio between the target box and the real box; S8, joint training, inputting the pseudo-labeled samples in S5 and the labeled sample set (1a) optimized in S6 into the student model (2b) for joint training, so as to improve the high precision and strong robustness of the detector in complex environments; S9, iteratively executing S4-S8 until the convergence condition is met, and outputting the final model.
2. The semi-supervised object detection method for infrared-triggered camera wildlife species identification according to claim 1, wherein: The labeled sample set (1a) and the unlabeled sample set (1b) both contain species categories and boundary box information.
3. The semi-supervised object detection method for infrared-triggered camera wildlife species identification according to claim 2, wherein: The labeled sample set (1a) is an equalized labeled data subset constituted by extracting min(3000, Nc) for each species c; the rest of the data is the unlabeled sample set (1b).
4. The semi-supervised object detection method for infrared-triggered camera wildlife species identification according to claim 3, wherein: The teacher model (2a) and the student model (2b) use the same baseline detector, including a feature extraction network, a feature fusion network, a region candidate network, a RoIAlign layer and a detection head, the feature fusion network fuses multi-scale features, the region candidate network generates candidate regions to provide potential target positions, the RoIAlign layer accurately aligns the candidate regions and the feature map, and the detection head is composed of a classification branch (2c) and a boundary box regression branch (2d), which are respectively used for class prediction and position regression.
5. The semi-supervised object detection method for infrared-triggered camera wildlife species identification according to claim 4, wherein: The weak / strong augmentation double view includes labeled data augmentation and unlabeled data augmentation, the labeled data augmentation randomly scales, flips and color perturbs the pictures in the labeled sample set (1a); the unlabeled data augmentation includes teacher view weak augmentation and student view strong augmentation, the teacher view weak augmentation includes random scaling, flipping and TTA; the student view strong augmentation increases random erasing and random geometric perturbation on the basis of the processing mode of the labeled data augmentation.
6. The semi-supervised object detection method for infrared-triggered camera wildlife species identification according to claim 5, wherein: The TTA comprises: Generating three sets of scaling views from the same image, taking 1333x400, 1333x800 and 1333x1200; Generating two types of views of "flipping" and "non-flipping" respectively under each scale; The teacher model independently reasons each view and matches and fuses at the result layer; The stability score is calculated by counting the consistency of the candidate box under multiple views, and only the candidate box with a stability higher than 0.85 is reserved as a pseudo-label input into the student model (2b).
7. The semi-supervised object detection method for infrared-triggered camera wildlife species identification according to claim 6, wherein: The pseudo-label sample generation process is as follows: S51, input processing, the unlabeled sample set (1b) is input into the teacher model (2a) to obtain the candidate box and class prediction result through reasoning; S52, pseudo-label generation, based on the class probability and boundary box coordinates in the prediction result, the detection result with high confidence is selected as the pseudo-label; S53, pseudo-label screening, by setting a confidence threshold and consistency discrimination condition, low-quality prediction is removed to ensure the reliability of the pseudo-label; S54, pseudo-label mapping: the screened pseudo-label is transmitted to the student model for consistency learning in the joint training stage.
8. The semi-supervised object detection method for infrared-triggered camera wildlife species identification of claim 1, wherein: The joint training includes loss function design, and the process is as follows: S81, in each iteration, a part of labeled data and unlabeled data are sampled at the same time, the ratio is 1:4 in the semi-supervised part experiment and 1:1 in the full experiment; S82, the student model receives two types of inputs and calculates the supervised loss and unsupervised loss respectively; S83, the total loss is used to update the student model parameters S84, the teacher model parameters are updated by the exponential moving average method.
9. The semi-supervised object detection method for infrared-triggered camera wildlife species identification of claim 8, wherein: The loss function design formula is as follows: L total =L sup +λ u · L unsup wherein: λ u is the unsupervised loss weight, in the proportional experiment λ u is 4, in the full experiment λ u is 2; L total is the total loss; L unsup is the unsupervised loss: L sup is the supervised loss.
10. The semi-supervised object detection method for infrared-triggered camera wildlife species identification of claim 9, wherein: The supervised loss is composed of the classification loss and CIoU boundary box regression loss based on the labeled data, and the OHEM strategy is combined to select difficult examples, and the unsupervised loss is based on the classification consistency loss and boundary box regression loss of the unlabeled data, and the loss is the same as the original Faster RCNN.