Drosophila behavior recognition method based on ResNet50

Through the neural network model based on ResNet50, combined with video preprocessing and annotation technology, the fine behavior of fruit flies is identified, which solves the problem that existing technology cannot accurately identify the fine behaviors of fruit flies, achieves efficient and accurate fruit fly behavior recognition, and improves improve research efficiency.

CN118658183APending Publication Date: 2024-09-17ZHEJIANG UNIV
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410817061.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

Existing fruit fly behavior identification methods cannot accurately distinguish the fine behaviors of fruit flies, and the existing technology is difficult to apply to the high movement frequency and small size characteristics of fruit flies.

Method used

Using a neural network model based on ResNet50, the model is trained through video preprocessing and annotated picture sets to identify fruit fly behaviors, including resting, front leg grooming, hind leg grooming, walking, and kissing, and extract motion through pixel absolute value subtraction feature.

Benefits of technology

It achieves efficient and accurate identification of fruit fly behavior, reduces human subjective errors, significantly improves research efficiency, and promotes the development of fruit fly behavioral research.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118658183A
    Figure CN118658183A
Patent Text Reader

Abstract

The invention discloses a fruit fly behavior identification method based on ResNet50. According to the method, preprocessing is carried out through a picture pixel absolute value subtraction method, and extraction of motion features of adjacent frames of drosophila melanogaster is achieved; by utilizing a deep learning model, the accuracy of behavior recognition is improved, and human subjective errors are reduced; and video data are automatically processed and analyzed, so that the workload of manual observation and recording is remarkably reduced. According to the fruit fly behavior recognition method, an efficient and accurate tool is provided for biological research, the research efficiency can be remarkably improved, and development of fruit fly behavioral research is promoted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of computer vision and biological behavior analysis, and in particular to a fruit fly behavior recognition method based on ResNet50. Background Art

[0002] As a common model organism, Drosophila not only has conventional advantages such as easy breeding and fast reproduction, but also has highly conserved genes, similar behavioral logic to mammals, shared metabolic pathways, a relatively simple nervous system and abundant genetic tools. Therefore, Drosophila has become an important model in experiments on studying instinctive behavior and quantitatively describing behavioral characteristics.

[0003] The significance of fruit fly behavior recognition in the field of biology is multifaceted. Researchers can infer which neurons are involved in the generation of specific behaviors by coupling fruit fly behavior with neuronal firing, thus facilitating the construction of neural circuits. At the same time, many genes are associated with specific behavioral phenotypes. Through behavioral recognition, researchers can explore how specific genes affect behavioral phenotypes, thereby revealing the complex relationship between genes and behaviors. In addition, the application of fruit fly behavior recognition technology helps to widely apply fruit flies to behavioral research, providing a window for observing and understanding the mechanism of fruit fly behavior.

[0004] Existing methods for identifying fruit fly behavior mainly rely on the Flybox system, and finally use MATLAB (SCAMP) software to analyze the behavior of fruit flies. This method can only obtain information on whether the fruit fly is moving, and cannot distinguish fine behaviors such as walking and grooming.

[0005] With the development of computer technology and artificial intelligence, automated behavior recognition technology has gradually become possible. Video-based behavior analysis methods provide researchers with an efficient means to extract fruit fly behavior data from videos through computer vision technology and automatically analyze them. However, a literature search of the prior art found that there are currently no relevant patents for accurately identifying the fine behaviors of fruit flies. Other recognition methods applicable to other organisms include "Behavior Recognition Method and Device, (Application Number: CN202211652169.6)" and "Behavior Recognition Method and Device, (Application Number: CN202310416768.6)". The former is based on human skeleton coordinates for action recognition, while the latter is based on extracting action key frame features for behavior recognition. Fruit flies are small in size and have a high frequency of movement, so these methods cannot be well applied to fruit flies. Summary of the invention

[0006] The purpose of the present invention is to provide a fruit fly behavior recognition program based on video processing and neural network model to solve the deficiencies in the prior art. By efficiently and accurately identifying fruit fly behavior, the present invention can significantly improve the automation level of behavior research, reduce human subjective errors, and improve research efficiency. The purpose of the present invention is achieved by the following technical solutions.

[0007] The present invention first provides a fruit fly behavior recognition method based on ResNet50, comprising the following steps:

[0008] 1) Fix the head of the fruit fly and shoot a video of its behavior;

[0009] 2) Preprocessing the video according to different behaviors of the fruit fly in the video shot in step 1) to obtain a picture containing the fruit fly;

[0010] 3) labeling the images obtained in step 2) according to different behaviors of fruit flies to obtain a labeled image set;

[0011] 4) Build a ResNet50 neural network basic model and use the labeled image set to train the model to obtain a fruit fly behavior recognition and classification model;

[0012] 5) performing the operation of step 2) on the fruit fly behavior video to be identified, obtaining a set of pictures to be identified, identifying and classifying the set of pictures to be identified using the fruit fly behavior identification model, and outputting the processing result of the fruit fly behavior identification model;

[0013] 6) The processing results of the fruit fly behavior recognition model are condensed and merged to finally obtain the fruit fly behavior recognition results.

[0014] As a preferred embodiment of the present invention, when shooting the fruit fly behavior video in step 1), the head of the fruit fly is fixed, and the fruit fly is placed on a floating ball that can rotate freely, and the fruit fly behavior video is obtained by side shooting.

[0015] As a preferred embodiment of the present invention, the video is preprocessed in step 2) as follows: intercepting a picture of the area containing the fruit fly in the video, subtracting the absolute pixel values ​​of two adjacent frames and outputting the result, and increasing or decreasing the contrast of the picture according to a set contrast threshold, thereby extracting the changes in the body parts of the fruit fly in adjacent frames. Furthermore, the behavior of the fruit fly includes resting, front leg grooming, hind leg grooming, walking, and kissing; since kissing and other behaviors can occur simultaneously, the kissing behavior in the video is preprocessed separately, and when preprocessing the fruit fly kissing behavior, the process of subtracting the absolute pixel values ​​of two adjacent frames and outputting the result is skipped, and the area picture of the video containing the fruit fly kissing behavior is directly intercepted.

[0016] As a preferred solution of the present invention, the step 6) is specifically: merging the recognition results of the fruit fly behavior recognition model into a one-dimensional array X={x1, x2, ..., x N}; Take the duration of a single behavior of a fruit fly as v seconds as the duration of each group and group them according to the video shooting sequence. Each group of videos has k frames, so there are M groups in total, M = N / k; Count the number of times each category appears in the group, and get M vectors counts of length C i ={c i1 ,c i2 ,…c ij …,c iC}, where c ij Indicates the number of times category j appears in the i-th group; find the category with the most occurrences in the group, i.e. argmax j c ij , use this category to represent the category of the group; finally, a one-dimensional array Y={y1,y2,…y i …,y M}, where y i Indicates the category of the i-th group.

[0017] The present invention also provides a fruit fly behavior identification system for implementing the above-mentioned fruit fly behavior identification method, comprising:

[0018] The fruit fly behavior recognition video acquisition module is used to fix the head of the fruit fly and then shoot the behavior video of the crawling fruit fly;

[0019] A data preprocessing module is used to preprocess the video accordingly according to the different behaviors of the fruit flies in the fruit fly behavior video, intercept the area containing the fruit flies in the video, and obtain the corresponding picture;

[0020] The image annotation module is used to annotate the images obtained in the data preprocessing module according to the different behaviors of fruit flies, and obtain the annotated image set.

[0021] The fruit fly behavior recognition and classification model training module is used to build a ResNet50 neural network basic model and train the model using the annotated image set to obtain a fruit fly behavior recognition and classification model;

[0022] The fruit fly behavior recognition module is used to use the fruit fly behavior recognition model to recognize and classify the pre-processed images to be recognized, and output the processing results of the fruit fly behavior recognition model;

[0023] The recognition result reduction module is used to reduce and reduce the processing results of the fruit fly behavior recognition model to finally obtain the fruit fly behavior recognition results.

[0024] Compared with the prior art, the present invention has the following beneficial effects:

[0025] The present invention performs preprocessing by subtracting the absolute values ​​of picture pixels to extract the motion features of fruit flies in adjacent frames; utilizes a deep learning model to improve the accuracy of behavior recognition and reduce human subjective errors; and automatically processes and analyzes video data to significantly reduce the workload of manual observation and recording.

[0026] The fruit fly behavior identification program of the present invention provides an efficient and accurate tool for biological research, which can significantly improve research efficiency and promote the development of fruit fly behavior research. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 is a flow chart of the present invention;

[0028] Figure 2 is an instance graph of the original video;

[0029] Figure 3 This is an example diagram after subtracting fruit flies with different behaviors;

[0030] Figure 4 It is the accuracy heat map of test data recognition;

[0031] Figure 5 This is a diagram of experimental results of the present invention applied to fruit fly behavior recognition under a two-photon microscope. DETAILED DESCRIPTION

[0032] The present invention is further described and illustrated below in conjunction with specific embodiments. The embodiments are merely exemplary of the present disclosure and do not define the scope of limitation. The technical features of each embodiment of the present invention may be combined accordingly without conflicting with each other.

[0033] In order to widely apply fruit flies to behavioral research and provide a window for observing and understanding the mechanism of fruit fly behavior, the present invention provides a fruit fly behavior recognition method based on ResNet50. Figure 1 As shown, the method of the present invention comprises the following steps:

[0034] Step 1: Fix the fruit fly's head and shoot a video of its behavior;

[0035] like Figure 2 As shown, in a specific embodiment of the present invention, the head of a fruit fly is fixed under a two-photon microscope, and the fruit fly is placed on a freely rotating floating ball, and a video of the fruit fly behavior is recorded using a side-shot camera.

[0036] Step 2: According to the different behaviors of the fruit flies in the video shot in step 1, the video is preprocessed to obtain a picture containing the fruit flies;

[0037] Process the video of fruit fly behavior. Cut out the area containing the fruit fly in the video, subtract the absolute value of the pixels of two adjacent frames and output them, and increase or decrease the contrast of the image according to the set contrast threshold to extract the fruit fly. Figure 3 Adjacent frames show changes in the fruit fly's legs and other body parts.

[0038] Furthermore, the behaviors of fruit flies include resting, front leg grooming, hind leg grooming, walking, and kissing. Since kissing and other behaviors can occur simultaneously, the kissing behavior in the video is preprocessed separately, and when preprocessing the fruit fly's kissing behavior, the process of subtracting the absolute values ​​of pixels of two adjacent frames and then outputting them is skipped, and the area image in the video containing the fruit fly's kissing behavior is directly captured.

[0039] Step 3: Label the pictures obtained in step 2 according to the different behaviors of fruit flies to obtain a labeled picture set;

[0040] Step 4: Build a ResNet50 neural network basic model and train the model using the annotated image set to obtain a fruit fly behavior recognition and classification model;

[0041] Based on the processed images, typical fruit fly behaviors are divided, and the divided fruit fly images and behavior data are used as input for ResNet parameter learning, and the model parameters are updated through back propagation of loss. After the training is completed, the accuracy change curve is output, and the model with the highest accuracy is selected for subsequent recognition.

[0042] In a specific embodiment of the present invention, the Resnet50 residual network is used for training and prediction. The ResNet50 neural network basic model includes a convolution layer, a regularization layer, an activation function, a maximum pooling layer, and a residual module; the convolution layer is used to convolve the input image, and the regularization layer is used to alleviate the gradient disappearance and gradient explosion problems, so that the ResNet50 neural network basic model can converge faster, improve training efficiency, and enhance the model generalization ability; the activation function uses the ReLU function to introduce nonlinear elements into the neural network; the maximum pooling layer realizes feature extraction and reduces the size of the feature tensor; the residual module is used to enhance the nonlinear fitting ability and reduce the number of parameters and calculations. After the input is convolved, regularized, activated, and maximum pooled, it passes through the middle 48 convolution layers and is finally output after average pooling, flattening, and full connection layers.

[0043] During the training process, the loss function between the true label y and the predicted category in the training data set is calculated, and the gradient of the loss function with respect to the model parameters is calculated; the gradient is propagated from the output layer to the input layer using the chain rule, and the value of each parameter is updated to minimize the loss function; through back propagation, the weights and biases in the network are adjusted so that the loss function converges on a given training sample or reaches the set training rounds; the expression of the loss function is:

[0044]

[0045] Among them, y is the true label, is the predicted probability of the model, N is the number of samples, and C is the number of categories; ij is the true label of the i-th sample in category j, is the probability that the model predicts that the i-th sample belongs to category j.

[0046] Step 5: Perform the operation of step 2) on the fruit fly behavior video to be identified, obtain a set of pictures to be identified, use the fruit fly behavior recognition model to identify and classify the set of pictures to be identified, and output the processing result of the fruit fly behavior recognition model;

[0047] In a specific embodiment of the present invention, the fruit fly behavior video to be identified is input into the trained fruit fly behavior recognition model after being processed in step 2, the output tensor is converted into a python list, and the elements in the list are extracted and compared. The behavior corresponding to the data with the largest value is the behavior corresponding to the frame. The prediction results are output to a csv file.

[0048] like Figure 4 As shown, the recognition accuracy of the test data is shown. In a specific embodiment of the present invention, the test video has a total of 80,000 frames, and the method of the present invention is used for prediction to obtain the prediction results; then starting from the first picture, one frame of video is taken every 100 frames for manual recognition and recording; finally, the prediction results are compared with the results of manual recognition, and the recognition accuracy of the front leg grooming behavior is 99%, the recognition accuracy of the hind leg grooming behavior is 87%, the recognition accuracy of the stationary behavior is 97%, and the recognition accuracy of the walking behavior is 98%. The recognition accuracy will be further improved after the step five shrinking step.

[0049] Step 6: Merge the processing results of the fruit fly behavior recognition model to finally obtain the fruit fly behavior recognition results.

[0050] The recognition results of the fruit fly behavior recognition model are combined into a one-dimensional array X = {x1, x2, ..., x N}; Take the duration of a single behavior of a fruit fly as v seconds as the duration of each group and group them according to the video shooting sequence. Each group of videos has k frames, and there are M groups in total, M = N / k; Count the number of occurrences of each category in the group to obtain M vectors ts of length C i ={c i1 ,c i2 ,…c ij …,c iC}, where c ij Indicates the number of times category j appears in the i-th group; find the category with the most occurrences in the group, i.e. argmax j c ij , use this category to represent the category of the group; finally, a one-dimensional array Y={y1,y2,…y i …,y M}, where y i Indicates the category of the i-th group.

[0051] In a specific embodiment of the present invention, the duration of a single behavior of a fruit fly should be greater than 0.5 seconds. Therefore, when grouping, the video shooting duration is 0.5 seconds. Each group of videos includes 30 frames of pictures. The number of occurrences of each behavior category in these 30 frames is counted. If the number of occurrences of the behavior is greater than 15 frames, this category is determined to be the behavior of the fruit fly within 0.5 seconds, otherwise the behavior is determined to be a transitional behavior.

[0052] like Figure 5 As shown in the figure, the experimental results of the present invention applied to the identification of fruit fly behavior under a two-photon microscope show that the behavior identification results of the present invention can be verified with the data of the rolling speed of the plastic ball where the fruit fly is located obtained by FicTrack. This shows that the present invention provides an efficient and accurate method for identifying the behavior of the fruit fly climbing the ball. In addition, in promoting the development of fruit fly behavioral research, the present invention couples the behavior of the fruit fly with the firing of neurons, and infers which neurons are involved in the generation of specific behaviors, thereby facilitating the construction of neural circuits.

[0053] In fact, this method is applicable to the classification of fine behaviors of animals in most or partially fixed states. This partially fixed state is particularly common when using a microscope to observe the firing of neurons in experimental animals. Therefore, the present invention can also be applied to the identification of fine behaviors of other organisms. In terms of revealing the complex relationship between genes and behaviors, the present invention can explore how specific genes affect behavioral phenotypes through behavioral identification.

[0054] The above-mentioned embodiments only express several implementation methods of the present invention, and the description is relatively specific and detailed, but it cannot be understood as limiting the scope of the present invention. For ordinary technicians in this field, several modifications and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention.

Claims

1. A fruit fly behavior recognition method based on ResNet50, characterized in that: The following steps are involved: 1) Fix the head of the fruit fly and shoot a video of its behavior; 2) Preprocessing the video according to different behaviors of the fruit fly in the video shot in step 1) to obtain a picture containing the fruit fly; 3) labeling the images obtained in step 2) according to different behaviors of fruit flies to obtain a labeled image set; 4) Build a ResNet50 neural network basic model and use the labeled image set to train the model to obtain a fruit fly behavior recognition and classification model; 5) performing the operation of step 2) on the fruit fly behavior video to be identified, obtaining a set of pictures to be identified, identifying and classifying the set of pictures to be identified using the fruit fly behavior identification model, and outputting the processing result of the fruit fly behavior identification model; 6) The processing results of the fruit fly behavior recognition model are condensed and merged to finally obtain the fruit fly behavior recognition results.

2. The method for identifying fruit fly behavior according to claim 1, characterized in that: In the step 1), when shooting the fruit fly behavior video, the head of the fruit fly is fixed, and the fruit fly is placed on a floating ball that can rotate freely, and the fruit fly behavior video is obtained by side shooting.

3. The method for identifying fruit fly behavior according to claim 1, characterized in that: The video is preprocessed in step 2) as follows: capturing an image of the area containing the fruit fly in the video, subtracting the absolute values ​​of the pixels of two adjacent frames and outputting the result, and increasing or decreasing the contrast of the image according to a set contrast threshold, thereby extracting changes in the body parts of the fruit fly in adjacent frames.

4. The method for identifying fruit fly behavior according to claim 3, characterized in that: The behaviors of the fruit fly include resting, front leg grooming, hind leg grooming, walking, and kissing. Since kissing and other behaviors can occur simultaneously, the kissing behavior in the video is preprocessed separately, and when preprocessing the fruit fly kissing behavior, the process of subtracting the absolute values ​​of pixels of two adjacent frames and then outputting them is skipped, and the area image in the video containing the fruit fly kissing behavior is directly captured.

5. The method for identifying fruit fly behavior according to claim 1, characterized in that: The ResNet50 neural network basic model includes a convolution layer, a regularization layer, an activation function, a maximum pooling layer and a residual module; the convolution layer is used to convolve the input image, and the regularization layer is used to alleviate the gradient disappearance and gradient explosion problems, so that the ResNet50 neural network basic model can converge faster, improve training efficiency, and enhance the model generalization ability; the activation function uses the ReLU function to introduce nonlinear elements into the neural network; the maximum pooling layer realizes feature extraction and reduces the size of the feature tensor; the residual module is used to enhance the nonlinear fitting ability and reduce the number of parameters and calculations.

6. The method for identifying fruit fly behavior according to claim 5, characterized in that: During the training process of step 3), the loss function between the true label y and the predicted category in the training data set is calculated, and the gradient of the loss function with respect to the model parameters is calculated; the gradient is propagated from the output layer to the input layer using the chain rule, and the value of each parameter is updated to minimize the loss function; through back propagation, the weights and biases in the network are adjusted so that the loss function converges on a given training sample or reaches the set training round; the expression of the loss function is: Among them, y is the true label, is the predicted probability of the model, N is the number of samples, and C is the number of categories; ij is the true label of the i-th sample in category j, is the probability that the model predicts that the i-th sample belongs to category j.

7. The method for identifying fruit fly behavior according to claim 1, characterized in that: The step 6) is specifically as follows: merging the recognition results of the fruit fly behavior recognition model into a one-dimensional array X={x1, x2, ..., x N }; Take the duration of a single behavior of a fruit fly as v seconds as the duration of each group and group them according to the video shooting sequence. Each group of videos has k frames, so there are M groups in total, M = N / k; Count the number of times each category appears in the group, and get M vectors counts of length C i ={c i1 ,c i2 ,…c ij …,c iC }, where c ij Indicates the number of times category j appears in the i-th group; find the category with the most occurrences in the group, i.e. argmax j c ij , use this category to represent the category of the group; finally, a one-dimensional array Y={y1,y2,…y i …,y M }, where y i Indicates the category of the i-th group.

8. A fruit fly behavior identification system for implementing the fruit fly behavior identification method according to claim 1, characterized in that: include: The fruit fly behavior recognition video acquisition module is used to fix the head of the fruit fly and then shoot the behavior video of the crawling fruit fly; A data preprocessing module is used to preprocess the video accordingly according to the different behaviors of the fruit flies in the fruit fly behavior video, intercept the area containing the fruit flies in the video, and obtain the corresponding picture; The image annotation module is used to annotate the images obtained in the data preprocessing module according to the different behaviors of fruit flies, and obtain the annotated image set. The fruit fly behavior recognition and classification model training module is used to build a ResNet50 neural network basic model and train the model using the annotated image set to obtain a fruit fly behavior recognition and classification model; The fruit fly behavior recognition module is used to use the fruit fly behavior recognition model to recognize and classify the pre-processed images to be recognized, and output the processing results of the fruit fly behavior recognition model; The recognition result reduction module is used to reduce and reduce the processing results of the fruit fly behavior recognition model to finally obtain the fruit fly behavior recognition results.

Citation Information

Patent Citations

  • Insect behavior recognition method and device based on space-time context

    CN111476119A

  • Insect dynamic behavior identification method based on deep learning and image technology

    CN113298023A

  • ConvLSTM network-based Mouse open field experiment behavior analysis method

    CN113569675A

  • Animal behavior recognition method based on multi-clue fusion

    CN114743134A

  • Insect behavior identification method based on YOLO V7 and 2D convolutional network

    CN117275084A