Nematode motion feature analysis method based on deep learning

By using a deep learning-based method for analyzing the movement characteristics of nematodes, we have achieved automatic identification and dynamic trajectory tracking of individual nematodes, quantified their activity range and curvature, solved the problems of automation and accuracy in existing nematode behavior analysis, and adapted to complex backgrounds and varied postures.

CN121120702APending Publication Date: 2025-12-12FUJIAN POLYTECHNIC OF INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511311013.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-15
Publication Date
2025-12-12

AI Technical Summary

Technical Problem

Existing methods for analyzing nematode behavior have limited support in dynamic trajectory tracking, individual identity preservation, and group behavior modeling. They also lack automatic quantification methods for behavioral characteristics such as nematode activity range and aggregation state. Traditional methods are difficult to adapt to the observation of nematodes in complex backgrounds and with changing postures.

Method used

A deep learning-based approach is used for individual nematode identification and trajectory tracking. The bounding rectangle algorithm is combined to quantify the range of activity, calculate the nematode curvature and population aggregation, and automatically identify the head and tail positions of the nematodes without the need for manual correction.

Benefits of technology

It achieves high-precision automatic identification and trajectory tracking of nematodes in complex backgrounds, and simultaneously completes automatic labeling of individual heads and tails, and calculation of body length and curvature, reducing the need for manual intervention and improving computational efficiency and analytical accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121120702A_ABST
    Figure CN121120702A_ABST
Patent Text Reader

Abstract

The invention discloses a nematode motion characteristic analysis method based on deep learning, and relates to the technical field of nematode research, and the method comprises the following steps: S1, carrying out the trajectory tracking and activity range calculation of nematodes; s2, identifying and positioning the head and the tail of the nematode; s3, quantifying the body posture of the nematode, and calculating the RDL curvature of the nematode; and S4, carrying out group aggregation detection on the nematodes. According to the method, high-precision automatic identification and trajectory tracking of the nematodes under a complex background and a multi-target shielding scene are realized, automatic labeling of heads and tails of individuals, calculation of body lengths and curvatures and quantitative analysis of activity ranges and aggregation states can be synchronously completed, and manual intervention requirements are remarkably reduced. Compared with an existing method, the method has the advantages that continuous tracking stability and calculation efficiency in a multi-target video sequence are improved, and unified modeling and quantification of nematode movement behaviors and morphological changes are achieved for the first time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of nematode research technology, specifically a method for analyzing the movement characteristics of nematodes based on deep learning. Background Technology

[0002] While existing methods for nematode behavior analysis have made progress in image segmentation and individual identification, several technical shortcomings remain. Current methods largely rely on deep learning-based object detection models (such as RetinaNet and Faster R-CNN) for nematode localization and population counting, or combine image thresholding for preliminary contour extraction. However, they offer limited support for dynamic trajectory tracking, individual identity preservation, and group behavior modeling. Especially in long-term video sequences, traditional tracking methods often require manual annotation of head and tail positions, resulting in a large annotation workload, poor scalability, and a lack of automated methods for quantifying behavioral characteristics such as nematode activity range and aggregation states.

[0003] Furthermore, the quantification of nematode curvature and growth status remains significantly insufficient. Current research largely focuses on static morphological parameters such as body length and width, neglecting the dynamic relationship between head and tail displacement and overall posture, making it difficult to accurately reflect the complex behavioral characteristics of nematodes in their natural environment. Traditional methods generally assume that nematodes have smooth and continuous outlines and approximately straight body axes, which is difficult to adapt to real-world observation images with strong background interference and varied postures.

[0004] Therefore, there is an urgent need to construct a method for analyzing the movement characteristics of nematodes that integrates deep learning. This method can not only automatically identify individual nematodes and track their temporal trajectories, but also extract key parameters such as body length, head and tail position, and curvature, thereby achieving efficient and unsupervised quantitative analysis of nematode growth status and group behavior. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention provides a deep learning-based method for analyzing the movement characteristics of nematodes. It utilizes a target localization model to automatically identify individual nematodes, correlates multiple frame trajectories, and quantifies their activity range using a bounding rectangle algorithm. This method enables the localization of multiple nematodes and the calculation of their outlines, accurately determining the positions of the head and tail without manual correction, thus allowing for the observation of nematode growth. The curvature of the nematodes is calculated by acquiring morphological data and quantifying the degree of body curvature as the ratio of total body length to the straight-line distance between the head and tail. Furthermore, the method detects nematode aggregation by acquiring head trajectory data for calculation, thereby understanding nematode behavior without the need for manual observation, thus solving the problems mentioned in the background technology.

[0006] To achieve the above objectives, the present invention provides the following technical solution: In a first aspect, embodiments of the present invention provide a method for analyzing the motion features of nematodes based on deep learning, comprising the following steps: S1. Tracking the trajectory and calculating the activity range of nematodes based on deep learning models; S2. Identify and locate the head and tail of the nematode; S3. Quantify the body posture of nematodes, construct a method for calculating the body length-to-tail distance ratio (RDL) curvature, and calculate the RDL curvature of nematodes. S4. Based on the nematode head trajectory located in step S2, perform nematode aggregation detection.

[0007] To further optimize this technical solution, in step S1: Nematode trajectory tracking, including: Use OpenCV to read videos / images and process them frame by frame. Locate the target, obtain the center position and ID number of the nematode, record and update the trajectory points to form the activity trajectory, and calculate the activity trajectory of all nematodes. The calculation of nematode activity range includes: Obtain the nematode's activity trajectory, calculate the maximum and minimum coordinates, and determine the minimum bounding rectangle as the nematode's activity range.

[0008] To further optimize this technical solution, in the nematode trajectory tracking: This code uses the OpenCV library to read video or image files frame by frame. Video files are in video format, and image files are in image format. Each i-frame of the file is recorded as... ; The deep learning model processes each frame Perform target localization and obtain the center coordinates (x, y) of all nematodes in the image and their unique identification number (ID); The system will use the first frame All information about active nematodes appearing in the sequence is stored. In the meantime, subsequent processing will only target Track the trajectory of the nematode ID within the nematode; Continuously record and update the trajectory points for each nematode ID. , Representing the position of the j-th nematode in the i-th frame, the trajectory point... The data are compiled and ultimately formed into a complete map of the individual nematode activity trajectories, distinguished by different colors.

[0009] To further optimize this technical solution, in the calculation of the nematode activity range: After obtaining the individual activity trajectories of all nematodes, the system will determine the center position of the j-th nematode across all frames. =( , Extracted by calculating the maximum value of the coordinates in the nematode's activity trajectory. , ) and minimum value ( Automatically determine the minimum bounding rectangle of the nematode's movement trajectory. =(( , ),( , This allows us to obtain a precisely quantified range of activity for each nematode.

[0010] To further optimize this technical solution, in step S2, the identification and localization of the nematode's head and tail include: Image data of nematodes is obtained by frame capture and then image preprocessing is performed. Contour extraction and angle calculation are performed to extract the body edge contour of the nematode and locate the head and tail endpoints; Based on the head and tail endpoints, the head and tail of the nematode can be identified.

[0011] To further optimize this technical solution, the image preprocessing includes: The nematode image data obtained by frame capture is first grayscaled, then binarized. Subsequently, through erosion and dilation operations, the cavities inside the nematode's body in the image data are filled and the edges are smoothed to obtain a clear single-channel binarized image after preprocessing.

[0012] Further optimization of this technical solution includes the positioning and identification of the head and tail endpoints, including: The body contour of the nematode is extracted using OpenCV from the preprocessed image data. Any point B on the contour and its adjacent previous point A and next point C are selected, and the included angle is ∠ABC. A discriminant value y is preset, y=180°-2∠ABC; The formula for calculating the included angle ∠ABC is as follows: The beginning and end points of the contour are the sharpest, with the included angle ∠ABC being much less than 180°, and the calculated y value is significantly greater than 0; the non-beginning and end points of the contour are relatively smooth, with the included angle ∠ABC being close to 180°, and the calculated y value is less than 0°. By traversing all points on the contour and calculating the y-value, the two points with the largest y-values ​​are identified as the head and tail endpoints of the nematode. By comparing the coordinates of the current frame with those of the previous frame, the point with the largest displacement distance from the corresponding endpoint of the previous frame is determined to be the head, and the other end is the tail.

[0013] To further optimize this technical solution, the method for calculating the RDL curvature in step S3 includes: Calculation of nematode body length (bodyLen); Calculate the straight-line distance between the head and tail points, headTailDist. RDL curvature index calculation.

[0014] To further optimize this technical solution, the formula for calculating the nematode body length (bodyLen) is as follows: in, : The actual body length of the j-th nematode; The number of points in the outline; : The two-dimensional coordinates of the k-th contour point; : The two-dimensional coordinates of the (k+1)th contour point; Euclidean distance is used to calculate the straight-line distance between the k-th point and the (k+1)-th point, which is an approximate value of the arc length of the contour segment. Since the nematode's outline is a closed-loop structure, the calculated body length will include the redundant portion between the head and tail. To obtain an approximate length of the nematode's centerline, we take... That is, the simplified outline is approximately equivalent to the length estimate along the body's central axis; The formula for calculating the straight-line distance between the head and tail, headTailDist, is as follows: in, The straight-line distance between the head and tail of the j-th nematode; : The head coordinates of the j-th nematode; : The coordinates of the tail of the j-th nematode; The formula for calculating the RDL curvature index is shown below: in, : RDL curvature index of the j-th nematode; This indicator visually reflects the degree of bending of the nematode; the larger the ratio, the more bent the body.

[0015] To further optimize this technical solution, in step S4, the method for detecting the population aggregation of nematodes includes: Define a radius (Radius) for a square sliding window and iterate through the IDs of all nematodes. For the i-th nematode, construct a detection region with a side length of 2×Radius centered on its head coordinates, and determine whether the head coordinates of any other j-th nematode fall within this region. All nematodes that fall into the window are considered a cluster and are recorded in a new cluster sequence. middle; Once a nematode is assigned to an aggregation sequence In it, it will be derived from the nematode sequence to be detected. Removed from the middle.

[0016] In a second aspect, embodiments of the present invention provide a computer device, including a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program instructions are executed by the processor, they implement the steps of a deep learning-based nematode motion feature analysis method as described in the first aspect of the present invention.

[0017] Thirdly, embodiments of the present invention provide a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program instructions are executed by a processor, they implement the steps of a deep learning-based nematode motion feature analysis method as described in the first aspect of the present invention.

[0018] Compared with existing technologies, this invention provides a deep learning-based method for analyzing the motion features of nematodes, which has the following beneficial effects: This deep learning-based method for analyzing nematode movement features achieves high-precision automatic identification and trajectory tracking of nematodes in complex backgrounds and multi-target occlusion scenarios. It can simultaneously perform automatic head and tail labeling, body length and curvature calculation, and quantitative analysis of activity range and aggregation status, significantly reducing the need for manual intervention. Compared to existing methods, this invention not only improves the stability and computational efficiency of continuous tracking in multi-target video sequences, but also achieves, for the first time, unified modeling and quantification of nematode movement behavior and morphological changes. This provides technical support and a foundation of key parameters for large-scale, low-cost, and high-throughput research on nematode growth status and group behavior. Attached Figure Description

[0019] To more clearly illustrate the technical solutions of 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 some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a flowchart illustrating a deep learning-based method for analyzing the motion features of nematodes proposed in this invention. Figure 2 This is a map showing the movement trajectories of individual nematodes differentiated by different colors in a deep learning-based method for analyzing nematode movement features proposed in this invention. Figure 3This is a schematic diagram of the rectangular activity range of a nematode, distinguished by different colors, in a deep learning-based method for analyzing the movement features of nematodes proposed in this invention. Figure 4 This is an enlarged schematic diagram of the head and tail of a nematode in a deep learning-based method for analyzing the movement features of nematodes proposed in this invention. Figure 5 This is a schematic diagram of the head-to-tail distance of a nematode in a deep learning-based method for analyzing nematode movement features proposed in this invention. Detailed Implementation

[0021] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings.

[0022] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the spirit of the invention. Therefore, the invention is not limited to the specific embodiments disclosed below.

[0023] Secondly, the term "an embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in one embodiment" appearing in different places throughout this specification does not necessarily refer to the same embodiment, nor is it a single embodiment or an embodiment selectively excluded from other embodiments.

[0024] Example 1: Reference Figure 1-5 This is the first embodiment of the present invention, which provides a deep learning-based method for analyzing the movement characteristics of nematodes. This method integrates individual nematode trajectory tracking, head and tail identification, an original RDL bending quantification, and efficient population aggregation detection. By constructing a coherent data processing and analysis workflow, this method effectively solves the problems of quantification difficulties, high labor costs, and limited analytical dimensions in traditional nematode behavior research.

[0025] The method includes the following steps: S1. Tracking the trajectory and calculating the activity range of nematodes based on a deep learning model.

[0026] Current nematode behavior analysis techniques mainly focus on deep learning-based individual identification and image segmentation, such as using target detection models like RetinaNet to locate nematodes, or combining threshold segmentation with deep learning to count nematode numbers and aggregation levels. However, these methods lack sufficient support for dynamic trajectory tracking.

[0027] Existing nematode segmentation techniques largely rely on microscopic image denoising and edge detection. While these techniques can extract nematode outlines, they do not address motion trajectory modeling over long time sequences. In target tracking, traditional methods require manual annotation of nematode head and tail features to distinguish individuals, resulting in high annotation costs and difficulty in scaling to large-scale video analysis. Furthermore, current research lacks automated methods for calculating activity range. Some patents propose width measurement schemes based on straight-line cutting, but these do not address the issues of trajectory association and ID matching in multi-target tracking, meaning activity range calculation still relies on manually defined boundaries.

[0028] In this invention, nematode trajectory tracking includes: First, load the pre-trained deep learning model, use OpenCV to read the video / image and process it frame by frame, locate the target to obtain the center position and ID number of the nematode, record and update the trajectory points to form the activity trajectory, and calculate the activity trajectory of all nematodes.

[0029] In this embodiment, the OpenCV library is used to read video or image files frame by frame. Video files are in video format, and image files are in image format. Each i-frame of the file is recorded as... .

[0030] The deep learning model processes each frame Perform target localization and obtain the center coordinates (x, y) of all nematodes in the image and their unique identification number (ID).

[0031] The system will use the first frame All information about active nematodes appearing in the sequence is stored. In the meantime, subsequent processing will only target The nematode IDs within the system are used for trajectory tracking.

[0032] Continuously record and update the trajectory points for each nematode ID. , Representing the position of the j-th nematode in the i-th frame, the trajectory point... The data are compiled and ultimately formed into a complete map of the individual nematode activity trajectories, distinguished by different colors.

[0033] The calculation of nematode activity range includes: Obtain the nematode's activity trajectory, calculate the maximum and minimum coordinates, and determine the minimum bounding rectangle as the nematode's activity range.

[0034] In this embodiment, after obtaining the individual activity trajectories of all nematodes, the system sets the center position of the j-th nematode in all frames. =( , Extracted by calculating the maximum value of the coordinates in the nematode's activity trajectory. , ) and minimum value ( Automatically determine the minimum bounding rectangle of the nematode's movement trajectory. =(( , ),( , This allows us to obtain a precisely quantified range of activity for each nematode.

[0035] This step utilizes a deep learning model to accurately locate and track multiple target nematodes, adapting to complex backgrounds and solving the challenges of tracking intersecting and occluded nematodes. It automatically generates a minimum bounding rectangle to define the activity area, eliminating the need for manual annotation and correction, thus reducing data processing costs.

[0036] S2. Identify and locate the head and tail of the nematode.

[0037] Work on nematode identification mainly revolves around deep learning-based methods for nematode population identification, tail feature-based nematode identification, and image processing-based nematode segmentation, which involves removing the background from a petri dish and then extracting the nematode outline for identification. Related papers primarily use OpenCV-based methods to extract nematodes and generate black-and-white masks as a dataset for deep learning nematode identification.

[0038] The annotation of nematodes primarily relies on deep learning pre-training followed by manual correction, a time-consuming and labor-intensive method. Currently, research on changes in nematode growth is limited. While some patents propose using straight-line cuts to determine nematode width, no method exists to calculate nematode length. Furthermore, nematode body length is a better indicator of growth than width, and nematode number identification largely depends on head and tail identification, which currently relies heavily on manual annotation, resulting in a massive workload.

[0039] This invention proposes a highly robust method for distinguishing the head and tail of nematodes. This method effectively overcomes problems such as uneven illumination, lens distortion, and similarity in head and tail features. The identification and localization of the head and tail of nematodes includes: The nematode image data is obtained by capturing frames and then preprocessing the images: First, the captured nematode image data is converted to grayscale, then binarized. Subsequently, through erosion and dilation operations, the cavities inside the nematode's body in the image data are filled and the edges are smoothed to obtain a clear single-channel binarized image after preprocessing.

[0040] Contour extraction and angle calculation are performed to extract the body edge contour of the nematode and locate the head and tail endpoints; Based on the head and tail endpoints, the head and tail of the nematode can be identified.

[0041] In this embodiment, the location and identification of the head and tail endpoints include: The body contour of the nematode is extracted using OpenCV from the preprocessed image data, resulting in a contour set composed of contour points. Any point B on the contour and its adjacent previous point A and next point C are selected, and the included angle is ∠ABC. A discriminant value y is preset, y=180°-2∠ABC. The formula for calculating the included angle ∠ABC is as follows: The head and tail endpoints of the contour are the sharpest, with their included angle ∠ABC being much less than 180°, and the calculated y-values ​​are significantly greater than 0. The non-head and tail endpoints of the contour are relatively smooth, with their included angle ∠ABC being close to 180°, and the calculated y-values ​​are less than 0°. By traversing all points on the contour and calculating the y-values, the two points with the largest y-values ​​are identified as the head and tail endpoints of the nematode.

[0042] Furthermore, head and tail confirmation is based on motion temporal sequence: For static images or special cases where head and tail features are extremely similar, this method introduces motion temporal features for final confirmation. By comparing the coordinate positions of the current frame and the previous frame, the point with the largest displacement distance from the corresponding endpoint of the previous frame is determined to be the head, and the other end is the tail.

[0043] This step adapts to the peristaltic morphology of nematodes and can effectively calculate the body length of their curved bodies. Based on OpenCV, the head and tail are automatically extracted, resulting in lightweight computation and reduced data annotation, providing a technical foundation for nematode identification. Body length directly reflects the growth changes of nematodes, providing an important indicator for nematode growth research.

[0044] S3. Quantify the body posture of nematodes, construct a method for calculating the body length-to-tail distance ratio (RDL) curvature, and calculate the RDL curvature of nematodes.

[0045] In existing technologies, image preprocessing and analysis largely rely on traditional methods, such as contour extraction and black-and-white masking. However, these methods struggle to achieve ideal segmentation results when dealing with nematode images that are complex in pose and have strong background interference. Many methods assume that the nematode's body axis is approximately a straight line and that the contour edges are smooth and continuous during the modeling process. These preconditions are difficult to hold in complex real-world environments, thus limiting the generalization ability of the methods.

[0046] The annotation of nematodes mainly relies on deep learning pre-training followed by manual correction, which still requires a large amount of manual adjustment, resulting in low efficiency and long processing time, making it unsuitable for rapid and simple processing and analysis of large-scale samples. Existing research generally focuses on measuring single morphological parameters such as body length and area, lacking modeling of the correlation between different morphological features of nematodes, making it difficult to comprehensively reveal the dynamic changes in the body shape of nematodes, and lacking a rapid and effective indicator for assessing the tortuosity of nematodes.

[0047] In this invention, the method for calculating the curvature of the RDL includes: Calculation of nematode body length (bodyLen); Calculate the straight-line distance between the head and tail points, headTailDist. RDL curvature index calculation.

[0048] In this embodiment: When calculating the nematode body length (bodyLen), the image is first converted to grayscale and binarized using Otsu's method, making the nematode region appear white (grayscale value 255). Based on the nematode contour set obtained in step S2, to avoid overestimating the perimeter due to excessively dense contour points, the Douglas-Peucker algorithm is used to smooth the contours, generating a simplified contour point set. The threshold factor of this algorithm can be adjusted within the range of (0.002, 0.1) according to the image resolution.

[0049] The formula for calculating the nematode body length (bodyLen) is as follows: in, : The actual body length of the j-th nematode; The number of points in the outline; : The two-dimensional coordinates of the k-th contour point; : The two-dimensional coordinates of the (k+1)th contour point; Euclidean distance is used to calculate the straight-line distance between the k-th point and the (k+1)-th point, which is an approximation of the arc length of the contour segment.

[0050] Since the nematode's outline is a closed-loop structure, the calculated body length will include the redundant portion between the head and tail. To obtain an approximate length of the nematode's centerline, we take... That is, the simplified outline is approximately equivalent to the length estimate along the body's central axis.

[0051] The formula for calculating the straight-line distance between the head and tail, headTailDist, is as follows: in, The straight-line distance between the head and tail of the j-th nematode; : The head coordinates of the j-th nematode; : The coordinates of the tail of the j-th nematode.

[0052] The formula for calculating the RDL curvature index is shown below: in, : RDL curvature index of the j-th nematode; This indicator visually reflects the degree of bending of the nematode; the larger the ratio, the more bent the body.

[0053] This step adapts to the nematode's peristaltic morphology, simplifies the number of points to identify on the contour curve, and reduces the impact of image resolution on body length measurement. Based on OpenCV, the curvature index is automatically calculated, eliminating the need for manual body shape classification and providing a technical foundation for nematode classification. It can visually reflect the degree of nematode curvature, providing an important indicator for nematode growth research.

[0054] S4. Based on the nematode head trajectory located in step S2, perform nematode aggregation detection.

[0055] In existing technologies, research on nematode swarm detection mainly revolves around nematode segmentation based on image processing and individual recognition using deep learning. For example, target detection models such as Faster R-CNN are used to locate and segment nematodes, or image thresholding is combined with statistical analysis of nematode numbers and clustering levels. However, these methods perform poorly when dealing with nematode images with strong background interference.

[0056] Traditional methods rely on manually labeling nematode features to distinguish individuals. This labeling process is tedious, time-consuming, and labor-intensive, and requires extensive manual correction to ensure accuracy, making it difficult to scale up to large-scale video detection. Existing research generally focuses on the nematode's appearance and simple movement characteristics, lacking automated methods for analyzing nematode behavior. This makes it difficult to comprehensively reveal changes in nematode behavior and lacks rapid and effective methods for detecting nematode population aggregation.

[0057] In this invention, the method for detecting nematode aggregation includes: Set a radius (e.g., 0-200 pixels) for a square sliding window and iterate through all nematode IDs; For the i-th nematode, a detection region with a side length of 2×Radius is constructed centered on its head coordinates. It is then determined whether the head coordinates of any other j-th nematode fall within this region. All nematodes falling within this window are considered a cluster and are recorded in a new cluster sequence. In the middle; once a nematode is assigned to an aggregate sequence In it, it will be derived from the nematode sequence to be detected. Removed from the middle. This optimization avoids redundant calculations of already grouped nematodes, ensuring that the detection process can still be completed quickly even when dealing with large-scale nematode populations. Adapts to complex backgrounds, solving the challenge of analyzing aggregation behavior in scenarios with multiple nematodes crossing or occlusion.

[0058] The following are comparisons of the time complexity and memory usage (MB) of various aggregation computation methods for 1000 nematodes. The time complexity of this invention is significantly lower than that of several existing technologies. Down to The comparison results are shown in Table 1.

[0059] Table 1. Comparison of space and time complexity (for 1000 points) Parameter description: n=1000: Coordinates are stored as float32 (4 bytes / point), and matrix elements are bool or int8.

[0060] k: Number of effective neighborhood pairs (significantly reduced in DSW due to bidirectional constraints).

[0061] m: The number of grid points in the KDE (e.g., 20×20=400).

[0062] DBSCAN optimization: Space complexity depends on neighborhood sparsity.

[0063] This invention does not rely on deep learning models or manual annotation for correction; the algorithm is lightweight and efficient, reducing the cost of manual intervention and data processing. Furthermore, it is applicable to various experimental environments and can be extended to the study of behavioral aggregation of other microorganisms.

[0064] Example 2: Based on the method described in Embodiment 1, practical applications are carried out: The nematodes were placed in a 9cm diameter culture dish filled with 2% agar gel, and the ambient temperature was controlled at 20℃±0.5℃.

[0065] The camera pixel ratio is calibrated using a standard ruler to ensure that 1 pixel = 0.1μm, and high-resolution, high-magnification nematode image data is acquired for image collection.

[0066] By acquiring image data under high-resolution and high-magnification conditions and using the method of Example 1, we obtained the nematode movement characteristic analysis.

[0067] Example 3: This embodiment also provides a computer device applicable to a deep learning-based nematode motion feature analysis method, including a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the deep learning-based nematode motion feature analysis method proposed in the above embodiment.

[0068] This embodiment also provides a storage medium storing a computer program that, when executed by a processor, implements a deep learning-based nematode motion feature analysis method as proposed in the above embodiment.

[0069] The computer device can be a terminal, comprising a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, carrier networks, NFC (Near Field Communication), or other technologies. The display screen can be an LCD screen or an e-ink screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad on the computer device's casing, or an external keyboard, touchpad, or mouse.

[0070] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0071] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (such as a computer-based system, a processor-including system, or other system that can fetch and execute instructions from, an instruction execution system, apparatus, or device). For the purposes of this specification, "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transmit programs for use by, or in conjunction with, an instruction execution system, apparatus, or device.

[0072] More specific examples (a non-exhaustive list) of computer-readable media include: electrical connections (electronic devices) having one or more wires, portable computer disk drives (magnetic devices), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, computer-readable media can even be paper or other suitable media on which programs can be printed, because programs can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpreting, or otherwise processing as necessary, and then stored in computer memory.

[0073] It should be understood that various parts of the present invention can be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (PGAs), field-programmable gate arrays (FPGAs), etc.

[0074] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A method for analyzing the motion features of nematodes based on deep learning, characterized in that, Includes the following steps: S1. Tracking the trajectory and calculating the activity range of nematodes based on deep learning models; S2. Identify and locate the head and tail of the nematode; S3. Quantify the body posture of nematodes, construct a method for calculating the body length-to-tail distance ratio (RDL) curvature, and calculate the RDL curvature of nematodes. S4. Based on the nematode head trajectory located in step S2, perform nematode aggregation detection.

2. The method for analyzing the motion features of nematodes based on deep learning according to claim 1, characterized in that, In step S1: Nematode trajectory tracking, including: Use OpenCV to read videos / images and process them frame by frame. Locate the target, obtain the center position and ID number of the nematode, record and update the trajectory points to form the activity trajectory, and calculate the activity trajectory of all nematodes. The calculation of nematode activity range includes: Obtain the nematode's activity trajectory, calculate the maximum and minimum coordinates, and determine the minimum bounding rectangle as the nematode's activity range.

3. The method for analyzing the motion features of nematodes based on deep learning according to claim 2, characterized in that, In the nematode trajectory tracking: This code uses the OpenCV library to read video or image files frame by frame. Video files are in video format, and image files are in image format. Each i-frame of the file is recorded as... ; The deep learning model processes each frame Perform target localization and obtain the center coordinates (x, y) of all nematodes in the image and their unique identification number (ID); The system will use the first frame All information about active nematodes appearing in the sequence is stored. In the meantime, subsequent processing will only target Track the trajectory of the nematode ID within the nematode; Continuously record and update the trajectory points for each nematode ID. , Representing the position of the j-th nematode in the i-th frame, the trajectory point... The data are compiled and ultimately formed into a complete map of the individual nematode activity trajectories, distinguished by different colors.

4. The method for analyzing the motion features of nematodes based on deep learning according to claim 2, characterized in that, In the calculation of the nematode activity range: After obtaining the individual activity trajectories of all nematodes, the system will determine the center position of the j-th nematode across all frames. =( , Extracted by calculating the maximum value of the coordinates in the nematode's activity trajectory. , ) and minimum value ( Automatically determine the minimum bounding rectangle of the nematode's movement trajectory. =(( , ),( , This allows us to obtain a precisely quantified range of activity for each nematode.

5. The method for analyzing the motion features of nematodes based on deep learning according to claim 1, characterized in that, In step S2, the identification and localization of the nematode's head and tail include: Image data of nematodes is obtained by frame capture and then image preprocessing is performed. Contour extraction and angle calculation are performed to extract the body edge contour of the nematode and locate the head and tail endpoints; Based on the head and tail endpoints, the head and tail of the nematode can be identified.

6. The method for analyzing the motion features of nematodes based on deep learning according to claim 5, characterized in that, The image preprocessing includes: The nematode image data obtained by frame capture is first grayscaled, then binarized. Subsequently, through erosion and dilation operations, the cavities inside the nematode's body in the image data are filled and the edges are smoothed to obtain a clear single-channel binarized image after preprocessing.

7. The method for analyzing the motion features of nematodes based on deep learning according to claim 5, characterized in that, The location and identification of the head and tail endpoints include: The body contour of the nematode is extracted using OpenCV from the preprocessed image data. Any point B on the contour and its adjacent previous point A and next point C are selected, and the included angle is ∠ABC. A discriminant value y is preset, y=180°-2∠ABC; The formula for calculating the included angle ∠ABC is as follows: The beginning and end points of the contour are the sharpest, with the included angle ∠ABC being much less than 180°, and the calculated y value is significantly greater than 0; the non-beginning and end points of the contour are relatively smooth, with the included angle ∠ABC being close to 180°, and the calculated y value is less than 0°. By traversing all points on the contour and calculating the y-value, the two points with the largest y-values ​​are identified as the head and tail endpoints of the nematode. By comparing the coordinates of the current frame with those of the previous frame, the point with the largest displacement distance from the corresponding endpoint of the previous frame is determined to be the head, and the other end is the tail.

8. The method for analyzing the motion features of nematodes based on deep learning according to claim 1, characterized in that, In step S3, the method for calculating the RDL curvature includes: Calculation of nematode body length (bodyLen); Calculate the straight-line distance between the head and tail points, headTailDist. RDL curvature index calculation.

9. The method for analyzing the motion features of nematodes based on deep learning according to claim 8, characterized in that, The formula for calculating the nematode body length (bodyLen) is as follows: in, : The actual body length of the j-th nematode; The number of points in the outline; : The two-dimensional coordinates of the k-th contour point; : The two-dimensional coordinates of the (k+1)th contour point; Euclidean distance is used to calculate the straight-line distance between the k-th point and the (k+1)-th point, which is an approximate value of the arc length of the contour segment. Since the nematode's outline is a closed-loop structure, the calculated body length will include the redundant portion between the head and tail. To obtain an approximate length of the nematode's centerline, we take... That is, the simplified outline is approximately equivalent to the length estimate along the body's central axis; The formula for calculating the straight-line distance between the head and tail, headTailDist, is as follows: in, The straight-line distance between the head and tail of the j-th nematode; : The head coordinates of the j-th nematode; : The coordinates of the tail of the j-th nematode; The formula for calculating the RDL curvature index is shown below: in, : RDL curvature index of the j-th nematode; This indicator visually reflects the degree of bending of the nematode; the larger the ratio, the more bent the body.

10. The method for analyzing the motion features of nematodes based on deep learning according to claim 1, characterized in that, In step S4, the method for detecting the aggregation of nematodes includes: Define a radius (Radius) for a square sliding window and iterate through the IDs of all nematodes. For the i-th nematode, construct a detection region with a side length of 2×Radius centered on its head coordinates, and determine whether the head coordinates of any other j-th nematode fall within this region. All nematodes that fall into the window are considered a cluster and are recorded in a new cluster sequence. middle; Once a nematode is assigned to an aggregation sequence In it, it will be derived from the nematode sequence to be detected. Removed from the middle.