Method for identification and counting of body flexion behavior of nematodes and related apparatus
By identifying the head and tail coordinates of nematodes and calculating the number of bends using convolutional neural networks and curvature feature point extraction algorithms, the problem of nematode counting errors in existing technologies is solved, and efficient and accurate automated counting is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN UNIVERSITY OF ADVANCED TECHNOLOGY
- Filing Date
- 2022-12-16
- Publication Date
- 2026-04-17
AI Technical Summary
Existing technologies for identifying and counting nematode movement behaviors are prone to errors and have low accuracy. Manual counting is inefficient, time-consuming, and labor-intensive, and is also prone to introducing human bias.
The coordinates of the head and tail of the nematode were obtained by a numerical coordinate regression algorithm based on a convolutional neural network. The peak point on the center line of the nematode was calculated by combining the curvature feature point extraction algorithm. The number of times the nematode's body bent was counted by calculating the maximum distance change from the peak point to the line connecting the pharynx and the tail.
It improves the accuracy of recognizing nematode body bending behavior, enables efficient and automated counting, reduces manpower consumption and counting errors, and improves work efficiency.
Smart Images

Figure CN116030530B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electronic information technology, and in particular to a method, system, terminal, and computer-readable storage medium for identifying and counting the body bending behavior of nematodes. Background Technology
[0002] The locomotion behavior of nematodes plays a crucial role in drug activity screening, anti-aging studies, and toxicological evaluation. Previous studies have provided important insights into these fields by manually counting the number of body bends. However, manual counting is often low-throughput, time-consuming, and labor-intensive, and prone to human bias. In many studies, time and labor constraints often reduce the sample size, easily leading to errors in the final results. Furthermore, subtle changes are often overlooked by the human eye during manual counting. These issues pose significant challenges to data collection.
[0003] Therefore, replacing manual counting with high-throughput, automated, and accurate algorithmic counting is the current trend. To meet these needs, some laboratories have developed high-precision and high-throughput worm trackers.
[0004] For example, according to the definition of counting the number of bends in a nematode's body: each time the portion behind the nematode's pharynx reaches its maximum bend in the opposite direction to the previous bend, the count is advanced. However, if the nematode spontaneously reverses direction during its forward movement, and the region behind the pharynx bends again in the direction it was bending when it first moved forward, this cannot be counted as a single bend. The count is only advanced when the nematode actually bends in the opposite direction, resulting in counting errors. For example, quantifying the nematode's body as a sine and cosine function to calculate the number of bends corresponds to the phase advance of π; however, this method cannot accurately count bends such as omega bends and has certain limitations. For example, quantifying the nematode's body bends by dividing the nematode's body into n parts and then calculating the bend angle of each part to generate an angle matrix does not count every single bend within the nematode's body, failing to meet the standard for counting the number of bends in a nematode's body.
[0005] Therefore, existing technologies still need to be improved and developed. Summary of the Invention
[0006] The main objective of this invention is to provide a method, system, terminal, and computer-readable storage medium for identifying and counting the bending behavior of nematodes, aiming to solve the problems of errors and low accuracy in the identification and counting of nematode movement behavior in the prior art.
[0007] To achieve the above objectives, the present invention provides a method for identifying and counting the body bending behavior of nematodes, the method comprising the following steps:
[0008] Acquire a nematode video, perform frame segmentation on the nematode video to obtain an original grayscale image, and obtain a nematode binary image based on the original grayscale image;
[0009] Based on the original grayscale image of the nematode, the head coordinates and tail coordinates are obtained using a numerical coordinate regression algorithm based on a convolutional neural network.
[0010] Based on the binary image of the nematode, the peak point on the center line of the nematode is calculated using a feature point extraction algorithm based on curvature.
[0011] Calculate the maximum distance from the peak point to the line connecting the nematode's pharynx and tail, and calculate the number of times the nematode's body bends based on the change in the maximum distance in each frame.
[0012] Optionally, the method for recognizing and counting the bending behavior of nematodes, wherein acquiring a nematode video, performing frame-by-frame processing on the nematode video to obtain an original grayscale image, and obtaining a binary image of the nematode based on the original grayscale image, specifically includes:
[0013] The acquired nematode video is processed by frame segmentation to obtain the original grayscale image;
[0014] The original grayscale image is cropped to obtain the maximum grayscale value of the four corner points of the image, wherein at least one corner point is never part of the nematode's body, and the pixel value of the background layer of the original grayscale image is determined.
[0015] The original grayscale image is scanned using a sliding window of a preset size, and the average value and standard deviation of the pixels at each pixel position within the sliding window are calculated.
[0016] When the average value of the calculated pixel values is less than 70% of the background pixel values or the standard deviation is greater than 30% of the average value, the center pixel of the sliding window is assigned a value of 0, which is considered part of the nematode's body; otherwise, the center pixel within the sliding window is assigned a value of 1, which is considered the background.
[0017] Use morphological closure operators to remove small spots inside nematodes;
[0018] After obtaining the binary image of the nematode, denoising is performed based on a sequential algorithm of component labeling to obtain the nematode.
[0019] Optionally, the method for identifying and counting the body bending behavior of nematodes, wherein obtaining the head and tail coordinates based on the original grayscale image of the nematode using a numerical coordinate regression algorithm based on a convolutional neural network specifically includes:
[0020] The coordinates of the nematode's head and tail were manually labeled.
[0021] Generate a heatmap of a nematode's head of a preset size using a convolutional neural network. and tail heat map ;
[0022] Head heatmap and tail heat map The normalized heatmap of the head is obtained by normalization using the Softmax function. Tail normalized heatmap :
[0023] ;
[0024] ;
[0025] Normalized heatmap from head using DSNT Tail normalized heatmap The head and tail coordinates are obtained.
[0026] Optionally, in the method for identifying and counting the body bending behavior of nematodes, the method uses DSNT to analyze the normalized heatmap from the head. Tail normalized heatmap The head and tail coordinates are obtained, specifically including:
[0027] Normalized head heat map Tail normalized heat map and coordinate matrix and Input to the DSNT layer;
[0028] Normalized head heat map Tail normalized heatmap with normalized coordinate matrix and Multiply the elements together and take the average of the resulting matrices;
[0029] The predicted head coordinates of the nematode are as follows:
[0030] ;
[0031] The predicted coordinates of the nematode's tail are as follows:
[0032] ;
[0033] in, These are coordinate prediction values, subscripts. Indicates the head, subscript Indicates the tail. This represents the Frobenius inner product operation;
[0034] The mean square error between the predicted coordinates and the correctly labeled head and tail coordinates is used as the loss.
[0035] Calculate coordinate prediction values and correctly labeled head and tail coordinates The two-dimensional Euclidean distance between them, the Euclidean loss function is defined as:
[0036] ;
[0037] Regularization, when incorporated into the DSNT loss function, is expressed as:
[0038] ;
[0039] in, It is the regularization coefficient, used to set the regularization. The strength, It is a single-channel normalized heatmap.
[0040] Optionally, the method for identifying and counting the bending behavior of nematodes, wherein calculating the coordinates of feature points on the center line of the nematode based on the binary image of the nematode using a feature point extraction algorithm based on curvature specifically includes:
[0041] Based on the head and tail coordinates of the nematode, the outline points of the nematode's body are divided into a ventral point set and a dorsal point set.
[0042] The ventral and dorsal point sets are resampled by distance using linear interpolation with a sample size of n to obtain the dorsal point set. and ventral point set ( ), calculate the set of central line points of the nematode's body , represented as:
[0043] ;
[0044] in, , ;
[0045] in, It's an index increment. It is a parameter that limits the search area. j It is the index of the backside point set after resampling. m It is the distance of the search area;
[0046] The centerline of the nematode is calculated, and the length of the nematode's body is obtained by summing the distances between adjacent points.
[0047] One-tenth of the length of the nematode's central line is selected as the pharynx. Based on the convexity and concavity of the nematode's body, the curvature κ of each point on the central line is calculated and marked with positive and negative signs.
[0048] The inflection point of the nematode's body centerline is obtained by the sign change of curvature κ. The maximum value of the absolute value of curvature between two consecutive inflection points is recorded as the peak point.
[0049] Optionally, the method for identifying and counting the body bending behavior of nematodes, wherein calculating the maximum distance from the peak point to the line connecting the nematode's pharynx and tail, and calculating the number of body bending events based on the change in the maximum distance per frame, specifically includes:
[0050] Connect the pharynx and tail of the nematode with a straight line, and calculate the vertical distance from each peak point of the nematode's body to the line connecting the pharynx and tail.
[0051] In each subsequent frame, the maximum or minimum vertical distance from the peak point to the line connecting the pharynx and tail is selected as a reference value for calculating the number of times the nematode's body bends.
[0052] The count progresses when the portion behind the nematode's pharynx reaches its maximum curvature, opposite to the previous count.
[0053] Optionally, the method for identifying and counting the body bending behavior of nematodes, wherein calculating the maximum distance from the peak point to the line connecting the nematode's pharynx and tail, and calculating the number of body bends based on the change in the maximum distance per frame, further includes:
[0054] The vertical distance from the peak point to the line connecting the pharynx and tail is marked with positive and negative signs. Starting from the head of the nematode, the distance corresponding to the peak point in the counterclockwise direction is marked as a negative value, and vice versa.
[0055] Furthermore, to achieve the above objectives, the present invention also provides a system for identifying and counting the body bending behavior of nematodes, wherein the system for identifying and counting the body bending behavior of nematodes includes:
[0056] The image processing module is used to acquire nematode video, perform frame-by-frame processing on the nematode video to obtain an original grayscale image, and obtain a nematode binary image based on the original grayscale image;
[0057] The coordinate calculation module is used to obtain the head coordinates and tail coordinates based on the original grayscale image of the nematode using a numerical coordinate regression algorithm based on a convolutional neural network.
[0058] The feature extraction module is used to calculate the peak points on the center line of the nematode based on the binary image of the nematode using a feature point extraction algorithm based on curvature.
[0059] The bending counting module is used to calculate the maximum distance from the peak point to the line connecting the nematode's pharynx and tail, and to calculate the number of body bends based on the change in the maximum distance in each frame.
[0060] Furthermore, to achieve the above objectives, the present invention also provides a terminal, wherein the terminal includes: a memory, a processor, and a nematode body bending behavior identification and counting program stored in the memory and executable on the processor, wherein when the nematode body bending behavior identification and counting program is executed by the processor, it implements the steps of the nematode body bending behavior identification and counting method as described above.
[0061] Furthermore, to achieve the above objectives, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a program for identifying and counting nematode body bending behavior, and the program for identifying and counting nematode body bending behavior, when executed by a processor, implements the steps of the method for identifying and counting nematode body bending behavior as described above.
[0062] In this invention, a nematode video is acquired, and the video is processed into frames to obtain an original grayscale image. A binary image of the nematode is then obtained from the original grayscale image. Based on the original grayscale image, the head and tail coordinates are obtained using a numerical coordinate regression algorithm based on a convolutional neural network. Based on the binary image, a peak point on the nematode's centerline is calculated using a feature point extraction algorithm based on curvature. The maximum distance from the peak point to the line connecting the nematode's pharynx and tail is calculated, and the number of bends in the nematode's body is calculated based on the change in the maximum distance in each frame. This invention uses a numerical coordinate regression algorithm based on a convolutional neural network to identify the coordinates of the nematode's head and tail, improving accuracy. By extracting feature points, it achieves a simpler and faster way to calculate the number of bends in the nematode's body. Attached Figure Description
[0063] Figure 1 This is a flowchart of a preferred embodiment of the method for identifying and counting the body bending behavior of nematodes according to the present invention;
[0064] Figure 2 This is a flowchart illustrating the overall framework of a preferred embodiment of the method for identifying and counting the body bending behavior of nematodes according to the present invention.
[0065] Figure 3 This is a flowchart of the head-tail localization algorithm in a preferred embodiment of the method for identifying and counting the body bending behavior of nematodes according to the present invention;
[0066] Figure 4This is a flowchart of feature point extraction in a preferred embodiment of the method for identifying and counting the bending behavior of nematodes according to the present invention;
[0067] Figure 5 This is a schematic diagram illustrating the head and tail identification accuracy in a preferred embodiment of the method for identifying and counting the body bending behavior of nematodes according to the present invention.
[0068] Figure 6 This is a schematic diagram showing the results of manual and automatic counting of the number of body bends in a preferred embodiment of the method for identifying and counting the body bending behavior of nematodes according to the present invention;
[0069] Figure 7 This is a schematic diagram of a preferred embodiment of the system for identifying and counting the body bending behavior of nematodes according to the present invention;
[0070] Figure 8 This is a schematic diagram of the operating environment of a preferred embodiment of the terminal of the present invention. Detailed Implementation
[0071] To make the objectives, technical solutions, and advantages of this invention clearer and more explicit, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0072] The preferred embodiment of the method for identifying and counting nematode body bending behavior described in this invention, such as... Figure 1 and Figure 2 As shown, the method for identifying and counting the body bending behavior of nematodes includes the following steps:
[0073] Step S10: Obtain the nematode video, perform frame segmentation on the nematode video to obtain the original grayscale image, and obtain the nematode binary image based on the original grayscale image.
[0074] Specifically, the acquired nematode video is processed by frame segmentation to obtain the original grayscale image; a clean binary image of the nematode is obtained through a series of image processing algorithms: First, the original grayscale image is cropped to obtain the maximum grayscale value of the four corner points of the image, wherein at least one corner point is never part of the nematode's body, thus determining the pixel value of the background layer of the original grayscale image (because the nematode has a low grayscale value in the grayscale image, close to black, the maximum grayscale value of the four corner points of the grayscale image is selected as the background pixel value); after determining the background layer of the image, an adaptive local thresholding algorithm is applied to the image, using a sliding window of a preset size (e.g., 5×5) to scan the original grayscale image, and when calculating the value within the sliding window... The average value and standard deviation of each pixel at each pixel location are calculated. When the average value of the calculated pixel is less than 70% of the background pixel value or the standard deviation is greater than 30% of the average value, the center pixel of the sliding window is assigned a value of 0, which is considered part of the nematode's body. Otherwise, the center pixel within the sliding window is assigned a value of 1, which is considered the background. Next, a morphological closure operator (binary dilation followed by erosion) is used to remove small spots within the nematode's body. Finally, after obtaining the binary image of the nematode, a component-labeled sequential algorithm is used for denoising (in addition to the nematode, there are other small black spots in the image, which need to be removed to retain only the nematode). That is, the component-labeled sequential algorithm is used to remove unwanted isolated small objects in the image to obtain the nematode.
[0075] The connection components include the nematode and some other isolated small objects. Finally, the largest component is selected, which is the nematode. This is done by scanning every pixel in the image along the x and y directions, grouping pixels with the same value into the same group, and marking the connected components. This process ultimately yields the connection components for all pixels in the image. To ensure that there is only one object in the binary image, the largest component, the nematode, must be selected from all components.
[0076] Step S20: Based on the original grayscale image of the nematode, obtain the head coordinates and tail coordinates using a numerical coordinate regression algorithm based on a convolutional neural network.
[0077] Specifically, the input is a raw grayscale image of a nematode, and through a series of processing steps, the final output is the coordinates of the nematode's head and tail. The implementation process of the head-tail localization algorithm is as follows: Figure 3 As shown. Specifically: First, the coordinates of the nematode's head and tail are manually labeled; next, a convolutional neural network is used to generate a heatmap of the nematode's head of a preset size. and tail heat map The goal of this invention is to directly obtain the head and tail coordinates of the nematode. Therefore, it is necessary to perform DSNT (differentiable spatial to numerical transform) processing on the head and tail heatmaps. Since the input of DSNT is a single-channel normalized heatmap.
[0078] Therefore, the heatmaps for the head and tail need to be normalized first; that is, all elements in the heatmap must be non-negative and add up to 1. To ensure that the predicted coordinates always lie within the spatial range of the heatmap itself, the Softmax function is applied to the heatmap for normalization. Finally, the probability of the head or tail coordinate position is given in the normalized heatmap. First, the head heatmap... and tail heat map The normalized heatmap of the head is obtained by normalization using the Softmax function. Tail normalized heatmap :
[0079] ;
[0080] ;
[0081] Then, DSNT was used to normalize the heatmap from the head. Tail normalized heatmap Obtain the head and tail coordinates. Then, normalize the head heatmap. Tail normalized heat map and coordinate matrix and Input to DSNT layer; coordinate matrix and Each item contains its own horizontal or vertical coordinates, and the scaled image coordinates range from ( Between 1 and 1); the Frobenius inner product operation is used to predict the head and tail coordinates. That is, the head is normalized in the heatmap. Tail normalized heatmap with normalized coordinate matrix and Multiply the elements and take the average of the resulting matrices.
[0082] The predicted head coordinates of the nematode are as follows:
[0083] ;
[0084] The predicted coordinates of the nematode's tail are as follows:
[0085] ;
[0086] in, These are coordinate prediction values, subscripts. Indicates the head, subscript Indicates the tail. This represents the Frobenius inner product operation.
[0087] Since the output of the DSNT layer is normalized coordinates, the mean squared error between the predicted coordinates and the correctly labeled head and tail coordinates is chosen as the loss; specifically, the core term of the loss function is calculated by measuring the predicted coordinate values. and correctly labeled head and tail coordinates The loss function is defined as the two-dimensional Euclidean distance between the two sides, and is expressed as:
[0088] ;
[0089] To control the propagation of the predicted heatmap, regularization is incorporated into the DSNT loss function, expressed as:
[0090] ;
[0091] in, It is the regularization coefficient, used to set the regularization. The strength, This is a single-channel normalized heatmap. Finally, the Jensen-Shannon divergence was chosen as the optimal regularization term.
[0092] Step S30: Based on the binary image of the nematode, calculate the peak point on the center line of the nematode using a feature point extraction algorithm based on curvature.
[0093] Specifically, based on the head and tail coordinates of the nematode, such as Figure 4 As shown in (a), the gray cross marks the head of the nematode, and the gray dots mark the tail. The outline points of the nematode's body are divided into ventral and dorsal point sets, as follows. Figure 4 As shown in (b), the dark gray edge represents the dorsal side of the nematode, and the light gray edge represents the ventral side. Next, linear interpolation of size n is used to resample the ventral and dorsal point sets by distance to obtain the dorsal point set. and ventral point set ( ), calculate the set of central line points of the nematode's body , represented as:
[0094] ;
[0095] in, , ;
[0096] in, It's an index increment. It is a parameter that limits the search area. j It is the index of the backside point set after resampling. m This is the distance to the search area. The centerline of the nematode is calculated, such as... Figure 4 As shown by the white line in (c), the length of the nematode's body is obtained by summing the distances between adjacent points.
[0097] The nematode is approximately 1 mm long, and its pharynx is approximately 100 μm long. Therefore, one-tenth of the length of the nematode's body centerline was chosen as the pharynx. Figure 4 As can be seen from (d) in the diagram, the point indicated by label 1 is the pharynx of the nematode. Next, based on the convexity and concavity of the nematode's body, the curvature κ at each point on the central line is calculated and marked with positive and negative signs; the inflection points of the nematode's central line are obtained based on the change in the sign of the curvature κ, such as... Figure 4 As shown by the point indicated by label 2 in (e), next, obtain the maximum value of the absolute value of curvature between two consecutive inflection points, denoted as the peak point, as follows. Figure 4 As shown in (f), the point indicated by label 3 is the peak point of the nematode's body centerline.
[0098] Step S40: Calculate the maximum distance from the peak point to the line connecting the nematode's pharynx and tail, and calculate the number of times the nematode's body bends based on the change in the maximum distance in each frame.
[0099] Specifically, the counting method for the number of bends in a nematode's body is defined as follows: each time the portion behind the nematode's pharynx reaches its maximum bend in the opposite direction to the bend of the previous count, the count is advanced. However, if the nematode spontaneously reverses direction during its forward movement, and the region behind the pharynx bends again in the direction it was bending when it first moved forward, this is not counted as a single bend. The count is only advanced when the nematode actually bends in the opposite direction. Each time the portion behind the nematode's pharynx reaches its maximum bend in the opposite direction to the bend of the previous count, the count is advanced once.
[0100] First, connect the pharynx and tail of the nematode with a straight line, such as... Figure 4 As shown in (f) in the diagram. Next, the vertical distance from each peak point on the nematode's body to the line connecting the pharynx and tail is calculated. For ease of subsequent calculations, the vertical distances from the peak points to the lines connecting the pharynx and tail are marked with positive and negative signs. That is, starting from the nematode's head, the distances corresponding to peak points in a counter-clockwise direction are marked as negative values, and vice versa, as positive values. A schematic diagram of the calculated vertical distances is shown below. Figure 4 As shown in (f) in the figure.
[0101] Subsequently, in each subsequent frame, the maximum or minimum vertical distance from the peak point to the line connecting the pharynx and tail is selected (the maximum is selected when the distance is positive; the minimum is selected when the distance is negative) as a reference value for calculating the number of bends in the nematode's body. The count is incremented when the portion behind the pharynx reaches its maximum bend, opposite to the previous count. For example, if the nematode's body reaches its maximum bend in a clockwise direction starting from the head within a certain period, and then, after some movement, reaches its maximum bend in a counter-clockwise direction starting from the head, the number of bends can be increased by one. Furthermore, to reduce errors in the counting process, it is ensured that at least three frames near the peak point where the maximum bend distance is reached are in the same direction as the current peak point.
[0102] This invention offers more accurate head and tail identification. Most previous studies used two methods to identify the head and tail of nematodes: curvature-based and grayscale-based. Curvature-based methods typically require preprocessing of the nematode image, followed by edge detection to locate the nematode's boundary. Three points are taken on the boundary of the binary image; the smallest angle represents the nematode's tail. However, under common imaging conditions, the nematode's tail often appears insufficiently sharp, leading to misidentification. Grayscale-based methods require calculating the median brightness of both ends; the end region with the higher average brightness value is labeled as the head. This method is highly dependent on lighting conditions during the nematode dataset acquisition. Under common imaging conditions, the head is often darker than the tail. Figure 5 As shown, the head and tail recognition method proposed in this invention is based on a convolutional neural network (VGG19), which has higher accuracy compared with traditional methods. The head coordinate prediction accuracy is 0.99.
[0103] This invention, compared to other methods for counting body curvature, better conforms to counting standards, has higher accuracy, saves manpower and time, and improves work efficiency. The counting results are as follows: Figure 6 As shown, dots of different colors and shapes represent the results of manual and automatic counting of different strains of nematodes. Ultimately, all the results from manual and automatic counting converge on both sides of the straight line y=x. The Pearson correlation coefficient between the automatic and manual counting results for the number of nematode body bends is 0.99, and the mean absolute error is 1.93. Experimental results demonstrate that the method of this invention has high accuracy and robustness.
[0104] This invention uses a numerical coordinate regression algorithm based on convolutional neural networks to identify the coordinates of the head and tail, improving accuracy. By extracting feature points, it achieves a simpler and faster way to calculate the number of times the nematode's body bends.
[0105] Furthermore, such as Figure 7 As shown, based on the above-described method for identifying and counting nematode body bending behavior, the present invention also provides a system for identifying and counting nematode body bending behavior, wherein the system includes:
[0106] Image processing module 51 is used to acquire nematode video, perform frame-by-frame processing on the nematode video to obtain an original grayscale image, and obtain a nematode binary image based on the original grayscale image;
[0107] The coordinate calculation module 52 is used to obtain the head coordinates and tail coordinates based on the original grayscale image of the nematode using a numerical coordinate regression algorithm based on a convolutional neural network.
[0108] Feature extraction module 53 is used to calculate the peak point on the center line of the nematode based on the feature point extraction algorithm based on curvature of the binary image of the nematode.
[0109] The bending counting module 54 is used to calculate the maximum distance from the peak point to the line connecting the nematode's pharynx and tail, and to calculate the number of body bends based on the change in the maximum distance in each frame.
[0110] Furthermore, such as Figure 8 As shown, based on the above-mentioned method and system for identifying and counting the bending behavior of nematodes, the present invention also provides a terminal, which includes a processor 10, a memory 20 and a display 30. Figure 8 Only some of the terminal components are shown; however, it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0111] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory. In other embodiments, the memory 20 may be an external storage device of the terminal, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc. Further, the memory 20 may include both internal and external storage devices. The memory 20 is used to store application software and various types of data installed on the terminal, such as the program code installed on the terminal. The memory 20 may also be used to temporarily store data that has been output or will be output. In one embodiment, the memory 20 stores a nematode body bending behavior recognition and counting program 40, which can be executed by the processor 10 to implement the nematode body bending behavior recognition and counting method of this application.
[0112] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor, or other data processing chip, used to run program code stored in the memory 20 or process data, such as executing the method for recognizing and counting the nematode's body bending behavior.
[0113] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. The display 30 is used to display information on the terminal and to display a visual user interface. The components 10-30 of the terminal communicate with each other via a system bus.
[0114] In one embodiment, when the processor 10 executes the identification and counting program 40 for nematode body bending behavior in the memory 20, it implements the steps of the nematode body bending behavior identification and counting method described above.
[0115] The present invention also provides a computer-readable storage medium storing a program for identifying and counting nematode body bending behavior, wherein the program, when executed by a processor, implements the steps of the method for identifying and counting nematode body bending behavior as described above.
[0116] In summary, this invention provides a method and related equipment for identifying and counting the bending behavior of nematodes. The method includes: acquiring a nematode video; performing frame-by-frame processing on the nematode video to obtain an original grayscale image; obtaining a binary image of the nematode based on the original grayscale image; obtaining the head and tail coordinates based on the original grayscale image of the nematode using a numerical coordinate regression algorithm based on a convolutional neural network; calculating the peak point on the center line of the nematode based on the binary image of the nematode using a feature point extraction algorithm based on curvature; calculating the maximum distance from the peak point to the line connecting the nematode's pharynx and tail; and calculating the number of bending events of the nematode's body based on the change in the maximum distance in each frame. This invention improves the accuracy of head and tail coordinate identification based on a numerical coordinate regression algorithm using a convolutional neural network, and achieves a simpler and faster calculation of the number of bending events of the nematode's body by extracting feature points.
[0117] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal that includes that element.
[0118] Of course, those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware (such as a processor, controller, etc.). The program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The computer-readable storage medium can be a memory, magnetic disk, optical disk, etc.
[0119] It should be understood that the application of the present invention is not limited to the examples above. Those skilled in the art can make improvements or modifications based on the above description, and all such improvements and modifications should fall within the protection scope of the appended claims.
Claims
1. A method of identifying and counting body bending behavior of nematodes, characterized by, The method for identifying and counting the nematode's body bending behavior includes: Acquire a nematode video, perform frame segmentation on the nematode video to obtain an original grayscale image, and obtain a nematode binary image based on the original grayscale image; Based on the original grayscale image of the nematode, the head coordinates and tail coordinates are obtained using a numerical coordinate regression algorithm based on a convolutional neural network. Based on the binary image of the nematode, the peak point on the center line of the nematode is calculated using a feature point extraction algorithm based on curvature. Calculate the maximum distance from the peak point to the line connecting the nematode's pharynx and tail, and calculate the number of times the nematode's body bends based on the change in the maximum distance in each frame; The step of calculating the peak point on the center line of the nematode based on the binary image of the nematode using a feature point extraction algorithm based on curvature specifically includes: Based on the head and tail coordinates of the nematode, the outline points of the nematode's body are divided into a ventral point set and a dorsal point set. Resample the ventral and dorsal point sets by distance using linear interpolation with a sample size of n to obtain a dorsal point set and a ventral point set , Calculate a centerline point set of the worm body denoted as: ; wherein , ; wherein, is an index increment, is a parameter that limits the search area, j is an index of the backside point set after resampling, m is a search area distance; The centerline of the nematode is calculated, and the length of the nematode's body is obtained by summing the distances between adjacent points. One-tenth of the length of the nematode's central line is selected as the pharynx. Based on the convexity and concavity of the nematode's body, the curvature κ of each point on the central line is calculated and marked with positive and negative signs. The inflection point of the nematode's body centerline is obtained by the sign change of curvature κ. The maximum value of the absolute value of curvature between two consecutive inflection points is recorded as the peak point. The calculation involves determining the maximum distance from the peak point to the line connecting the nematode's pharynx and tail, and calculating the number of body bends of the nematode based on the change in the maximum distance in each frame. Specifically, this includes: Connect the pharynx and tail of the nematode with a straight line, and calculate the vertical distance from each peak point of the nematode's body to the line connecting the pharynx and tail. In each subsequent frame, the maximum or minimum vertical distance from the peak point to the line connecting the pharynx and tail is selected as a reference value for calculating the number of times the nematode's body bends. The count progresses when the portion behind the nematode's pharynx reaches its maximum curvature, opposite to the previous count.
2. The method of identifying and counting nematode body flexure behavior according to claim 1, wherein, The process of acquiring the nematode video, performing frame-by-frame processing on the nematode video to obtain an original grayscale image, and obtaining a binary image of the nematode based on the original grayscale image specifically includes: The acquired nematode video is processed by frame segmentation to obtain the original grayscale image; The original grayscale image is cropped to obtain the maximum grayscale value of the four corner points of the image, wherein at least one corner point is never part of the nematode's body, and the pixel value of the background layer of the original grayscale image is determined. The original grayscale image is scanned using a sliding window of a preset size, and the average value and standard deviation of the pixels at each pixel position within the sliding window are calculated. When the average value of the calculated pixel values is less than 70% of the background pixel values or the standard deviation is greater than 30% of the average value, the center pixel of the sliding window is assigned a value of 0, which is considered part of the nematode's body; otherwise, the center pixel within the sliding window is assigned a value of 1, which is considered the background. Use morphological closure operators to remove small spots inside nematodes; After obtaining the binary image of the nematode, denoising is performed based on a sequential algorithm of component labeling to obtain the nematode.
3. The method of identifying and counting nematode body flexure behavior according to claim 2, wherein, The process of obtaining the head and tail coordinates based on the original grayscale image of the nematode using a numerical coordinate regression algorithm based on a convolutional neural network specifically includes: The coordinates of the nematode's head and tail were manually labeled. Generating head and tail heat maps of nematodes of a preset size using convolutional neural networks and tail heat maps ; Head heat map and tail heat map Normalization processing based on a Softmax function to obtain a head normalized heat map and tail normalized heat map : ; ; Normalizing heat maps from the head using DSNT and tail using DSNT obtain head and tail coordinates.
4. The method for identifying and counting the body bending behavior of nematodes according to claim 3, characterized in that, The head and tail coordinates are obtained from the head and tail normalized heat maps using DSNT and tail normalized heat maps comprising specifically: a head normalized heat map , a tail normalized heat map , and a coordinate matrix and to the DSNT layer; Normalized head heat map Tail normalized heatmap with normalized coordinate matrix and Multiply the elements together and take the average of the resulting matrices; The predicted head coordinates of the nematode are as follows: ; The predicted coordinates of the nematode's tail are as follows: ; wherein is the coordinate prediction value, the subscript denotes the head, the subscript denotes the tail, denotes the Frobenius inner product operation; The mean square error between the predicted coordinates and the correctly labeled head and tail coordinates is used as the loss. Computing coordinate predictions and the correctly labeled head-tail coordinate values the two-dimensional Euclidean distance between them, the Euclidean loss function is defined as: ; Regularization, when incorporated into the DSNT loss function, is expressed as: ; in, It is the regularization coefficient, used to set the regularization. The strength, It is a single-channel normalized heatmap.
5. The method of identifying and counting nematode body flexure behavior according to claim 1, wherein, The calculation of the maximum distance from the peak point to the line connecting the nematode's pharynx and tail, and the calculation of the number of body bends based on the change in the maximum distance per frame, also includes: The vertical distance from the peak point to the line connecting the pharynx and tail is marked with positive and negative signs. Starting from the head of the nematode, the distance corresponding to the peak point in the counterclockwise direction is marked as a negative value, and vice versa.
6. A system for identification and counting of nematode body bending behavior, characterized by, The system for identifying and counting nematode body bending behavior is used to implement the method for identifying and counting nematode body bending behavior according to any one of claims 1-5, wherein the system for identifying and counting nematode body bending behavior includes: The image processing module is used to acquire nematode video, perform frame-by-frame processing on the nematode video to obtain an original grayscale image, and obtain a nematode binary image based on the original grayscale image; The coordinate calculation module is used to obtain the head coordinates and tail coordinates based on the original grayscale image of the nematode using a numerical coordinate regression algorithm based on a convolutional neural network. The feature extraction module is used to calculate the peak points on the center line of the nematode based on the binary image of the nematode using a feature point extraction algorithm based on curvature. The bending counting module is used to calculate the maximum distance from the peak point to the line connecting the nematode's pharynx and tail, and to calculate the number of body bends based on the change in the maximum distance in each frame.
7. A terminal, characterized by comprising: The terminal includes: a memory, a processor, and a program for identifying and counting nematode body bending behavior stored in the memory and executable on the processor. When the program for identifying and counting nematode body bending behavior is executed by the processor, it implements the steps of the method for identifying and counting nematode body bending behavior as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a program for identifying and counting nematode body bending behavior, which, when executed by a processor, implements the steps of the method for identifying and counting nematode body bending behavior as described in any one of claims 1-5.
Citation Information
Patent Citations
Clothes pattern identification method based on contour curvature feature points and support vector machine
CN106384126A
Nematode tracking and imaging analysis device
CN110502037A