A method and counting system for detecting seedlings of the East Wind Snail.

By improving the RT-DETR detection model and the direction-gated fusion module, the accuracy and real-time issues of detecting and counting East Wind Snail seedlings have been resolved, achieving efficient and stable detection and counting in complex underwater environments, making it suitable for on-site applications in factory-scale seedling production.

CN122336795APending Publication Date: 2026-07-03HAINAN UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HAINAN UNIV
Filing Date
2026-02-11
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing technologies are insufficient for efficiently and accurately detecting and counting snail seedlings during factory-scale seedling cultivation. In particular, they suffer from large errors and poor repeatability in complex underwater environments, making it difficult to meet the needs of real-time monitoring and online display.

Method used

An improved RT-DETR detection model is adopted, combined with a directional gating fusion module, and multi-scale feature maps are extracted through convolutional neural networks to perform snail target detection and counting. This includes image preprocessing, multi-scale feature extraction, target detection and automatic counting. Real-time processing is performed using edge devices and the data is uploaded to the cloud and displayed on the terminal.

Benefits of technology

It achieves high-precision, real-time small target detection and counting in complex underwater environments, reduces the number of model parameters and computational load, is suitable for edge device deployment, and provides stable detection output and traceable data recording.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122336795A_ABST
    Figure CN122336795A_ABST
Patent Text Reader

Abstract

This invention discloses a detection method and counting system for *Sinocyclocheilus edulis* snail seedlings, belonging to the field of aquaculture detection technology. The method includes: acquiring and preprocessing snail seedling images; extracting multi-scale features through a convolutional neural network; fusing multi-scale features using a directional gating fusion module to suppress directional background interference and enhance snail seedling features; outputting detection boxes through an end-to-end detection model; filtering and statistically obtaining snail seedling counts based on confidence thresholds, and outputting visualized results. The system includes an image acquisition unit, an edge inference unit executing the method, a communication unit, and a terminal display unit, forming a closed loop of "end-edge-cloud-end". This invention addresses the characteristics of small, dense snail seedlings and strong background interference, improving detection accuracy and robustness. Simultaneously, the lightweight model is suitable for real-time edge deployment, forming a complete solution integrating hardware and software and easy operation, effectively promoting intelligent management of factory-scale seedling cultivation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of aquaculture technology, and in particular to a detection method and counting system for larvae of the Oriental Wind Snail. Background Technology

[0002] With the promotion of factory-style seedling production, the quantity and distribution of snail seedlings have become key parameters in seedling management, directly affecting on-site decisions such as feeding, oxygenation control, density assessment, and survival rate statistics. To obtain information on the number of snail seedlings, seedling farms currently generally use methods such as manual observation, sampling estimation, and experience-based judgment for assessment and recording.

[0003] While the aforementioned manual methods are simple to operate, they also have significant shortcomings. Firstly, manual counting or visual estimation is time-consuming and labor-intensive, making it difficult to support high-frequency monitoring. Secondly, the results rely on the operator's experience and are easily affected by fatigue, subjective differences, and environmental interference, leading to large errors, poor repeatability, and hindering the formation of standardized, traceable data records. Furthermore, the underwater imaging conditions at the seedling nursery are complex, often involving uneven lighting, turbidity and scattering, bright reflections, background texture interference, and dense adhesion of snails and seedlings, further complicating manual judgment and making it difficult to guarantee the stability of statistical results.

[0004] From the perspective of current engineering applications, there is still a lack of readily applicable automatic detection and counting solutions for the specific target of Dongfeng snail seedlings and their nursery site: the seedlings are small in size, semi-transparent, and have blurred boundaries, and dense adhesion and occlusion are common, and directional background structures such as tray grids can easily cause misjudgment; under these conditions, relying solely on manual or simple image analysis methods often makes it difficult to balance efficiency and accuracy, let alone meet the needs of real-time on-site monitoring and online display.

[0005] Therefore, there is an urgent need for a detection method and counting system for *Bellamya spp.* seedlings in the complex underwater environment of factory-scale seedling cultivation. This system should be able to ensure the accuracy and consistency of counting while enabling online output and system integration, thus providing reliable support for the standardized management of the seedling cultivation process. Summary of the Invention

[0006] The purpose of this invention is to provide a method for detecting seedlings of the East Wind Snail, in order to solve the problems mentioned in the background art.

[0007] The first aspect of this invention is achieved through the following technical solution: A method for detecting seedlings of the East Wind Snail includes the following steps: S1. Image acquisition steps: Acquire images containing seedlings of the Oriental Wind Snail; S2, Image preprocessing step: The image acquired in step S1 is scaled and normalized to obtain the input tensor; S3. Multi-scale feature extraction step: Extract the multi-scale feature map set of the input tensor through the convolutional neural network backbone; S4. Fusion and Target Detection Steps: An improved RT-DETR detection model is used for processing; wherein, the improvement is that the model employs a directional gating fusion module in its cross-scale feature fusion stage to fuse features from different scales, thereby suppressing directional background interference and enhancing the snail target features; the model outputs a set of detection results including bounding boxes and their confidence scores; S5. Automatic counting step: Based on a preset confidence threshold, the set of detection results is filtered, and the number of detection frames that meet the conditions is taken as the snail seedling count value. S6. Result Output Step: Output the snail count value and a visual result image with detection box annotations.

[0008] Furthermore, in step S2, the image preprocessing step includes: scaling the input image proportionally and padding the edges to a fixed size, normalizing the pixel values, and converting the image data arrangement to a channel-first format.

[0009] Furthermore, in step S3, the multi-scale feature map set includes at least a high-resolution detail feature map, a mid-scale transition feature map, and a low-resolution high-semantic feature map.

[0010] Furthermore, the direction gating fusion module constructs the direction gating map in the following manner. : The feature map input to this module is subjected to global average pooling along the height and width directions respectively to obtain the height description vector and the width description vector. The height and width description vectors are convolved and activated respectively to obtain the height weights. and width direction weight ; The height direction weight and width direction weight After expanding to the same spatial size as the feature map input to the module, element-wise multiplication is performed to obtain the orientation gating map. .

[0011] Furthermore, the direction gating fusion module utilizes the direction gating map. Perform at least one of the following operations: Will After element-wise multiplication with the feature map that serves as the lateral detail input, convolution is performed to enhance the detail features; Will As a spatial mask, it is used to constrain the fusion region of upsampled high-level semantic features.

[0012] Furthermore, the improved RT-DETR detection model is an end-to-end detection model, which does not require non-maximum suppression post-processing during the inference phase.

[0013] Furthermore, the improved RT-DETR detection model also includes a query selection module, which is used to select several positions with the lowest uncertainty from the feature sequence derived from the multi-scale feature map set based on the uncertainty metric, as the initial query for the decoder.

[0014] Furthermore, in step S5, the snail count value n is calculated as follows: ,in For the first Confidence of each detection box, To preset the reliability threshold, For indicator functions, This represents the number of candidate boxes.

[0015] Furthermore, steps S1 to S5 of the method are executed by an inference unit deployed on an edge device, which sends the snail count value and the visualization result image to a cloud server and a terminal display device via wireless communication.

[0016] The second aspect of the present invention is achieved through the following technical solution: A counting system for *Ichthyophthirius multifiliis* larvae, the system being used to perform the method mentioned in the second aspect, comprising: Image acquisition unit, used to acquire images containing snail seedlings of the East Wind Snail; The edge inference unit, connected to the image acquisition unit, is used to perform image preprocessing, feature extraction, target detection, and automatic counting, and to generate counting results and labeled images. A communication unit, connected to the edge inference unit, is used for data transmission; The terminal display unit is used to receive and display the snail count value and the visualization result image.

[0017] Compared with the prior art, the beneficial effects achieved by the present invention are as follows: 1. Enhanced small target detection capability. This invention achieves higher overall detection performance in the task of detecting dense small targets such as snail seedlings, taking into account overall accuracy, strict positioning accuracy, and small target indicators, and can provide more stable and reliable detection output for subsequent automatic counting (see Table 1).

[0018] 2. Lightweight and superior real-time performance. While maintaining the advantages of detection performance, this invention significantly reduces the number of model parameters and computational load, and has higher computational efficiency than typical RT-DETR baselines, making it more suitable for deployment on edge devices to achieve real-time detection and online counting (see Table 2).

[0019] 3. Improved separability for dense targets. The feature responses of this invention are more concentrated on the target body and edge contours, resulting in stronger suppression of background noise and effectively reducing the problem of adjacent target responses sticking together, thereby improving separability in dense target scenes (see...). Figure 6 ).

[0020] 4. Enhanced robustness under complex interference conditions. Even under typical interference scenarios such as dense occlusion, reflection, and color shift, this invention maintains high detection integrity and bounding box localization consistency, effectively reducing issues such as false background detections, duplicate detection boxes, and missed detections in dense areas (see...). Figure 7 ).

[0021] 5. User-friendly for engineering implementation and closed-loop application. This invention supports edge inference and terminal visualization, and can output detection and counting results in real time and record statistical information such as timestamps, facilitating on-site operation, result traceability, and remote viewing, thus meeting the needs of factory-scale seedling production applications (see...). Figure 8 ). Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only preferred embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 This is a flowchart illustrating a method for detecting seedlings of the East Wind Snail provided by the present invention.

[0024] Figure 2 This is a schematic diagram of snail seedling collection for a method of detecting snail seedlings of the East Wind Snail provided by the present invention.

[0025] Figure 3 A schematic diagram of the DGF-RT-DETR model framework for a detection method for East Wind Snail seedlings provided by the present invention.

[0026] Figure 4 This is a schematic diagram of the tensor processing process for a method of detecting snail seedlings of the East Wind Snail provided by the present invention.

[0027] Figure 5 This is a schematic diagram of the internal structure design of the detection and counting support device provided by the present invention.

[0028] Figure 6 This is a schematic diagram of a counting system framework for detecting snail seedlings of the East Wind Snail, provided by the present invention.

[0029] Figure 7 This is a schematic diagram illustrating the visualization and comparison of heat maps provided by the present invention.

[0030] Figure 8 This is a schematic diagram illustrating the subjective target detection comparison results provided by the present invention.

[0031] Figure 9 This is a schematic diagram illustrating the visualization of actual detection and counting results provided by the present invention.

[0032] Among them, Figure 6 In the diagram, a is the image acquisition unit, b is the communication unit, c is the edge inference unit, d is the detection and counting support device, e is the cloud service unit, and f is the terminal display unit. Detailed Implementation

[0033] To make the objectives, technical solutions, and advantages of the present invention more apparent, exemplary embodiments according to the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are merely a part of the embodiments of the present invention, and not all of the embodiments of the present invention. It should be understood that the present invention is not limited to the exemplary embodiments described herein. Based on the embodiments of the present invention described herein, all other embodiments obtained by those skilled in the art without inventive effort should fall within the protection scope of the present invention.

[0034] In the following description, numerous specific details are set forth in order to provide a more thorough understanding of the invention. However, it will be apparent to those skilled in the art that the invention can be practiced without one or more of these details. In other instances, certain technical features well-known in the art have not been described in order to avoid obscuring the invention.

[0035] It should be understood that the invention can be embodied in various forms and should not be construed as being limited to the embodiments set forth herein. Rather, providing these embodiments will make the disclosure thorough and complete, and will fully convey the scope of the invention to those skilled in the art.

[0036] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. When used herein, the singular forms “a,” “an,” and “the” are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the terms “comprising” and / or “including,” when used in this specification, identify the presence of the stated features, integers, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups. When used herein, the term “and / or” includes any and all combinations of the associated listed items.

[0037] To fully understand this invention, a detailed structure will be presented in the following description to illustrate the technical solution proposed by this invention. Optional embodiments of the invention are described in detail below; however, in addition to these detailed descriptions, the invention may have other embodiments.

[0038] Example 1 See Figure 1-9 A method for detecting seedlings of the East Wind Snail includes the following steps: S1. Image acquisition steps: Acquire images containing seedlings of the Oriental Wind Snail; S2, Image preprocessing step: The image acquired in step S1 is scaled and normalized to obtain the input tensor; S3. Multi-scale feature extraction step: Extract the multi-scale feature map set of the input tensor through the convolutional neural network backbone; S4. Fusion and Target Detection Steps: An improved RT-DETR detection model is used for processing; wherein, the improvement is that the model employs a directional gating fusion module in its cross-scale feature fusion stage to fuse features from different scales, thereby suppressing directional background interference and enhancing the snail target features; the model outputs a set of detection results including bounding boxes and their confidence scores; S5. Automatic counting step: Based on a preset confidence threshold, the set of detection results is filtered, and the number of detection frames that meet the conditions is taken as the snail seedling count value. S6. Result Output Step: Output the snail count value and a visual result image with detection box annotations.

[0039] In step S2, the image preprocessing step includes: scaling the input image proportionally and padding the edges to a fixed size, normalizing the pixel values, and converting the image data arrangement to a channel-first format.

[0040] In step S3, the multi-scale feature map set includes at least a high-resolution detail feature map, a medium-scale transition feature map, and a low-resolution high-semantic feature map.

[0041] The directional gating fusion module constructs the directional gating map in the following manner. : The feature map input to this module is subjected to global average pooling along the height and width directions respectively to obtain the height description vector and the width description vector. The height and width description vectors are convolved and activated respectively to obtain the height weights. and width direction weight ; The height direction weight and width direction weight After expanding to the same spatial size as the feature map input to the module, element-wise multiplication is performed to obtain the orientation gating map. .

[0042] The directional gating fusion module utilizes the directional gating map. Perform at least one of the following operations: Will After element-wise multiplication with the feature map that serves as the lateral detail input, convolution is performed to enhance the detail features; Will As a spatial mask, it is used to constrain the fusion region of upsampled high-level semantic features.

[0043] The improved RT-DETR detection model is an end-to-end detection model, which does not require nonmaximum suppression post-processing during the inference phase.

[0044] The improved RT-DETR detection model also includes a query selection module, which is used to select several positions with the lowest uncertainty from the feature sequence derived from the multi-scale feature map set based on the uncertainty metric, as the initial query for the decoder.

[0045] In step S5, the snail count value n is calculated as follows: ,in For the first Confidence of each detection box, To preset the reliability threshold, For indicator functions, This represents the number of candidate boxes.

[0046] Steps S1 to S5 of the method are executed by an inference unit deployed on an edge device, which sends the snail count value and the visualization result image to a cloud server and a terminal display device via wireless communication.

[0047] For example, the specific implementation of image acquisition in step S1 is as follows: Input: The mobile app issues a "Start Detection" command. Processing: The edge device receives the command and uses the camera to acquire snail seedling image frames. Output: Image frames Save to the specified directory used for model inference.

[0048] The specific implementation method for image preprocessing in step S2 is as follows: Input: The acquired raw image frames .

[0049] Processing: Image acquisition A uniform input normalization process is performed, using proportional scaling and edge-padding techniques to adjust the input image to a fixed input size of 640×640. Pixel normalization is also performed, and the image data is converted from HWC (height×width×channel) arrangement to CHW (channel×height×width) arrangement, resulting in a network input tensor that can be directly input into the detection model. .

[0050] Output: Obtain the model input tensor ,in 3 represents the batch size; 3 represents the number of image color channels. and These are the height and width of the input image, respectively (adjusted during implementation). )) The specific implementation of multi-scale feature extraction in step S3 is as follows: Input: tensor .

[0051] Processing: Input the model backbone network and extract multi-scale features for dense small object detection to obtain a set of feature maps with different downsampling scales.

[0052] Output: Multi-scale features ,in For high-resolution detail features, This is a mesoscale transitional feature. It is a low-resolution, high-semantic feature.

[0053] The specific implementation method for the fusion and target detection in step S4 is as follows: Input: Multi-scale features .

[0054] Processing: Cross-scale fusion and detection inference are performed on multi-scale features. The cross-scale fusion uses the Directional Gated Fusion Module (DGF) to selectively fuse lateral details and upsampled semantics to suppress directional background interference and enhance the representation of dense small targets. The detection results are then output through an end-to-end one-to-one detection structure.

[0055] Output: Set of detection boxes ,in For bounding box, This corresponds to the confidence level.

[0056] The specific implementation method for automatic counting and statistical output in step S5 is as follows: Input: Collection of detection boxes .

[0057] Processing: Threshold filtering and aggregate counting are performed on the detection results to ensure they meet the confidence threshold. The number of detection boxes is used as the snail count result for the current frame.

[0058] Output: Counting results The system will also collect the detection results images and save them to a designated folder for later upload to the terminal visualization interface for result display.

[0059] The specific implementation method for the result output of step S6 is as follows: Input: Count result And the image of its detection results.

[0060] Output: A real-time detection and counting display interface for on-site management, and traceable data records.

[0061] The input-output model is based on the end-to-end detection paradigm of RT-DETR. While maintaining the original hierarchical topology and output scale, the cross-scale fusion operator is replaced with directional gated fusion DGF, thereby constructing a detection model DGF-RT-DETR (e.g., for densely packed small targets like snails and seedlings and directional interference scenarios) for DF-type snails. Figure 3 The model takes a single frame image as input, and after Backbone feature extraction, hybrid encoder and DGF cross-scale fusion enhancement and one-to-one decoding prediction, it directly outputs bounding boxes and confidence sets, providing stable detection results for subsequent automatic counting.

[0062] Input: Preprocessed input tensor .

[0063] Output: Set of detection boxes for the current frame .

[0064] Multi-scale feature extraction module Input tensor The input is processed through a backbone network for progressive feature extraction. The backbone network consists of multiple layers of convolutional coding units, which progressively reduce spatial resolution and enhance semantic expressiveness through stride convolution, thus forming a pyramid-shaped multi-scale representation. The backbone network outputs a multi-scale feature set. Its spatial resolution decreases from high to low to cover the representation needs of small targets, general targets and larger-scale structures.

[0065] in, For high-resolution detail features, it can more fully preserve the edge contours and texture details of small snail seedling targets; It serves as a mesoscale transition feature, used to provide a continuous information bridge between details and semantics; This invention utilizes low-resolution, high-semantic features to provide global scene priors and suppress spurious activations caused by background interference such as reflective stripes. Furthermore, to ensure effective interaction between features of different scales in subsequent hybrid encoders and cross-scale fusion, this invention employs convolutional operations... Channel alignment is performed to achieve interface consistency without changing the spatial dimensions at each scale, which facilitates stable execution of subsequent cross-scale fusion and one-to-one decoding prediction.

[0066] Hybrid encoders and cross-scale fusion To balance global semantics and local details under real-time constraints, this invention introduces a self-designed Directional Gated Fusion Module (DGF) in the cross-scale fusion stage, specifically modifying the fusion operator. Given the high resolution and large number of tokens in low-level features, the presence of repetitive textures in the seedling cultivation scene, and the limitations of mobile computing power, this invention only considers the top-level features... The global semantic model is performed once as a "semantic anchor" to control inference latency and memory usage, and to provide a stable global prior for subsequent cross-scale fusion.

[0067] (1) Top-level first global semantic modeling (AIFI) Here, it is only in the top-level features Perform a global relation modeling operation to form semantic anchors for cross-scale fusion: in It is a two-dimensional position encoding. For the sake of the bulls' self-attention, This refers to the top-level semantic features after writing back.

[0068] (2) Cross-scale fusion (CCFF) Next to Perform top-down cross-scale fusion to obtain the detection pyramid. And maintain the original hierarchical topology and output scale unchanged:

[0069] here This means that under a given cross-scale connection method, the conventional convolutional fusion operator is replaced with the directional gated fusion DGF proposed in this invention to suppress directional interference such as background noise and enhance fine-grained cues such as snail edges and textures. To address the issue of uneven candidate location quality caused by dense occlusion and reflective interference in snail seedling images, this step prioritizes more reliable locations as the initial decoding query by using uncertainty measurement, thereby reducing duplicate frames and false detections caused by noisy queries participating in decoding.

[0070] First, the fused multi-scale features are... pass Projection mapping to a unified dimension And flatten and splice them together to form a global memory sequence: Based on uncertainty measurement from Select Use the most reliable location as the initial query: This practical approach is used to reduce unstable queries in densely occluded and weakly textured areas, thereby reducing the impact of redundancy and background triggering on the decoding process from the source.

[0071] Decoder & Head decoder with For input, via Layer-by-layer updates achieve progressive refinement and are integrated with global memory. Interactive evidence reading: After the above steps are completed, the final inference stage takes the output of the last layer as the final prediction. This ultimately forms a set of detection boxes. Furthermore, there is no need for NMS filtering during the inference phase; the model directly outputs one-to-one detection results, thereby avoiding excessive sensitivity to threshold settings in the case of densely clustered objects and reducing duplicate bounding boxes generated by overlapping targets.

[0072] Directional Gating Fusion Module (DGF) To address the challenges of detecting *Bellamya aegyptiacus* seedlings, such as their small size, dense distribution, and tendency for individual snails to adhere and obscure each other, as well as interference from structured pseudo-responses in the row and column directions due to background raster textures, reflective stripes, and water background textures, this invention introduces a self-designed Directional-Gated Fusion (DGF) module into the cross-scale fusion process. This module selectively enhances effective details and suppresses directional interference. Its feature tensor processing is as follows: Figure 4 As shown.

[0073] Input / Output and Operating Mode The input features are: .

[0074] DGF employs two working modes: (1) Recalibration mode: outputs recalibration features. (1) Used for lateral detail enhancement; (2) Gating mode: output spatial gating mask , used to constrain the passage area of ​​upsampling semantics.

[0075] Directional gating weight construction This section first establishes structural differences between row and column directions for explicit modeling, based on the input features. By performing strip statistics, we obtain a one-dimensional description of the column and row directions:

[0076] Subsequently, respectively and Apply a lightweight convolution and then pass it through a sigmoid function to obtain the orientation weights. Multiplying the two together yields the direction-gated graph: in This represents element-wise multiplication. and They have the same spatial dimensions and are used to suppress directional interference.

[0077] Define two output modes (1) Recalibration mode is used for enhancing details of lateral branches: (2) Gated mode is used to generate spatial masks:

[0078] Cross-scale selective fusion and output At the level In the fusion, let the horizontal detail branches be... The upsampling semantic branch is First, detailed candidates are obtained through lateral branches. The gating mask is obtained from the semantic branch. Then, pixel-level selection and residual synthesis are performed:

[0079] in This is a lightweight convolutional refinement operator used to mitigate upsampling aliasing and enhance local consistency. Through the aforementioned gating selection mechanism, the DGF module can suppress directional background pseudo-activations and preserve effective details of small targets without significantly increasing computational overhead, thereby improving the stability and accuracy of detection output in dense scenes.

[0080] Counting output For the first Frame image, set of detection boxes output by the (DGF-RT-DETR) model:

[0081] in For bounding box, For confidence level, This refers to the number of candidate boxes. This invention uses a fixed confidence threshold. (The value can be adjusted to 0.4, 0.5, 0.6, etc., depending on the actual accuracy requirements, after determining the validation set.) The detection results are then filtered, and the number of detection frames that meet the threshold is used as the snail seedling count value.

[0082] The output includes: count value The filtered set of detection boxes, and the visualization result of the overlaid detection boxes.

[0083] Example 2 See Figure 1-9 A counting system for snail seedlings of the East Wind Snail, the system being used in the method described in Embodiment 1, comprising: Image acquisition unit, used to acquire images containing snail seedlings of the East Wind Snail; The edge inference unit, connected to the image acquisition unit, is used to perform image preprocessing, feature extraction, target detection, and automatic counting, and to generate counting results and labeled images. A communication unit, connected to the edge inference unit, is used for data transmission; The terminal display unit is used to receive and display the snail count value and the visualization result image.

[0084] For example, such as Figure 6 As shown, the present invention provides an "end-cloud-end" deployment and display scheme for online detection and counting of snail seedlings of the East Wind Snail. The system mainly includes: (a) an image acquisition unit, (b) a communication unit, (c) an edge inference unit, (d) a detection and counting support device, (e) a cloud service unit, and (f) a terminal display unit.

[0085] (1) Image acquisition unit The image acquisition unit is used to acquire image frames of the snail seedling sampling area. In specific implementations, the image acquisition unit is a USB high-definition camera with a resolution of 1080p and a frame rate of 30 FPS, and is set with a fixed focal length and constant exposure parameters to reduce the impact of ambient light fluctuations on the detection results. The image acquisition unit is installed upside down in the equipment compartment of the detection and counting device, maintaining a fixed working distance from the sampling tray.

[0086] (2) Detection counting support device The detection and counting support device is used to provide a standardized acquisition environment. In one embodiment, the detection and counting support device is a closed image acquisition and counting box, the specific internal structure of which is shown in the schematic diagram below. Figure 5 As shown, it adopts a two-layer structure: the upper layer is the equipment compartment, used to fix the camera, edge inference unit and communication unit; the lower layer is a drawer-type seedling sampling tray, used to quickly load the sampling tray and form a standardized acquisition space with a light-shielding environment and uniform lighting, so as to reduce the interference of reflection, shadow and background texture changes on detection and counting, and facilitate cleaning and maintenance.

[0087] (3) Marginal reasoning unit The edge inference unit is used to perform image preprocessing, detection inference, and counting output locally. In implementation, the edge inference unit is an RK3588 embedded computing board (8 GB memory, 64 GB storage), which performs 640×640 image resizing and normalization locally, calls the deployed snail detection model for inference, and outputs the detection box overlay and counting results. It can also generate device operating status information (including but not limited to: device identifier, timestamp, inference time, network status, etc.).

[0088] (4) Communication unit and cloud service unit The communication unit is used to enable data interaction between the edge device and the cloud. In one embodiment, the communication unit is a USB wireless communication module: it establishes a Wi-Fi hotspot (AP) on-site for mobile devices to access, and periodically reports the counting results and device status to the cloud service unit via a cellular network (4G). The cloud service unit can be deployed on a cloud server platform, responsible for message access, data parsing, result storage, and interface services, and can also perform device authentication and remote policy distribution. The reporting protocol uses the MQTT protocol as an example, which is not intended to be limiting.

[0089] (5) Terminal display unit and closed-loop process The terminal display unit is used to display the detection and counting results in real time and provide historical traceability capabilities. It primarily uses a WeChat mini-program for easy implementation and deployment. In a specific embodiment, the terminal display interface can display the detection overlay image, counting results, device status, and timestamp in real time, and supports historical record queries. The system operates in a closed-loop "end-cloud-end" manner: the operator initiates a "start detection" command through the terminal, which is forwarded to the edge inference unit via the cloud to trigger camera acquisition; the edge unit completes preprocessing and model inference, generating the detection overlay image and counting results; the results are uploaded to the cloud for persistent storage via the communication unit and simultaneously transmitted back to the terminal for display, realizing a closed-loop process of "mini-program command → end-side acquisition and inference → cloud upload and display."

[0090] (6) Offline caching and retransmission In the event of network anomalies, the edge device will cache the counting results, detection overlay map, and key status information locally, and automatically retransmit them after the network is restored to ensure data integrity and traceability.

[0091] The camera type, wireless communication method, edge computing platform, cloud deployment method, and terminal display format mentioned above can all be replaced with equivalent ones according to the actual application, as long as the closed-loop function of online detection and counting on the edge, result reporting, and terminal display traceability is achieved.

[0092] Method gain effect: Table 1 Comparison Results of Objective Indicators

[0093] As shown in Table 1, the method of the present invention achieves superior detection performance in snail seedling detection tasks. Specifically, F1 is 89.32, AP@0.50 is 93.45, AP@0.75 is 84.45, and AP@[0.50:0.95] is 72.48, with a small target index mAP. S The accuracy reached 49.12. Compared with the comparison models (Faster R-CNN, YOLO series and RT-DETR series), the present invention performs better in terms of overall accuracy, strict positioning accuracy and small target detection capability, thus providing a more stable and reliable detection output for subsequent automatic counting.

[0094] Table 2 Comparison of Parameter Number and Computational Complexity

[0095] As shown in Table 2, the method of this invention has 14.72M parameters and 38.7 GFLOPs computational cost. Compared to RT-DETR-R18 (18.83M, 66.26 GFLOPs), the number of parameters is reduced by approximately 21.8%, and the computational cost is reduced by approximately 31.2%; compared to RT-DETR-R34 (31.11M, 88.8 GFLOPs), the number of parameters is reduced by approximately 52.7%, and the computational cost is reduced by approximately 56.4%. Therefore, this invention is more suitable for deployment on edge devices to achieve real-time detection and online counting.

[0096] like Figure 7 As shown, the heatmap feature response of the method of the present invention is mainly concentrated on the snail body and its edge contour, and the background noise suppression effect is better. In contrast, the response of the baseline model is more dispersed, and there is obvious response adhesion between adjacent targets. The above results show that the present invention can effectively improve the separability and localization stability of dense targets.

[0097] like Figure 8As shown, under typical interference conditions such as dense patterns, occlusion, reflection, and color shift, the method of this invention can still maintain good detection integrity and box positioning consistency. The comparative method is prone to background false detections or duplicate boxes under the same environment, and is prone to missed detections or box merging in densely clustered areas. Therefore, this invention demonstrates stronger robustness to complex underwater imaging interference, providing more reliable detection input for subsequent automatic counting. like Figure 9 As shown, the mini-program interface is automatically generated from the edge inference results. The upper part displays an overlay of the snail seedling detection frame for the current frame, while the lower part displays statistical information such as the count value for this frame. On-site personnel can trigger the detection and view the results in real time through lightweight interactions such as "Start Detection," achieving online counting and visual feedback. This display method supports result traceability and remote viewing, meeting the needs of on-site applications in factory-style seedling cultivation.

[0098] Supplementary explanations for the implementation of steps one and two To facilitate understanding of the implementation process of this invention and verification of its feasibility by those skilled in the art, supplementary explanations are provided below regarding data preparation, training, and evaluation in conjunction with embodiments. It should be understood that the following content is for illustrative purposes only and does not constitute a limitation on the scope of protection of this invention.

[0099] Data sources and collection scenarios The data collection targets for Implementation 1 and 2 were image data of snail seedlings under large-scale seedling cultivation conditions. To cover the changes in background, lighting, and seedling density during actual production and to reduce the risk of domain offset during model deployment, the collection process covered at least two representative seedling cultivation scenarios and collected data at different times, such as morning, noon, and evening, to include differences in lighting conditions and operational rhythms; at the same time, it covered different density ranges and various background texture scenarios, thereby improving data representativeness and cross-scenario generalization ability.

[0100] Data preprocessing strategy To ensure consistency between training and edge deployment, and to avoid potential damage to the edges and textures of small targets, steps one and two do not employ traditional image enhancement processes such as denoising, dehazing, and histogram equalization. Instead, only necessary input normalization steps are performed, including but not limited to: (1) Uniform size: The image is adjusted to a fixed input size (e.g., 640×640) by using a proportional scaling method. (2) Pixel normalization: Normalize the pixel values ​​and convert the image data into a tensor format acceptable to the model.

[0101] The above strategy can preserve the natural lighting, background and density variations in real-world scenes, while reducing latency and maintenance costs caused by additional image processing pipelines at the edge.

[0102] Dataset labeling and partitioning After data deduplication and cleaning, steps one and two were performed to obtain 3012 high-quality image samples. The dataset was divided into training, validation, and test sets, with proportions of, for example, 70%, 20%, and 10%, and could be further divided by collection batch or time period to reduce data leakage caused by adjacent frames. Single-class annotation was used (category named "snail"), and the YOLO format was used as an example for the output. For occluded or densely clustered individuals, the principle of "annotate only those whose subjects are identifiable" was followed to improve the consistency and usability of annotations in dense scenes. Annotation could be completed using open-source annotation tools, and double-checking or cross-validation mechanisms could be employed to improve annotation accuracy and consistency.

[0103] Training and inference parameters Steps one and two involve training the model on a deep learning training platform, which can be implemented using the PyTorch framework. Training hyperparameters can be set, for example, to: optimizer AdamW, base learning rate 1×10⁻⁶. -4 The system employs a cosine annealing learning rate strategy, 200 training epochs, a batch size of 8, and an input size of 640×640, and can enable mixed precision training (AMP). This invention uses an end-to-end one-to-one detection paradigm for training and inference. The inference phase does not require NMS post-processing, thus reducing the sensitivity of densely packed scenes to threshold selection and overlap suppression strategies, and mitigating the instability of repeated bounding boxes. The above training platform, framework, and parameter settings can all be adjusted according to actual computing power conditions and do not constitute a limitation.

[0104] Evaluation indicators To simultaneously evaluate detection accuracy and deployment availability, this embodiment uses F1, AP@0.50, AP@0.75, AP@[0.50:0.95] and scale indices ( , The detection performance was evaluated, and the deployment effect was evaluated using the number of parameters (Params) and the computational cost (GFLOPs). The above description is only a preferred embodiment of the present invention and is not intended to limit 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 method for detecting of baby snails of Aplysia, characterized by, Includes the following steps: S1. Image acquisition steps: Acquire images containing seedlings of the Oriental Wind Snail; S2, Image preprocessing step: The image acquired in step S1 is scaled and normalized to obtain the input tensor; S3. Multi-scale feature extraction step: Extract the multi-scale feature map set of the input tensor through the convolutional neural network backbone; S4. Fusion and Target Detection Steps: An improved RT-DETR detection model is used for processing; wherein, the improvement is that the model employs a directional gating fusion module in its cross-scale feature fusion stage to fuse features from different scales, thereby suppressing directional background interference and enhancing the snail target features; the model outputs a set of detection results including bounding boxes and their confidence scores; S5. Automatic counting step: Based on a preset confidence threshold, the set of detection results is filtered, and the number of detection frames that meet the conditions is taken as the snail seedling count value. S6. Result Output Step: Output the snail count value and a visual result image with detection box annotations.

2. The detection method according to claim 1, characterized in that, In step S2, the image preprocessing step includes: scaling the input image proportionally and padding the edges to a fixed size, normalizing the pixel values, and converting the image data arrangement to a channel-first format.

3. The detection method according to claim 1, characterized in that, In step S3, the multi-scale feature map set includes at least a high-resolution detail feature map, a medium-scale transition feature map, and a low-resolution high-semantic feature map.

4. The detection method according to claim 1, characterized in that, The directional gating fusion module constructs the directional gating map in the following manner. : The feature map input to this module is subjected to global average pooling along the height and width directions respectively to obtain the height description vector and the width description vector. The height and width description vectors are convolved and activated respectively to obtain the height weights. and width direction weight ; The height direction weight and width direction weight After expanding to the same spatial size as the feature map input to the module, element-wise multiplication is performed to obtain the orientation gating map. .

5. The detection method according to claim 4, characterized in that, The directional gating fusion module utilizes the directional gating map. Perform at least one of the following operations: Will After element-wise multiplication with the feature map that serves as the lateral detail input, convolution is performed to enhance the detail features; Will As a spatial mask, it is used to constrain the fusion region of upsampled high-level semantic features.

6. The detection method according to claim 1, characterized in that, The improved RT-DETR detection model is an end-to-end detection model, which does not require nonmaximum suppression post-processing during the inference phase.

7. The detection method according to claim 6, characterized in that, The improved RT-DETR detection model also includes a query selection module, which is used to select several positions with the lowest uncertainty from the feature sequence derived from the multi-scale feature map set based on the uncertainty metric, as the initial query for the decoder.

8. The detection method according to claim 1, characterized in that, In step S5, the snail count value n is calculated as follows: ,in For the first Confidence of each detection box, To preset the reliability threshold, For indicator functions, This represents the number of candidate boxes.

9. The detection method according to claim 1, characterized in that, Steps S1 to S5 of the method are executed by an inference unit deployed on an edge device, which sends the snail count value and the visualization result image to a cloud server and a terminal display device via wireless communication.

10. A counting system for *Ichthyophthirius multifiliis* larvae, the system being used to perform the detection method as described in any one of claims 1 to 9, characterized in that, include: Image acquisition unit, used to acquire images containing snail seedlings of the East Wind Snail; The edge inference unit, connected to the image acquisition unit, is used to perform image preprocessing, feature extraction, target detection, and automatic counting, and to generate counting results and labeled images. A communication unit, connected to the edge inference unit, is used for data transmission; The terminal display unit is used to receive and display the snail count value and the visualization result image.