An improved panax notoginseng flower and seed lightweight field detection method based on RT-DETR
By optimizing the structure of the RT-DETR model and constructing the dataset, the problems of computational complexity and environmental interference in the detection of Panax notoginseng flowers and seeds were solved, achieving lightweight and high-precision field detection, adapting to edge devices, and improving the detection effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- KUNMING UNIV OF SCI & TECH
- Filing Date
- 2026-03-31
- Publication Date
- 2026-06-23
AI Technical Summary
Existing RT-DETR models have high computational complexity and a large number of parameters in the detection of Panax notoginseng flowers and seeds, making them difficult to deploy at the edge. Furthermore, they are susceptible to interference from similar-colored backgrounds in complex field environments, and the small target size and sparse features lead to high rates of missed detections and false detections. There is a lack of dedicated lightweight detection models.
By integrating the CHDBlocks module, embedding the FCM module, and replacing the HWD module into the RT-DETR model, the model structure is optimized. Combined with dataset construction and training deployment, lightweight and high-precision detection is achieved.
The model is lightweight, reducing floating-point operations by 29.4% and parameters by 27.6%. Real-time detection is achieved on the JetsonOrinNX edge computing platform, significantly improving detection accuracy and robustness, with mAP@0.5 reaching 89.4%.
Smart Images

Figure CN122265839A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent agricultural detection and deep learning applications, and in particular to a lightweight field detection method for Panax notoginseng flowers and seeds based on RT-DETR improvement. Background Technology
[0002] Panax notoginseng is a traditional and rare medicinal plant in my country. Its flowers, green seeds, and red seeds correspond to different growth stages and have important medicinal and reproductive value. Among them, the flowers are the core medicinal raw material, the red seeds are the key propagation material, and the green seeds, as a transitional growth stage, have no practical harvesting value. The three often grow together in the field, and accurate differentiation and identification are the core prerequisites for realizing intelligent harvesting and refined field management of Panax notoginseng.
[0003] Deep learning-based object detection algorithms provide technical support for intelligent agricultural identification. Among them, the RT-DETR model, due to its end-to-end detection characteristics, has significant advantages in adaptability to dense small targets and complex scenes, making it an ideal basis for the detection of Panax notoginseng flowers and seeds. However, existing RT-DETR and improved models still face adaptability challenges: First, the models have high computational complexity and a large number of parameters, relying on high-performance computing platforms, making them difficult to deploy on resource-constrained field edge devices; second, the field detection scenario is unique, with Panax notoginseng flowers and green seeds being easily interfered with by their similar colors to background leaves, and green and red seeds having similar shapes and being affected by uneven lighting and leaf occlusion, making classification difficult. At the same time, the target size is small and the features are sparse, easily leading to spatial information loss and inaccurate localization, resulting in a high rate of missed detections and false detections.
[0004] In existing lightweight detection research, pruning and compression strategies tend to sacrifice detection accuracy, while architecture improvement strategies can better balance accuracy and efficiency, but there are still no dedicated models for the detection of Panax notoginseng flowers and seeds. Therefore, developing a dedicated detection method that balances detection accuracy and lightweight design and is adaptable to edge deployment has become a key requirement for promoting the intelligent development of the Panax notoginseng industry. Summary of the Invention
[0005] This invention addresses the core challenges of detecting Panax notoginseng flowers, green seeds, and red seeds in complex field environments, including missed detection of small targets, interference from similar-colored backgrounds, difficulty in distinguishing similar targets, and challenges in edge deployment of models. It proposes a lightweight field detection method for Panax notoginseng flowers and seeds based on an improved RT-DETR approach. Through collaborative design of the entire process—dataset construction, model optimization, training, and deployment—a dynamic balance between detection accuracy and lightweight design is achieved, meeting the real-time detection needs in the field and providing core technical support for intelligent harvesting and refined field management of Panax notoginseng.
[0006] The detection method provided by this invention includes the following steps: Step (1) Collect images of Panax notoginseng flowers, green seeds, and red seeds and create a dataset; Step (2) Optimize and improve the RT-DETR model to form an improved CHD-DETR lightweight detection model; Step (3) Train the improved CHD-DETR lightweight detection model; Step (4) Deploy the model to the edge computing platform to obtain the detection results.
[0007] The aforementioned dataset construction refers to the following: Field images were collected at the Qidan Pharmaceutical Planting Base in Wenshan Prefecture, Yunnan Province, during the flowering period (August) and seed-setting period (October). The collection time covered 10:00 AM to 8:00 PM, encompassing various weather conditions (sunny, cloudy, etc.), lighting scenarios (strong light, normal light, weak light), and multiple shooting angles. The shooting distance was controlled within the range of 15-40cm. Samples with target occlusion, overlap, and complex backgrounds were specifically collected to ensure scene diversity and representativeness. A total of 2000 original images were collected, including three core categories: Panax notoginseng flowers, green seeds, and red seeds. To balance model training efficiency and feature integrity, bilinear interpolation was used to uniformly scale all images to a resolution of 640×640 pixels. This size preserves the detailed features of Panax notoginseng flowers and seeds while meeting the memory optimization requirements of GPU batch computing. The collected images were manually labeled using the LabelImg annotation tool, with Panax notoginseng flowers labeled as "f", green seeds as "g", and red seeds as "s". The annotation files were first saved as JSON format and then converted to TXT format using a format conversion script for subsequent model training.
[0008] The dataset creation process also includes: dividing 2000 original images into a 6:2:2 ratio (1200 images for training, 400 images for validation, and 400 images for testing) using a random partitioning method combined with proportional control. The proportions of the three target categories—Panax notoginseng flowers, green seeds, and red seeds—are kept consistent across the training, validation, and testing sets to ensure a balanced distribution of samples across all datasets. The training set is used for model parameter iteration and feature learning; the validation set is used to evaluate performance in real-time during model training and dynamically optimize model parameters; and the testing set serves as an independent evaluation set to verify the model's robustness and generalization ability in real-world field scenarios. This partitioning method ensures sufficient training data while effectively avoiding the risk of overfitting during model evaluation, providing reliable data support for the entire model optimization process.
[0009] The dataset creation also includes: to enhance the model's generalization ability to natural scenes and alleviate overfitting caused by limited data, targeted data augmentation strategies are employed to expand the original training set samples. Specifically, three augmentation methods are implemented: rotation combined with brightness adjustment, flipping combined with contrast adjustment, and rotation combined with Gaussian noise addition. Scripts process the training set images, generating corresponding augmented samples for each original image, expanding the training set from 1200 to 4800 images, significantly improving data diversity and richness. During data augmentation, the LabelImg annotation file is updated synchronously to ensure strict alignment of the boundingbox coordinates with the augmented image, avoiding annotation deviations caused by geometric transformations, guaranteeing the dataset's annotation accuracy, and providing robust support for model feature learning.
[0010] The optimization and improvement of the RT-DETR model to form the CHD-DETR lightweight detection model includes: integrating the CHDBlocks lightweight module into the backbone network of the RT-DETR baseline model, replacing the P3, P4, and P5 feature layers of the backbone network. This module is composed of channel-grouped semi-convolution (CGHalfConv) and dynamic spatial attention (DSA). CGHalfConv divides the input feature map along the channel dimension into three independent processing groups. Each group is configured with a dedicated convolution kernel to extract features in parallel. Each group only performs convolution operations on the first half of the input channels, while maintaining the identity mapping in the second half. Through structured feature learning, different groups are assigned different tasks for extracting target color contours, texture details, and deep semantics, significantly reducing computational redundancy while ensuring the integrity of feature representation. The DSA module receives the feature map output by CGHalfConv, first aggregates global context information through global average pooling, and then dynamically generates sample-specific convolution kernels through a lightweight convolutional network. These kernels are applied to the channel-averaged descriptors of the feature map to generate a spatial attention map. The core calculation is as follows: in, Channel-averaged descriptors representing feature maps This indicates a dynamically generated sample-specific convolutional kernel. This indicates a dynamic convolution operation. The generated spatial attention map features high activation values for the target region and low activation values for the background region. Feature modulation is then achieved through element-wise multiplication, as shown in the following formula: Where F is the input feature map of the DSA module, For element-wise multiplication, Y is the output feature map after feature modulation. CGHalfConv and DSA form a synergistic effect of "lightweight feature extraction - adaptive suppression of similar backgrounds", which reduces computational cost while effectively mitigating interference from similar-colored backgrounds and improving the model's robustness in complex field environments.
[0011] The improved CHD-DETR lightweight detection model, which optimizes and improves the RT-DETR model, further includes embedding a Feature Complement Mapping (FCM) module into the feature interaction nodes of the backbone and neck networks of the RT-DETR model. This module specifically addresses the issues of spatial information loss and misalignment of semantic and spatial location information in the detection of small targets such as Panax notoginseng flowers and seeds. This module first splits the input feature map according to channel ratio, with one channel retaining the shallow contours and positional details of the target, and the other carrying preliminary contextual semantics. Then, 3×3 convolution and 1×1 point convolution are performed on the two split feature channels respectively to obtain spatial detail features. and channel semantic features This achieves explicit decoupling of the two types of information, avoiding mutual interference during the fusion process. In the channel interaction path, depthwise separable convolutions are performed on spatial detail features to strengthen the correlation of local features within each channel, followed by global average pooling and sigmoid activation to generate channel weights. The calculation formula is: Where σ is the Sigmoid activation function. In the spatial interaction path, 1×1 convolution, batch normalization, and Sigmoid activation are sequentially performed on the channel semantic features to generate spatial weights. The calculation formula is: in, This is a 1×1 convolution operation. This is a batch normalization operation. Finally, a bidirectional weighted fusion is used to achieve complementary enhancement of spatial and semantic features. The calculation formula is as follows: Where ⊕ represents the feature concatenation operation, This is the fused feature map. This module enables bidirectional interactive fusion of shallow spatial information and deep semantic information, so that the fused features have both fine-grained spatial positioning information and rich deep semantic features, effectively improving the positioning accuracy and semantic discrimination ability of small targets and alleviating the information loss problem of deep networks.
[0012] The improved CHD-DETR lightweight detection model, which optimizes and improves the RT-DETR model, further includes replacing the traditional convolutional downsampling of the neck network of the RT-DETR model with a Haar wavelet basis downsampling (HWD) module. This addresses the problem that traditional downsampling easily loses key discrimination details such as inflorescence texture and seed edges. This module uses Haar wavelet transform as its core, first decomposing the input feature map into low-frequency approximate components and three high-frequency detail components (horizontal, vertical, and diagonal). The low-frequency components correspond to the global structure and contour information of the target, while the three high-frequency components capture fine features such as edges and textures in the horizontal, vertical, and diagonal directions, respectively. Utilizing the orthogonality and fast signal decomposition characteristics of Haar wavelet transform, a downsampling operation with a stride of 2 compresses the spatial resolution of each component to half that of the original feature map, while simultaneously increasing the number of channels to four times the original number. This achieves the transfer of spatial information to the channel dimension, completing lossless feature encoding during the downsampling process. Subsequently, a feature learning submodule consisting of 1×1 convolutions, batch normalization, and ReLU activation adjusts the number of feature channels to achieve seamless integration with subsequent detection networks. Simultaneously, the synergistic effect of batch normalization and ReLU filters redundant feature information. Compared to traditional convolutional downsampling, the HWD module efficiently compresses feature maps while maximizing the preservation of key target details, improving the ability to distinguish similar targets, and incurring no additional parameter overhead, further optimizing the model's computational efficiency.
[0013] The improved CHD-DETR lightweight detection model refers to the following: To ensure the efficiency and stability of model training, the input images were uniformly adjusted to 640×640 pixels, and a standardized training hardware and software environment was built. The operating system was Windows 11, the CPU was an Intel Core i9-13900KF, the GPU was an NVIDIA GeForce RTX 4090 24G, the deep learning framework was PyTorch 2.2.0, and it was supported by CUDA 12.1 and Python 3.9. Using RT-DETR as the baseline model, the AdamW optimizer was used for model training, with an initial learning rate of 0.0001, momentum of 0.9, batch size of 8, and 200 training epochs. The original RT-DETR model and the improved model were trained comparatively using the above parameters. By monitoring changes in precision, recall, and mAP@0.5 during the training process, the performance improvement of the improved model in the Panax notoginseng flower and seed detection task was finally verified.
[0014] The deployment of the model to an edge computing platform to obtain detection results refers to the following: To realize the practical application of the model in the field, the optimal weights of the trained CHD-DETR model are converted into the ONNX universal format, and inference optimization is performed through TensorRT, which significantly reduces the model inference time and improves real-time detection performance. The optimized model is deployed to the JetsonOrinNX edge computing platform, which has 157 TOPS of INT8 sparse computing power and 16GB LPDDR5 memory, which can meet the real-time visual inference requirements in complex field environments, while taking into account portability and computing performance, and is suitable for field operation scenarios. An integrated field detection system consisting of an industrial camera, an edge computing platform, and an LED display device is built. The industrial camera collects images or video streams of Panax notoginseng flowers, green seeds, and red seeds in the field in real time, and transmits the collected data to the edge computing platform. The deployed CHD-DETR model completes end-to-end target detection, automatically identifies the target category and accurately locates the target position, and finally outputs the detection results (target category, position, confidence level) to the LED display screen in real time. This deployment scheme enables real-time and accurate detection of Panax notoginseng flowers, green seeds, and red seeds in complex field environments. The detection results are intuitive and verifiable, providing direct and accurate visual decision support for intelligent Panax notoginseng harvesting equipment and refined field management. It maintains efficient inference speed on the edge platform to meet the requirements of real-time field operations.
[0015] Compared with existing technologies, the beneficial effects of adopting the above technical solution are as follows: To address the core challenges in detecting Panax notoginseng flowers and seeds, the RT-DETR model underwent multi-dimensional targeted optimization. The innovatively designed CHDBlocks module, through the synergistic effect of CGHalfConv and DSA, effectively suppressed interference from similar-colored backgrounds while achieving model lightweighting. The FCM module achieved bidirectional complementary fusion of deep and shallow features, significantly improving the localization accuracy and semantic discrimination ability of small targets. The HWD module replaced traditional downsampling, maximizing the preservation of key details while compressing feature maps. The three modules formed a synergistic optimization effect, enabling the model to achieve an mAP@0.5 of 89.4%, which is significantly better than mainstream detection models such as YOLOv8m and YOLOv11m.
[0016] (2) The CHD-DETR model proposed in this invention achieves a high balance between detection accuracy and lightweight design. Compared with the baseline model RT-DETR, the floating-point operation is reduced by about 29.4%, the number of parameters is reduced by about 27.6%, the model size is compressed to 28.3MB, and it has been successfully deployed on the JetsonOrinNX edge computing platform. It can realize real-time processing and detection of field video streams, and solves the problem that traditional models rely on high-performance computing platforms and are difficult to deploy at the edge. Attached Figure Description
[0017] Figure 1This is an overall flowchart of a lightweight field detection method for Panax notoginseng flowers and seeds based on RT-DETR, provided in the embodiments of this application. Figure 2 These are sample images of Panax notoginseng flowers and seeds in different scenarios from the application embodiments; Figure 3 This is a structural diagram of the CHDBlocks module and the CGHalfConv submodule in this application; Figure 4 This is a structural diagram of the DSA module in this application; Figure 5 This is a structural diagram of the FCM module in this application; Figure 6 This is a screenshot of the test results for this application; Figure 7 This is the heat map tested in this application; Figure 8 This is a schematic diagram illustrating the deployment and testing of this application on the JetsonOrinNX edge computing platform. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. The examples provided are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the protection scope of the present invention.
[0019] See Figure 1 The present invention provides a field detection method for lightweight Panax notoginseng flowers and seeds based on RT-DETR, which includes the following steps: Step (1): Images of Panax notoginseng flowers, green seeds, and red seeds were collected and a dataset was created. Images were collected at the Panax notoginseng planting base of Qidan Pharmaceutical in Wenshan Prefecture, Yunnan Province, focusing on the flowering period in August and the seed-setting period in October. The collection time was from 10:00 AM to 8:00 PM, covering different weather and lighting conditions, as well as multiple shooting angles including looking up, looking straight ahead, and looking down. The shooting distance was 15-40cm. Complex samples with occlusion, overlap, and dense backgrounds were collected simultaneously. See attached image. Figure 2 As shown, 2000 clear original images of the three types of targets—Panax notoginseng flowers, green seeds, and red seeds—were ultimately obtained.
[0020] LabelImg tool was used for annotation. The three types of targets were labeled as "f", "g", and "s" respectively. The annotation box was the smallest bounding rectangle containing the target body. The annotation file was first saved as JSON format and then converted to TXT format for model training and reading.
[0021] The images were divided into a training set of 1200 images, a validation set of 400 images, and a test set of 400 images in a 6:2:2 ratio to ensure a balanced distribution of the three target types. Three data augmentation methods were used on the training set: rotation combined with brightness adjustment, flipping combined with contrast adjustment, and rotation combined with Gaussian noise addition. Three times the augmented samples were generated in batches to expand the training set to 4800 images and improve the model's generalization ability.
[0022] Step (2): Optimize and improve the RT-DETR model to form an improved CHD-DETR model; A lightweight CHDBlocks module is integrated into the backbone network of the RT-DETR baseline model, replacing the P3, P4, and P5 feature layers of the backbone network. This module consists of channel grouped semiconvolution (CGHalfConv) and dynamic spatial attention (DSA) working together. Its structure is detailed in the appendix. Figure 3 and attached Figure 4 CGHalfConv divides the input feature map into three independent processing groups along the channel dimension. Each group is configured with a dedicated convolutional kernel to extract features in parallel. Each group only performs convolution operations on the first half of the input channels, while maintaining the identity mapping in the second half. Through structured feature learning, different groups are assigned different tasks for extracting target color contours, texture details, and deep semantics, significantly reducing computational redundancy while ensuring the integrity of feature representation. The DSA module receives the feature map output by CGHalfConv, first aggregates global context information through global average pooling, and then dynamically generates sample-specific convolutional kernels through a lightweight convolutional network. These kernels are applied to the channel-averaged descriptors of the feature map to generate a spatial attention map. The core calculation is shown below: in, Channel-averaged descriptors representing feature maps This indicates a dynamically generated sample-specific convolutional kernel. This indicates a dynamic convolution operation. The generated spatial attention map features high activation values for the target region and low activation values for the background region. Feature modulation is then achieved through element-wise multiplication, as shown in the following formula: Where F is the input feature map of the DSA module, For element-wise multiplication, Y is the output feature map after feature modulation. CGHalfConv and DSA form a synergistic effect of "lightweight feature extraction - adaptive suppression of similar backgrounds", which reduces computational cost while effectively mitigating interference from similar-colored backgrounds and improving the model's robustness in complex field environments.
[0023] In the RT-DETR model, the feature interaction nodes of the backbone and neck networks embed a Feature Complement Mapping (FCM) module, the structure of which is detailed in the appendix. Figure 5 This module specifically addresses the issues of spatial information loss and misalignment between semantic and spatial location information in the detection of small targets such as Panax notoginseng flowers and seeds. It first splits the input feature map according to channel ratio, with one channel retaining the shallow contours and positional details of the target, and the other carrying preliminary contextual semantics. Then, it performs 3×3 convolution and 1×1 point convolution on the two split feature channels respectively to obtain spatial detail features. and channel semantic features This achieves explicit decoupling of the two types of information, avoiding mutual interference during the fusion process. In the channel interaction path, depthwise separable convolutions are performed on spatial detail features to strengthen the correlation of local features within each channel, followed by global average pooling and sigmoid activation to generate channel weights. The calculation formula is: Where σ is the Sigmoid activation function. In the spatial interaction path, 1×1 convolution, batch normalization, and Sigmoid activation are sequentially performed on the channel semantic features to generate spatial weights. The calculation formula is: in, This is a 1×1 convolution operation. This is a batch normalization operation. Finally, a bidirectional weighted fusion is used to achieve complementary enhancement of spatial and semantic features. The calculation formula is as follows: Where ⊕ represents the feature concatenation operation, This is the fused feature map. This module enables bidirectional interactive fusion of shallow spatial information and deep semantic information, so that the fused features have both fine-grained spatial positioning information and rich deep semantic features, effectively improving the positioning accuracy and semantic discrimination ability of small targets and alleviating the information loss problem of deep networks.
[0024] The traditional convolutional downsampling in the neck region of RT-DETR is replaced with an HWD module to address the loss of key details. This module decomposes features into low-frequency contour components and three high-frequency detail components using Haar wavelet transform. A stride of 2 downsampling compresses the resolution to half its original value and increases the number of channels by four times, achieving lossless encoding of spatial information. A sub-module consisting of 1×1 convolution, batch normalization, and ReLU is then used to adjust the number of channels and filter redundancy. This maximizes the preservation of key details while efficiently compressing the feature map, improving the ability to distinguish similar targets, and optimizing computational efficiency without additional parameter overhead.
[0025] Step (3): Train the improved CHD-DETR lightweight detection model; A standardized hardware and software environment for model training was established, using Windows 11 as the operating system, an Intel Core i9-13900KF CPU, an NVIDIA GeForce RTX 4090 24G GPU, and PyTorch 2.2.0 as the deep learning framework, along with CUDA 12.1 and Python 3.9, to ensure efficient and stable model training. The input image resolution was fixed at 640×640 pixels. RT-DETR-R18 was used as the baseline model, and the AdamW optimizer was employed for iterative training of model parameters. The initial learning rate was set to 0.0001, momentum to 0.9, batch size to 8, and the total number of training epochs to 200. Precision (P), recall (R), and mAP@0.5 were used as the core evaluation metrics during training. The formulas for each metric are as follows: Where TP is the number of true positive samples, FP is the number of false positive samples, FN is the number of false negative samples, N is the total number of target categories detected, and APi is the average precision of the i-th target category.
[0026] Then, the above training parameters were used to train the basic RT-DETR model and the improved CHD-DETR. The training results were compared in terms of evaluation metrics. Taking into account various metrics, the module structure and parameters were continuously improved based on the training effect and comparison results to obtain the best model suitable for intelligent recognition of Panax notoginseng.
[0027] Step (4): Deploy the model to an edge computing platform to obtain detection results; To enable practical field applications of the model, the optimal weight file of the trained CHD-DETR model was deployed. Based on the deployed model, an integrated field detection platform was built. This platform consists of an industrial camera, a Jetson Orin NX SUPER edge computing platform, and a 7-inch LED display, as shown in the attached diagram. Figure 8 As shown, the industrial camera connects to the edge computing platform via a USB interface to achieve real-time acquisition of images or video streams of Panax notoginseng flowers, green seeds, and red seeds in the field. After the acquired images / video streams are transmitted to the edge computing platform, the deployed CHD-DETR model completes end-to-end target detection, automatically identifies the target category, accurately locates the target position, and outputs the detection confidence score. Finally, the detection results (target category, location box, confidence score) are visualized in real time and output to the LED display device, providing intuitive and accurate visual decision support for intelligent Panax notoginseng harvesting robots and refined field management.
[0028] This invention addresses the core problems in detecting Panax notoginseng flowers, green seeds, and red seeds in complex field environments, including missed detection of small targets, interference from similar-colored backgrounds, difficulty in distinguishing similar targets, and challenges in edge deployment. It proposes a lightweight field detection method based on the improved RT-DETR, namely CHD-DETR. By integrating the CHDBlocks module into the backbone network, lightweight feature extraction and adaptive suppression of similar-colored backgrounds are achieved. An FCM module is embedded in the backbone-neck region to enhance the spatial localization and semantic discrimination capabilities of small targets. The traditional downsampling in the neck region is replaced with an HWD module to maximize the preservation of key details and optimize computational efficiency. Compared to the baseline model RT-DETR, this method effectively solves the detection challenges in complex field scenarios, providing core visual support for intelligent harvesting and refined field management of Panax notoginseng.
[0029] To visually observe the test results, see attached... Figure 6 This image, showing the detection results, visually demonstrates the CHD-DETR model's performance in complex field scenarios such as strong light, low light, target occlusion, and overlap. It clearly labels the categories, locations, and confidence levels of Panax notoginseng flowers, green seeds, and red seeds. Compared to the baseline model, it significantly reduces false positives and missed detections, fully demonstrating the model's adaptability to complex environments and its detection accuracy. Further details are attached. Figure 7 To detect the heatmap, GradCAM++ visualization technology was used to present the model's feature response regions. It can be seen that the model can accurately focus on the core target region and effectively suppress the invalid response of leaves with similar background colors. Even in occluded scenes, the boundary between the target and the background can be clearly distinguished, which intuitively reveals the synergistic mechanism of each improved module in feature extraction and background suppression.
[0030] This testing solution not only enables real-time acquisition, accurate detection, and visualized output of images of Panax notoginseng flowers, green seeds, and red seeds in the field, but also allows for contactless inspection of large-scale plantations by combining industrial cameras, drones, and other equipment. With the lightweight deployment advantages of the JetsonOrinNX edge computing platform, it significantly improves testing efficiency and the level of intelligence in field operations, promoting the automation upgrade of the Panax notoginseng industry.
[0031] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A field detection method for lightweight Panax notoginseng flowers and seeds based on RT-DETR, characterized in that, Includes the following steps: Step (1) Collect images of Panax notoginseng flowers, green seeds, and red seeds and create a dataset; Step (2) Optimize and improve the RT-DETR model to form an improved CHD-DETR lightweight detection model; Step (3) Train the improved CHD-DETR lightweight detection model; Step (4) Deploy the model to the edge computing platform to obtain the detection results.
2. The field detection method for lightweight Panax notoginseng flowers and seeds based on RT-DETR improvement according to claim 1, characterized in that, Using image acquisition equipment, clear field images of Panax notoginseng flowers, green seeds, and red seeds were captured between 10:00 AM and 8:00 PM at different shooting angles, shooting distances of 15-40cm, and under different lighting conditions such as strong light, normal light, weak light, and cloudy days. The images covered complex scenes such as target occlusion and overlap, and a total of 2,000 original images were collected. The dataset contains three core categories: Panax notoginseng flowers, green seeds, and red seeds, corresponding to different growth stages of Panax notoginseng.
3. The field detection method for lightweight Panax notoginseng flowers and seeds based on RT-DETR improvement according to claim 1, characterized in that, The dataset construction in step (1) also includes: manually annotating the images using the LabelImg annotation tool, labeling Panax notoginseng flowers as "f", green seeds as "g", and red seeds as "s", and saving the annotation file in JSON format and then converting it to TXT format; dividing the original dataset into training set, validation set, and test set in a 6:2:2 ratio, and keeping the proportion of the three types of targets consistent in each dataset; and using three data augmentation methods on the training set, namely rotation combined with brightness adjustment, flipping combined with contrast adjustment, and rotation combined with Gaussian noise, to expand the number of training set samples from 1200 to 4800.
4. The field detection method for lightweight Panax notoginseng flowers and seeds based on RT-DETR improvement according to claim 1, characterized in that, The architecture optimization of the RT-DETR model in step (2) includes: integrating the CHDBlocks lightweight module into the backbone network of RT-DETR and replacing the P3, P4, and P5 feature layers of the backbone network; the CHDBlocks module consists of channel grouped semi-convolution (CGHalfConv) and dynamic spatial attention (DSA). CGHalfConv divides the input feature map into three independent processing groups along the channel dimension. Each group is configured with a dedicated convolution kernel to extract features in parallel. Each group only performs convolution operations on the first half of the input channel, while the second half maintains an identity mapping. The DSA module receives the feature map output by CGHalfConv, aggregates global context information through global average pooling, dynamically generates sample-specific convolution kernels through the lightweight convolutional network, generates a spatial attention map by acting on the channel average descriptor of the feature map, and then achieves feature modulation through element-wise multiplication to enhance the target features and suppress interference from similar-colored backgrounds.
5. The field detection method for lightweight Panax notoginseng flowers and seeds based on RT-DETR improvement according to claim 4, characterized in that, Step (2) further optimizes the architecture of the RT-DETR model by embedding a Feature Complement Mapping (FCM) module into the feature interaction nodes of the backbone and neck networks of RT-DETR. The FCM module first splits the input feature map according to the channel ratio, one path retains the shallow contour and positional details of the target, and the other path carries the initial contextual semantics. The split features are then subjected to 3×3 convolution and 1×1 point convolution to obtain spatial detail features and channel semantic features. After performing depthwise separable convolution on the spatial detail features through the channel interaction path, channel weights are generated by global average pooling and Sigmoid activation. The channel semantic features are then subjected to 1×1 convolution, batch normalization and Sigmoid activation to generate spatial weights. Finally, the two features are subjected to bidirectional weighted fusion to obtain a fused feature that combines fine-grained spatial positioning information and deep semantic features.
6. The field detection method for lightweight Panax notoginseng flowers and seeds based on RT-DETR improvement according to claim 1, characterized in that, The architecture optimization of the RT-DETR model in step (2) also includes: replacing the traditional convolutional downsampling of the RT-DETR neck network with the Haar wavelet basis downsampling (HWD) module; the HWD module decomposes the input feature map into low-frequency approximate components and three high-frequency detail components (horizontal, vertical, and diagonal) through Haar wavelet transform, and compresses the spatial resolution of each component to half of the original feature map through a downsampling operation with a stride of 2, increasing the number of channels to four times the original number; then, through the feature learning submodule composed of 1×1 convolution, batch normalization, and ReLU activation, the number of feature channels is adjusted and redundant features are filtered out, so as to achieve seamless integration with the subsequent detection network.
7. The field detection method for lightweight Panax notoginseng flowers and seeds based on RT-DETR improvement according to claim 1, characterized in that, In step (3), the specific parameters for model training are set as follows: the input image is uniformly adjusted to 640×640 pixels; the training environment is Windows 11 operating system, Intel Core i9-13900KF CPU, NVIDIA GeForce RTX4090 24G GPU, Python 3.9, CUDA 12.1, Pytorch 2.2.0; the AdamW optimizer is used, with an initial learning rate of 0.0001, momentum of 0.9, batch size of 8, and training rounds of 200; during training, precision (P), recall (R), and mAP@0.5 are used as the core evaluation indicators, and the model performance is evaluated in real time through the validation set and the parameters are optimized until the model converges.
8. The field detection method for lightweight Panax notoginseng flowers and seeds based on RT-DETR improvement according to claim 1, characterized in that, The specific method of model deployment in step (4) is as follows: the optimal weights of the trained model are converted into ONNX format and inference optimization is performed through TensorRT; the optimized model is deployed to the JetsonOrinNX edge computing platform, which has 157 TOPS of INT8 sparse computing power and 16GB LPDDR5 memory; a detection system consisting of an industrial camera, an edge computing platform and an LED display device is built. The industrial camera collects images or video streams of Panax notoginseng flowers and seeds in the field in real time. After the model completes end-to-end detection, the target category and location information are output to the LED display screen in real time to support intelligent harvesting and field management.