A method, apparatus and system for identifying voluntary movement of an experimental animal
Patent Information
- Application Number
- CN202411266627.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-26
- Publication Date
- 2026-09-22
- Estimated Expiration
- 2044-02-26
AI Technical Summary
[0003]自动识别动物运动状态面临两个技术问题:1、动物的运动存在主动运动与被动运动(如强迫游泳中的惯性漂浮,悬尾任务中的单摆运动等)的差别,研究者通常需要识别动物的主动运动,但被动运动会干扰帧间差分等自动化识别方法,使识别准确度下降;2、在数据分析和呈现方面,多以总不动时间/不动时间占比为指标,没有在时间维度上对动物运动状态进行细颗粒度描述,如分时间窗的方式报告随时间变化的运动序列,使得研究者无法深入挖掘动物的不同行为模式背后的认知机制
[0085]1、本申请在检测动物行为的过程中排除了动物被动运动的干扰,提升了识别动物主动运动状态的准确率;
Smart Images

Figure CN119206863B_ABST
Abstract
Description
Technical Field
[0001] This invention is a divisional application of a patent filed on February 26, 2024, with application number 2024102081882, entitled "A Method, Device, and System for Detecting Behavior in Laboratory Animals." This invention relates to the field of image recognition technology, and more specifically, to a method, device, system, and computer-readable storage medium for recognizing the active movement of laboratory animals. Background Technology
[0002] Forced swimming and tail suspension tests are the most commonly used models of depressive behavior in mice and rats, playing an important role in neuroscience and drug-related research. However, traditional studies based on these two paradigms usually require manual annotation of animal movement states, which is time-consuming and labor-intensive. Although there are a few products that automatically identify animal behavior (such as VisuTrack rodent behavior video analysis software and Any-Maze), these software programs are expensive, provide limited data indicators, and are inconvenient to use. There is an urgent need for a user-friendly and relatively accurate automated method for identifying movement states.
[0003] Automatic identification of animal movement states faces two technical challenges: 1. Animal movement can be divided into active and passive movements (such as inertial buoyancy in forced swimming or pendulum motion in tail suspension tasks). Researchers typically need to identify active movements, but passive movements can interfere with automated identification methods such as frame difference analysis, reducing accuracy. 2. In terms of data analysis and presentation, the ratio of total immobility time to immobility time is often used as an indicator, without providing a granular description of animal movement states over time, such as reporting movement sequences that change over time using time windows. This prevents researchers from deeply exploring the cognitive mechanisms behind different behavioral patterns in animals.
[0004] In terms of animal movement state detection methods, the methods for automatically detecting animal movement state in forced swimming and tail suspension experiments can be roughly divided into two types: deep learning-based and traditional computer vision-based. (1) Shanghai Xinruan VisuTrack rodent behavior video analysis software and American Any-Maze animal behavior video analysis software, the technical methods are unknown. Their hardware and software costs are high, they cannot customize detection technology solutions, they do not have fine time granular data analysis and presentation methods, and they do not support manual annotation of custom time window lengths. (2) Methods based on deep learning models such as DeepLabcut detect animal joints through deep learning models, and judge the animal movement state based on the joint movement trajectory in the training model. A large amount of data needs to be manually annotated for fine-tuning of the key point recognition model. In addition, recognizing specific actions requires training an action classification model, which also requires a large amount of data annotation. The deployment and application of this type of solution is very inconvenient. Both of the current solutions have some problems: (1) The traditional computer vision-based method is affected by the difference in camera distance and angle, resulting in low recognition accuracy. In addition, it is difficult to distinguish between the active movement of animals and passive movements such as inertial floating and swaying. (2) Deep learning-based methods usually require manual annotation of a large amount of data for fine-tuning of the key point recognition pre-trained model. In addition, training the action classification model is required to recognize specific actions, making the deployment and application of such solutions very inconvenient.
[0005] In terms of animal movement data analysis, existing methods simply analyze the total time and proportion of different movement states throughout the entire experiment, which cannot reflect the dynamic development process of animal movement states over time, let alone explore the cognitive computing mechanisms behind movement behavior. Summary of the Invention
[0006] In view of the above problems, this invention proposes a method based on classical computer vision, which is insensitive to camera distance and angle, and can eliminate interference from passive animal movement. Furthermore, it can report animal movement sequences in a time-window manner, providing data for in-depth analysis of animal movement behavior patterns and for analyzing the cognitive computation mechanisms underlying the dynamic development and changes in animal movement states based on reinforcement learning models. This solution is plug-and-play, and users can highly customize parameters such as calibration methods, feature extraction methods, denoising methods, and recognition thresholds. It can also fit the animal's movement behavior development process based on various models such as RW models, counterfactual models, and models considering physical exertion, analyzing the cognitive computation mechanisms behind movement behavior.
[0007] An active motion recognition method based on laboratory animals, comprising:
[0008] Obtain videos of laboratory animals;
[0009] Contour recognition was performed on the video of the experimental animal to obtain a sequence of contour images;
[0010] Based on the relative invariance of the experimental animal's outline under passive motion, each frame of the outline map sequence is predicted to obtain a predicted passive motion outline map sequence; the difference between the outline map sequence and the predicted passive motion outline map sequence is calculated to obtain the outline map sequence after passive motion cancellation.
[0011] Behavior sequences are obtained by performing behavior detection based on the contour map sequence after passive motion cancellation.
[0012] Furthermore, the relative invariance refers to the relative invariance of the contour corner points;
[0013] Preferably, the step of predicting the predicted passive motion contour map sequence based on the relative invariance of contour corner points includes: performing corner point detection on each frame of the contour map sequence to obtain corner point P0, calculating the passive motion corner point P1 corresponding to corner point P0 in the next frame of the contour map, using affine transformation to predict the predicted passive motion corner point P′1 corresponding to P0 in the next frame of the contour map, minimizing the distance between the passive motion corner point P1 and the predicted passive motion corner point P′1 to obtain the affine transformation, and sequentially applying the affine transformation to each frame of the contour map sequence to obtain the predicted passive motion contour map sequence;
[0014] Preferably, the passive motion corner point P1 corresponding to corner point P0 in the next frame contour map is calculated using the optical flow method;
[0015] Preferably, the optical flow method includes one or more of the following: Lucas-Kanade method, Horn-Schunck method, Farneback method, pyramid Lucas-Kanade optical flow algorithm, and deep learning-based optical flow algorithm;
[0016] Preferably, the corner point P1 is identified using the Lucas-Kanade optical flow algorithm, and the contour map is divided into 2... s The scale is scaled to different levels, and the optical flow V is first calculated at the smallest scale level. s and the optical flow V s Used as the initial value for calculating optical flow V at the previous scale s-1 The process is iterated until the optical flow V at the largest scale is obtained. 0 ;
[0017] The preferred method for calculating optical flow V is as follows:
[0018]
[0019] Among them I x with I y These are the gray-level gradients of the image in the x and y directions, respectively, I tLet represent the gradient of image grayscale over time, and n×n represent the size of the local image region for solving the gradient.
[0020] Furthermore, the corner detection method includes one or more of the following: Harris corner detection, Shi-Tomasi corner detection, FAST corner detection, ORB corner detection, GFTT corner detection, and Moravec corner detection;
[0021] Preferably, the corner detection is performed using Harris corner detection. The window slides along the x and y directions of the image, and the grayscale change within the window is calculated. For each window position, the corner response function is calculated, and a response function threshold is set. For pixels whose corner response function is greater than the response function threshold, non-maximum suppression is used to filter local optimal corners, and the filtered corners are included in the corner P0.
[0022] Preferably, the formula for calculating the corner response function is as follows:
[0023] R = det(M) - k(trace(M)) 2
[0024] Where R represents the corner response function, det(M) is the determinant of the covariance matrix M, trace(M) is the trace of the covariance matrix M, k is a constant, and the calculation of the covariance matrix M is based on the gradient information of the local region of the image, with gradients Ix and Iy in the x and y directions respectively. x and I y The covariance matrix M is defined as follows:
[0025]
[0026] Where w(x,y) is the weight of the pixel in the window, I x with I y These are the grayscale gradients of the window image in the x and y directions, respectively.
[0027] Furthermore, an intersection contour map sequence is obtained by calculating the neighborhood of the contour map sequence after passive motion cancellation, and behavior detection is performed based on the intersection contour map sequence;
[0028] Preferably, the intersection contour map is obtained using a three-frame method, wherein the three-frame method includes: calculating the contour map I(t) of the current frame in the contour map sequence and the predicted passive motion contour map of the corresponding frame in the predicted passive motion contour map sequence. The difference is used to obtain the first difference image, and the contour map I(t+1) of the next frame in the contour map sequence and the predicted passive motion contour map of the corresponding frame in the predicted passive motion contour map sequence are calculated. The difference is used to obtain the second difference image. The first difference image and the second difference image are ANDed to obtain the intersection contour map of the three-frame method. The intersection contour map of each frame is calculated in sequence to form the intersection contour map sequence.
[0029] Preferably, the first difference image is binarized to obtain a first binary image, the second difference image is binarized to obtain a second binary image, and the first binary image and the second binary image are ANDed to obtain a three-frame intersection contour map. The intersection contour map of each frame is calculated sequentially to form the intersection contour map sequence.
[0030] Furthermore, the behavior detection uses the image frame difference method to determine the animal's behavior, which determines the animal's behavior based on the area threshold of the difference image between adjacent frames.
[0031] Preferably, the image frame difference method binarizes the difference images of adjacent frames according to a threshold to obtain a binarized image, and judges the animal's behavior based on the area threshold of the binarized image;
[0032] Preferably, the binarized image is subjected to morphological processing before behavior detection, and the morphological processing includes one or more of the following: dilation, erosion, opening operation, and closing operation.
[0033] Furthermore, the behavior sequence is divided into time windows according to a preset time granularity. The state of the time window is determined as active motion based on the proportion of the number of frames with motion state sequences greater than a threshold within the time window to the total number of frames in the time window. The above judgment is performed on all time windows to obtain the behavior sequence with the set time granularity.
[0034] Preferably, the motion state sequence is processed to obtain a processed sequence, the processed sequence is divided into time windows according to a preset time granularity, and the judgment is performed on all time windows to obtain a behavior sequence with a set time granularity. The data processing includes one or more of the following: floating-point conversion and Gaussian smoothing.
[0035] Furthermore, the contour recognition is performed after preprocessing the video of the experimental animal. The preprocessing includes one or more of the following: camera calibration, recognition area selection, and recognition area standardization.
[0036] A method for analyzing the cognitive mechanisms of experimental animal behavior, the method comprising:
[0037] The behavioral sequence of the experimental animal is obtained by using the above-mentioned method for detecting the active movement of the experimental animal.
[0038] The behavioral sequences of the experimental animals in different experimental animal groups were spliced together to obtain the group behavioral sequences of different experimental animal groups;
[0039] The group behavior sequence was fitted using a Bayesian modeling method to obtain the model and parameters;
[0040] The cognitive mechanisms of the experimental animal group were analyzed based on the model and parameters described above.
[0041] Furthermore, the Bayesian modeling method includes one or more of the following: Rescorla-Wagner model, counterfactual model, and physical strength model;
[0042] Preferably, the Rescorla-Wagner model is used to fit the group behavior sequence. The Rescorla-Wagner model is as follows:
[0043]
[0044] δ=R t -V t
[0045] in, Let α be the probability of the experimental animal moving voluntarily, τ be the reciprocal of temperature, V be the value corresponding to voluntary movement, α be the learning rate, δ be the prediction error, and R be the reward or punishment experienced by the animal.
[0046] Preferably, a counterfactual model is used to fit the group's behavioral sequence, and the counterfactual model is as follows:
[0047]
[0048] in and V represents the value corresponding to active motion and passive motion, respectively. c and V nc Let δ and δ represent the values corresponding to actions consistent with and inconsistent with the current action, respectively. nc These represent the prediction errors corresponding to behaviors consistent with and inconsistent with the current moment's behavior, respectively.
[0049] Preferably, the group behavior sequence is fitted using a physical fitness model, which is as follows:
[0050]
[0051] V t+1 =V t +αδ
[0052] δ=R t -V t
[0053] S t =tanh(γ(a) tot -i tot ))
[0054] Where S t The physical condition of the animal is represented by γ, the physical condition influence coefficient is β, and the physical condition renewal coefficient is a. tot and i tot These represent the total number of active movements and the total number of passive movements of the animal so far;
[0055] Preferably, a superior model is selected through model comparison, and the cognitive mechanism of the experimental animal group is analyzed based on the superior model and its parameters;
[0056] Preferably, the model is used to generate predicted animal behavior sequences. If the actual experimental animal behavior sequences are located within the posterior confidence interval of the predicted animal behavior sequences, the model is deemed effective.
[0057] Preferably, model comparison is performed using information criteria, which include one or more of the following: AIC, BIC, DIC, MDL, and WAIC.
[0058] Preferably, the model is compared using WAIC, and the model with the smallest WAIC is selected as the winning model. The WAIC is calculated as follows:
[0059] WAIC = -2lppd + 2p waic
[0060]
[0061]
[0062] Where y is the sample observation, θ is the parameter, i represents each sample, and s represents a posterior estimate.
[0063] An active motion recognition system for laboratory animals, comprising:
[0064] Acquisition module: Used to acquire videos of laboratory animals;
[0065] Contour recognition module: used to perform contour recognition on the video of the experimental animal to obtain a sequence of contour images;
[0066] Passive motion prediction module: used to predict the passive motion contour map sequence for each frame of the contour map sequence based on the relative invariance of the experimental animal contour under passive motion state.
[0067] Passive motion cancellation module: used to calculate the difference between the contour map sequence and the predicted passive motion contour map sequence to obtain the contour map sequence after passive motion cancellation;
[0068] Behavior detection module: used to perform behavior detection based on the contour map sequence after passive motion cancellation to obtain a behavior sequence.
[0069] A cognitive mechanism analysis system for experimental animal behavior, comprising:
[0070] Acquisition module: Used to acquire videos of laboratory animals;
[0071] Contour recognition module: used to perform contour recognition on the video of the experimental animal to obtain a sequence of contour images;
[0072] Passive motion prediction module: used to predict the passive motion contour map sequence for each frame of the contour map sequence based on the relative invariance of the experimental animal contour under passive motion state.
[0073] Passive motion cancellation module: used to calculate the difference between the contour map sequence and the predicted passive motion contour map sequence to obtain the contour map sequence after passive motion cancellation;
[0074] Behavior detection module: used to perform behavior detection based on the contour map sequence after passive motion cancellation to obtain a behavior sequence;
[0075] Group behavior splicing module: used to splice the behavioral sequences of the experimental animals in different experimental animal groups to obtain the group behavior sequences of different experimental animal groups;
[0076] Bayesian modeling module: used to fit the group behavior sequence using Bayesian modeling methods to obtain the model and parameters;
[0077] Cognitive mechanism analysis module: used to analyze the cognitive mechanisms of the experimental animal group based on the model and parameters.
[0078] A device for recognizing active motion in laboratory animals, comprising: a memory and a processor;
[0079] The memory is used to store program instructions; the processor is used to call the program instructions, and when the program instructions are executed, the steps of the active motion recognition method for experimental animals described in any one of the above descriptions are implemented.
[0080] A device for analyzing the cognitive mechanisms of experimental animal behavior, comprising: a memory and a processor;
[0081] The memory is used to store program instructions; the processor is used to call the program instructions, and when the program instructions are executed, the steps of the method for analyzing the cognitive mechanism of experimental animal behavior described in any one of the above descriptions are implemented.
[0082] A computer-readable storage medium for recognizing the active movement of laboratory animals, having stored thereon a computer program, wherein when executed by a processor, the computer program implements the steps of any one of the methods for recognizing the active movement of laboratory animals.
[0083] A computer-readable storage medium for analyzing the cognitive mechanisms of experimental animal behavior, wherein a computer program is stored thereon, and when the computer program is executed by a processor, it implements the steps of the method for analyzing the cognitive mechanisms of experimental animal behavior as described in any one of the claims.
[0084] Advantages of this application:
[0085] 1. This application eliminates the interference of passive animal movement during the detection of animal behavior, thereby improving the accuracy of identifying the active movement state of animals;
[0086] 2. Unlike traditional methods that report simple indicators such as total immobility time / percentage of immobility time, this application reports movement sequences in a time-window manner, providing data for in-depth exploration of animal behavior patterns;
[0087] 3. This application combines information from neighboring image frames with the traditional image frame difference method, thereby reducing the error in behavior detection.
[0088] 4. This application proposes a method for analyzing motion state sequence data, and uses Bayesian modeling to analyze behavioral sequences and explore the cognitive mechanisms behind the behavior. Attached Figure Description
[0089] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0090] Figure 1 This is a schematic flowchart of an active movement recognition method for laboratory animals provided in an embodiment of the present invention;
[0091] Figure 2 This is a schematic flowchart of an active motion recognition system for laboratory animals provided in an embodiment of the present invention;
[0092] Figure 3 This is a schematic flowchart illustrating a method for analyzing the cognitive mechanisms of experimental animal behavior provided in an embodiment of the present invention;
[0093] Figure 4 This is a schematic flowchart of a cognitive mechanism analysis system for experimental animal behavior provided in an embodiment of the present invention;
[0094] Figure 5 This is a schematic block diagram of an active motion recognition device for laboratory animals or a cognitive mechanism analysis device for laboratory animal behavior provided in an embodiment of the present invention;
[0095] Figure 6 This is an interface for selecting the recognition region of an experimental animal video provided in an embodiment of the present invention;
[0096] Figure 7 This is an animal contour recognition result provided by an embodiment of the present invention. Detailed Implementation
[0097] To enable those skilled in the art to better understand the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings.
[0098] In some of the processes described in the specification, claims, and accompanying drawings of this invention, multiple operations appearing in a specific order are included. However, it should be clearly understood that these operations may not be executed in the order they appear herein, or may be executed in parallel. The operation numbers, such as S101, S102, etc., are merely used to distinguish different operations and do not represent any execution order. Furthermore, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel. It should be noted that the descriptions such as "first," "second," etc., in this document are used to distinguish different messages, devices, modules, etc., and do not represent a sequential order, nor do they limit "first" and "second" to different types.
[0099] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0100] Figure 1 This is a schematic flowchart of a method for recognizing active movement in laboratory animals according to an embodiment of the present invention. Specifically, the method includes the following steps:
[0101] S101: Obtain videos of laboratory animals;
[0102] In one embodiment, the video of the experimental animal is a pre-recorded video.
[0103] In one embodiment, the video of the experimental animal is a video of the experimental animal recorded in real time by a camera.
[0104] In one embodiment, the video of the experimental animal is preprocessed before subsequent contour recognition is performed. The preprocessing includes one or more of the following: camera calibration, recognition region selection, and recognition region standardization.
[0105] In one embodiment, the input video is a video of a behavioral despair experiment. A behavioral despair experiment involves providing an animal with an inescapable, oppressive environment, causing it to struggle in extreme discomfort but unable to escape, resulting in intermittent periods of immobility. This typical "immobility" exhibited by the animal reflects a state known as "behavioral despair," which is similar to depression. Therefore, this model is often used to evaluate the efficacy of drugs such as antidepressants, stimulants, and sedatives.
[0106] The most commonly used behavioral despair tests are the tail suspension test and the forced swimming test. In the tail suspension test, the mouse's tail is fixed so that its head is down. After struggling for a period of time, when it realizes that it cannot escape, it will give up and enter a state of "behavioral despair," after which it will continue to struggle. In the forced swimming test, the mouse is placed in water. The mouse will struggle to prevent drowning. When it realizes that it cannot escape, it will give up and enter a state of "behavioral despair," after which it will continue to struggle. The struggling behavior is an active movement state. The behavioral despair state may include inertial movement due to struggle. At this time, the mouse's behavior is classified as a "passive movement state." By detecting and comparing the mouse's behavior, such as the relative duration of active movement, the clinical effect of a certain drug can be obtained.
[0107] 1. Camera calibration
[0108] In one embodiment, since the camera is often misplaced during experiments, causing distortions in the image due to changes in perspective and scaling, it is necessary to calibrate the video using a camera.
[0109] In one embodiment, during camera calibration, the first frame of the video is extracted, and the four forward vertices of the overhanging box are marked on this frame as feature anchor points. The perspective transformation matrix is then solved so that the upper left, upper right, lower right, and lower left vertices of the overhanging box in the new view plane are located at (0,0), (1280,0), (1280,720), and (0,720), respectively, where the upper left corner is the origin, and the positive x and y directions are to the right and downward, respectively. The perspective matrix P is then calculated based on the following position mapping relationship:
[0110]
[0111] The obtained perspective transformation matrix is used to perform perspective transformation on all frames of the video, fixing the size of the experimental area in the video and ensuring the viewpoint is directly in front. Camera calibration is then performed on the video to normalize videos from different shooting conditions to a uniform size and eliminate distortion, ensuring consistency in motion state recognition results under different experimental conditions.
[0112] 2. Identification Area Selection
[0113] In one embodiment, each recorded video of the forced swimming and tail-suspending tasks includes multiple animals. For the forced swimming task, the smallest rectangular box containing the swimming beaker is selected for each animal; for the tail-suspending task, the smallest rectangular box containing the swing range is selected for each animal. The target region selection box is always visible in the solution, and its horizontal / vertical size can be adjusted in real time using set adjustment buttons (e.g., zooming out horizontally using the "-" key, zooming in using the "=" key, zooming out vertically using the "[" key, zooming in using the "]" key). It is clear and convenient to use, and the recognition region selection interface is as follows: Figure 6 As shown.
[0114] In one embodiment, each selected recognition region is scaled to 480*640 for subsequent contour recognition.
[0115] S102: Perform contour recognition on the video of the experimental animal to obtain a contour map sequence;
[0116] 3. Animal outline recognition
[0117] In one embodiment, the recognition region is converted into a grayscale image G, and animal outlines are detected in the grayscale image.
[0118] In one embodiment, the grayscale image is first convolved using the Scharr operators in the x and y directions as convolution kernels, and the gradient G of the grayscale image in the x and y directions is calculated. x With G y :
[0119]
[0120] Fusion G x With G y Obtain the outline:
[0121]
[0122] The resulting contour map is as follows Figure 7As shown, contour maps are used for subsequent passive motion cancellation and active motion recognition. The Scharr operator is an edge detection operator, commonly used for gradient calculation in images. It is similar to the Sobel and Prewitt operators, but uses a different convolution kernel when calculating the gradient. The Scharr operator offers better performance than the Sobel and Prewitt operators, especially for detecting detailed edges in images.
[0123] In one embodiment, OpenCV in Python is used for contour detection. OpenCV is a popular computer vision library that provides functions for contour detection and allows you to specify the edge detection operators to be used during contour detection.
[0124] S103: Based on the relative invariance of the experimental animal's outline under passive motion, predict each frame of the outline map sequence to obtain the predicted passive motion outline map sequence.
[0125] 4. Passive motion cancellation
[0126] In one embodiment, the input video is a video of mice performing a tail suspension task. Through extensive observation of mouse experimental videos, it was found that the time mice spend completely still during the experiment is very short, even negligible (because after the mouse begins to move, even without struggle, inertial swaying persists). Therefore, the "complete stillness" can be merged into the "inertial swaying" state, collectively referred to as the "passive movement state." Mouse behavior detection, which distinguishes between the mouse's "passive movement state" and "active movement state," can be simplified to a state switching process, or a behavior switching process. Therefore, as long as the moment of behavior switching during the experiment can be found, the behavior switching process can be extracted, thereby completing the identification of mouse behavior.
[0127] In one embodiment, the relative invariance is the relative invariance of contour corner points and / or contour moments; preferably, the step of predicting the predicted passive motion contour map sequence based on the relative invariance of contour corner points includes: performing corner point detection on each frame of the contour map sequence to obtain corner point P0, calculating the passive motion corner point P1 corresponding to corner point P0 in the next frame of the contour map, using an affine transformation to predict the predicted passive motion corner point P1′ corresponding to P0 in the next frame of the contour map, minimizing the distance between the passive motion corner point P1 and the predicted passive motion corner point P1′ to obtain the affine transformation, and sequentially applying the affine transformation to each frame of the contour map sequence to obtain the predicted passive motion contour map sequence.
[0128] In image processing and computer vision, a corner refers to a location in an image that exhibits a significant change in grayscale. These locations are typically corners or edges in the image, possessing a stronger grayscale gradient compared to other areas. Corners often represent important features in an image. Therefore, corner detection can be used to identify key features in an image, and is an important step in tasks such as image stitching, object tracking, and object recognition.
[0129] Harris corner detection is a method for calculating corners in an image, widely used in computer vision and image processing. The algorithm was proposed by Chris Harris and Mike Stephens in 1988. The core idea of Harris corner detection is to determine whether a region is a corner by observing changes in grayscale intensity in a local area of the image. The key is to detect the relationship between grayscale changes in a local area of the image and displacement in different directions. The basic steps of the algorithm are as follows: (1) Calculate the image gradient: Smooth the image and then calculate the gradient in the horizontal and vertical directions. This can be achieved using common filters (such as the Sobel filter). (2) Calculate the Harris matrix: For each pixel, calculate the Harris matrix using gradient information. The Harris matrix is a 2×2 matrix that represents the information about grayscale changes near that pixel. (3) Calculate the corner response function: Calculate a value called the corner response function using the eigenvalues of the Harris matrix. Typically, the corner response function is defined as: R = λ1×λ2 - k(λ1 + λ2) 2 , where λ1 and λ2 are the eigenvalues of the Harris matrix, and k is a constant, usually taking a small value. (4) Corner selection: Threshold judgment is performed on the corner response function, and pixels with values greater than a certain threshold are considered corners. The Harris corner detection method is a corner detection algorithm based on local image features. It is sensitive to areas with significant gray-level changes in the image, and therefore suitable for detecting corners. This method has been widely used in image stitching, object recognition and tracking.
[0130] In one embodiment, the optical flow method is used to calculate the passive motion corner point P1 corresponding to corner point P0 in the contour map of the next frame.
[0131] In one embodiment, the optical flow method includes one or more of the following: the Lucas-Kanade method, the Horn-Schunck method, the Farneback method, the pyramid Lucas-Kanade optical flow algorithm, and the deep learning-based optical flow algorithm.
[0132] In one embodiment, the contour map G obtained from each frame is used to extract the corner points P0 required for optical flow estimation. Compared to directly using the original image, the contour lines eliminate noise in the background image to some extent, making the extracted corner points more likely to be located on the animal, thereby enhancing the accuracy of passive motion state estimation. Corner points are extracted using the Harris corner detection method, and a small window is slid along the x and y directions to calculate the grayscale change E(u,v) within the window. For each window position, the corner response function R is calculated.
[0133] R = det(M) - k(trace(M)) 2
[0134] Where R represents the corner response function, det(M) is the determinant of the covariance matrix M, trace(M) is the trace of the covariance matrix M, k is a constant, and the calculation of the covariance matrix M is based on the gradient information of the local region of the image, with gradients Ix and Iy in the x and y directions respectively. x and I y The covariance matrix M is defined as follows:
[0135]
[0136] Where w(x,y) is the weight of the pixel in the window, I x with I y Let R and y be the grayscale gradients of the window image in the x and y directions, respectively. A threshold thr is set, and for pixels where R > thr, non-maximum suppression is used to filter for locally optimal corner points. The selected corner points are then included in P0. This represents the gray-level gradient in the i-th column along the x-direction of a local image region. This represents the gray-level gradient along the i-th row in the y-direction of a local image region. middle This represents the gradient of the i-th column in the x-direction of a local image region at time t as a function of time. middle This represents the gradient of the i-th row in the y-direction of a local image region at time t as a function of time.
[0137] After obtaining the animal corner point P0 in the current frame, the optical flow method is used to identify the corner point P1 corresponding to P0 in the next frame.
[0138] Optical flow is a technique for calculating the motion of pixels in an image over time. Optical flow represents the direction and velocity of motion of each pixel in an image within a time interval. This technique is very important for applications such as understanding motion in images, object tracking, and video compression. The following are some key concepts and methods of optical flow: (1) Optical flow vector: The core of optical flow is to calculate the optical flow vector of each pixel, which contains the direction and velocity of the pixel's motion in the image. The optical flow vector is usually represented as (u,v), where (u) is the horizontal motion component and (v) is the vertical motion component. (2) Optical flow field: The optical flow vectors of all pixels in the entire image are calculated, and the results form an optical flow field, which shows the motion information of each position in the image.
[0139] The Lucas-Kanade method is a classic approach for optical flow estimation. It assumes that motion in an image is local and uses partial derivatives within local regions to estimate optical flow. This method is suitable for relatively small motions.
[0140] Unlike the Lucas-Kanade method, the Horn-Schunck method processes the entire image, solving for the optical flow of the entire image by minimizing the smoothness of the global optical flow field. This method is suitable for relatively large motions.
[0141] With the development of deep learning, modern optical flow estimation methods employ deep learning models such as convolutional neural networks (CNNs) to learn motion information from images through end-to-end training. These methods perform better when handling complex scenes and large movements.
[0142] Dense optical flow methods calculate the optical flow of all pixels in an image, while sparse optical flow methods calculate the optical flow of only a subset of pixels. Dense optical flow provides more detailed information globally but is computationally more expensive, while sparse optical flow can be computed more efficiently in some applications.
[0143] When an animal's posture remains unchanged during passive motion (such as inertial floating or pendulum motion), the relative positions of corner points in adjacent frames remain unchanged, and only overall drift exists.
[0144] In one embodiment, the passive movement of the animal conforms to the spatial consistency assumption of the Lucas-Kanade optical flow algorithm; therefore, the pyramid Lucas-Kanade optical flow algorithm is used to identify the corresponding corner point P1 in the next frame. Image M is divided into 2... s Scaled to different levels M L (L=0,1,…,s), first at the smallest scale level M s The optical flow is calculated on the upper scale, and the result is used as the upper scale M. s-1The initial conjecture, up to the maximum scale (original image) M 0 The optical flow V is calculated as follows:
[0145]
[0146] Among them I x with I y These are the gray-level gradients of the image in the x and y directions, respectively, I t Let P' be the gradient of the image grayscale over time. Using the corresponding corner points P0 and P1 in two adjacent frames, an affine transformation A is applied to predict the overall drift of the animal, obtaining the predicted corner point positions P′1 = AP0 in the next frame, minimizing the geometric distance between P′1 and P1. At this point, the affine matrix A simulates the passive motion state of the animal as a whole. Applying an affine transformation to the current frame contour map I(t) yields the predicted passive motion cancellation for the next frame.
[0147] The basic idea of the Lucas-Kanade optical flow algorithm is to assume that the motion of a small region in an image is basically consistent, and to use this assumption to establish a local motion model. The algorithm estimates the motion by performing partial derivative operations on the change of pixel grayscale values within a small window over time, establishing a system of equations, and then solving this system of equations.
[0148] The Lucas–Kanade optical flow method is a gradient-based locally parameterized optical flow estimation method. This algorithm assumes that the optical flow vector is constant within a neighborhood of spatial size Ω, and then uses weighted least squares to estimate the optical flow. The optical flow estimation error over a small spatial neighborhood Ω is defined as:
[0149]
[0150] In the formula W 2 (x) represents the window weighting function, which makes the central region of the neighborhood have a greater influence on the constraints than the outer region. Gaussian functions are often used.
[0151] The Lucas-Kanade Pyramid Optical Flow algorithm is an improvement upon the Lucas-Kanade optical flow algorithm by incorporating an image pyramid. An image pyramid is a method for representing images at multiple scales by downsampling the image to varying degrees, generating a series of images at different scales. In optical flow algorithms, the introduction of the pyramid helps handle motion at different scales, thereby improving the algorithm's robustness.
[0152] The steps of the Lucas-Kanade optical flow algorithm include: (1) constructing an image pyramid to generate images at different scales; (2) applying the Lucas-Kanade optical flow algorithm to each scale image to obtain the motion vector of each pixel; and (3) interpolating or superimposing the motion vectors at different scales to obtain the final motion field. By introducing an image pyramid, the algorithm can better adapt to motion changes at different scales, improving the optical flow estimation effect in complex scenes. This is very useful for handling situations with large motion or images containing multi-scale structures.
[0153] S104: Calculate the difference between the contour map sequence and the predicted passive motion contour map sequence to obtain the contour map sequence after passive motion cancellation;
[0154] 5. Active motion recognition
[0155] In one embodiment, the difference between the contour map sequence and the predicted passive motion contour map sequence is calculated, that is, the difference between the contour map I(t) at time t and the passive motion cancellation prediction at time t is calculated. The difference is used to obtain a contour map after passive motion cancellation. The contour map after passive motion cancellation is used for subsequent behavior detection to eliminate the misclassification caused by inertial motion.
[0156] S105: A behavior sequence is obtained by performing behavior detection based on the contour map sequence after passive motion cancellation.
[0157] In one embodiment, the behavior sequence is divided into time windows according to a preset time granularity. The state of the time window is determined as active motion based on the proportion of the number of frames with motion state sequences greater than a threshold within the time window to the total number of frames in the time window. The behavior sequence with the preset time granularity is obtained by performing the above judgment on all time windows.
[0158] In one embodiment, the motion state sequence is processed to obtain a processed sequence, the processed sequence is divided into time windows according to a preset time granularity, and the judgment is performed on all time windows to obtain a behavior sequence with a set time granularity. The data processing includes one or more of the following: floating-point conversion and Gaussian smoothing.
[0159] In one embodiment, the behavior detection uses an image frame difference method to determine the animal's behavior, which determines the animal's behavior based on an area threshold of the difference image between adjacent frames; preferably, the image frame difference method binarizes the difference image between two adjacent frames according to a threshold to obtain a binarized image, and determines the animal's behavior based on the area threshold of the binarized image.
[0160] In one embodiment, even after passive motion cancellation processing, significant differences still exist between adjacent frames when the animal is actively moving. This is because after a mouse struggles violently, its body stops moving, but the inertial sway caused by the struggle still has a large amplitude. Although the mouse is in a passive motion state at this time, the area of its difference image may still exceed the area threshold, leading to misidentification and affecting the final experimental results. Based on this fact, an intersection contour map sequence is calculated from the neighborhood of the contour map sequence after passive motion cancellation, and behavior detection is performed based on the intersection contour map sequence.
[0161] In one embodiment, a three-frame method is used for inter-frame differencing, where the current frame contour I(t) is compared with the passive motion cancellation prediction of the previous frame. Differential; prediction of next frame contour I(t+1) and current frame passive motion cancellation. Difference. The binary image D is obtained by determining whether the absolute value of the difference is greater than a threshold td. t and D t+1 The intersection is obtained through the AND operation. The resulting binary image Noise was removed through morphological manipulations of expansion and erosion to obtain more accurate animal movement contours. Set an active motion recognition threshold ta, when When the number of pixels is not less than ta, the animal is determined to be in an active motion state at that frame. Calculate whether each recognition region (each animal) in the video is in an active motion state in each frame. Save the motion state of each frame. The number of pixels.
[0162] In one embodiment, the motion state of each frame is saved and The number of pixels is statistically analyzed by time window, and the sensitivity of recognition can be adjusted by changing the active motion recognition threshold ta.
[0163] 6. Windowing Smoothing Statistics
[0164] In one embodiment, the binary sequence of motion states for each animal is converted into a floating-point sequence and then Gaussian smoothed to obtain sequence a. s And use the threshold tg to determine the binary state of each frame. All frames within the time window The proportion is greater than the threshold t r If the state of the time window is determined to be active movement, then the state of that time window is determined to be active movement; otherwise, it is determined to be no active movement. After judging the movement state of all animals and all time windows, a fine-grained behavioral sequence is obtained. The granularity depends on the preset width and step size of the time window.
[0165] Figure 2This is a schematic flowchart of an active motion recognition system for laboratory animals provided in an embodiment of the present invention;
[0166] An active motion recognition system for laboratory animals, comprising:
[0167] Module 201: Acquire videos of experimental animals;
[0168] Contour recognition module 202: used to perform contour recognition on the video of the experimental animal to obtain a contour map sequence;
[0169] Passive motion prediction module 203: used to predict each frame of the contour map sequence based on the relative invariance of the experimental animal contour under passive motion state to obtain the predicted passive motion contour map sequence.
[0170] Passive motion cancellation module 204: used to calculate the difference between the contour map sequence and the predicted passive motion contour map sequence to obtain the contour map sequence after passive motion cancellation;
[0171] Behavior detection module 205: used to perform behavior detection based on the contour map sequence after passive motion cancellation to obtain a behavior sequence.
[0172] Figure 3 This is a schematic flowchart illustrating a method for analyzing the cognitive mechanisms of experimental animal behavior provided in an embodiment of the present invention;
[0173] A method for analyzing the cognitive mechanisms of experimental animal behavior, characterized in that the method includes:
[0174] Obtain the behavioral sequence of the experimental animal; the behavioral sequence of the experimental animal is obtained according to the active motion recognition method of the experimental animal.
[0175] The behavioral sequences of the experimental animals in different experimental animal groups were spliced together to obtain the group behavioral sequences of different experimental animal groups;
[0176] The group behavior sequence was fitted using a Bayesian modeling method to obtain the model and parameters;
[0177] The cognitive mechanisms of the experimental animal group were analyzed based on the model and parameters described above.
[0178] In one embodiment, behavioral sequences of experimental animals or behavioral sequences with a set time granularity are obtained. According to the experimental design, the sequences of animals from different groups are spliced and integrated. Reinforcement learning models such as RW model, counterfactual model, and physical strength-considered model are used to fit the animal behavioral state sequences. The fitting results of different models are compared, and the model with the smallest WAIC is selected as the winning model. The reliability of the model is verified by posterior prediction test. Finally, the model is parsed to obtain the cognitive characteristics output of the animals.
[0179] 7. Sequence splicing
[0180] In one embodiment, the behavioral sequences of all animals in each group are spliced together according to the experimental animals grouping. Assuming there are N animals in a group and the length of the behavioral sequence of each animal is T, the size of the behavior matrix used for model fitting after splicing is N×T.
[0181] 8. Reinforcement learning model fitting
[0182] Based on the hierarchical Bayesian modeling method, three reinforcement learning models—the Rescorla-Wagner (RW) model, the counterfactual model, and the physical strength-considered model—were used to fit the behavioral data.
[0183] The RW model is as follows:
[0184]
[0185] V t+1 =V t +αδ
[0186] δ=R t -V t
[0187] in Let V be the probability of an animal swimming in a forced swimming task or struggling in a tail-hanging task, τ be the reciprocal of temperature, V be the value corresponding to swimming or struggling, α be the learning rate, δ be the prediction error, and R be the reward or punishment experienced by the animal. This model assumes that the value of the animal remaining still in a forced swimming task or a tail-hanging task is always 0. Since V represents the value of active movement and R represents the reward or punishment experienced by the animal, therefore: V t V represents the value corresponding to active motion at time t. t+1 R represents the value corresponding to active movement at time t+1. t This represents the reward or punishment experienced by the animal at time t.
[0188] The counterfactual model is as follows:
[0189]
[0190] in and V represents the value corresponding to swimming / struggling and remaining still, respectively. c and V nc These represent the values corresponding to behaviors consistent with and inconsistent with the current behavior (e.g., if the animal's current movement state is swimming / struggling, then V). c For V a Then V nc For V iConversely, if the current motion state is stationary, then V c For V i Then V nc For V a ), δ and δ nc These represent the prediction errors corresponding to behaviors consistent with and inconsistent with the current moment's behavior, respectively. This represents the value corresponding to the behavior at time t+1 that is consistent with the behavior at time t;
[0191] This represents the value corresponding to behaviors that are inconsistent between time t+1 and time t.
[0192] R t This represents the reward or punishment experienced by the animal at time t.
[0193] This represents the value corresponding to behavior that is consistent at time t and time t-1.
[0194] This represents the value corresponding to behaviors that are inconsistent between time t and time t-1.
[0195] α is the learning rate.
[0196] τ is the reciprocal of temperature.
[0197] Consider the following physical model:
[0198]
[0199] V t+1 =V t +αδ
[0200] δ=R t -V t
[0201] S t =tanh(β(a) tot -i tot ))
[0202] The model assumes that an animal's movement state is influenced by both value and physical strength factors. Where S... t The physical condition of the animal is represented by γ, the physical condition influence coefficient is β, and the physical condition renewal coefficient is a. tot and i tot These represent the total number of times the animal has swum, struggled, and remained still so far.
[0203] 9. Model Comparison
[0204] The WAIC is calculated based on the model's fitting results, defined as follows:
[0205] WAIC = -2lppd + 2p waic
[0206]
[0207] Where y represents the sample observations, θ is the parameter, i represents each sample, and s represents the posterior simulation. The model with the smallest WAIC is selected as the winning model. lppd represents the log-point prediction density; p waic Indicates the estimated number of effective parameters; θ s For each posterior estimate of the parameters, uppercase S represents the number of posterior estimates of the parameters obtained from the animal behavior sequence, y i Let represent the observation value of the i-th sample, and n represent the number of samples. It represents the variance under the posterior distribution of the parameters.
[0208] 10. Posterior prediction test
[0209] The model is considered effective if the actual experimental observations fall within the 95% posterior credible interval of the model's predictions when the winning model is used to generate predictions of animal behavior.
[0210] 11. Output animal cognitive characteristics
[0211] By outputting the winning model and its parameters, we can obtain an analysis of the cognitive computing mechanism behind the development of animal movement states.
[0212] Figure 4 This is a schematic flowchart of a cognitive mechanism analysis system for experimental animal behavior provided in an embodiment of the present invention;
[0213] A cognitive mechanism analysis system for experimental animal behavior, comprising:
[0214] Acquisition module: Acquires videos of laboratory animals;
[0215] Contour recognition module: used to perform contour recognition on the video of the experimental animal to obtain a sequence of contour images;
[0216] Passive motion prediction module: used to predict the passive motion contour map sequence for each frame of the contour map sequence based on the relative invariance of the experimental animal contour under passive motion state.
[0217] Passive motion cancellation module: used to calculate the difference between the contour map sequence and the predicted passive motion contour map sequence to obtain the contour map sequence after passive motion cancellation;
[0218] Behavior detection module: used to perform behavior detection based on the contour map sequence after passive motion cancellation to obtain a behavior sequence;
[0219] Group behavior splicing module: used to splice the behavioral sequences of the experimental animals in different experimental animal groups to obtain the group behavior sequences of different experimental animal groups;
[0220] Bayesian modeling module: used to fit the group behavior sequence using Bayesian modeling methods to obtain the model and parameters;
[0221] Cognitive mechanism analysis module: used to analyze the cognitive mechanisms of the experimental animal group based on the model and parameters.
[0222] Figure 5 This is a schematic block diagram of an active motion recognition device for laboratory animals provided in an embodiment of the present invention.
[0223] An active motion recognition device for laboratory animals includes: a memory and a processor;
[0224] The memory is used to store program instructions;
[0225] The processor is used to call program instructions, which, when executed, implement the steps of the active motion recognition method for experimental animals or the steps of the cognitive mechanism analysis method for experimental animal behavior as described above.
[0226] A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of the active motion recognition method for experimental animals or the steps of the cognitive mechanism analysis method for experimental animal behavior as described in any one of the above.
[0227] The verification results of this verification embodiment show that assigning inherent weights to indications can moderately improve the performance of this method compared to the default settings.
[0228] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0229] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.
[0230] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0231] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0232] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0233] Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0234] The computer device provided by the present invention has been described in detail above. For those skilled in the art, there will be changes in the specific implementation and application scope based on the ideas of the embodiments of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for recognizing active movements in laboratory animals, characterized in that, The method includes: Obtain videos of laboratory animals; Contour recognition was performed on the video of the experimental animal to obtain a sequence of contour images; Based on the relative invariance of the experimental animal's contour under passive motion, a predicted passive motion contour sequence is obtained by predicting each frame of the contour map sequence. The relative invariance refers to the relative invariance of the contour corner points. The step of predicting the predicted passive motion contour sequence based on the relative invariance of the contour corner points includes: performing corner point detection on each frame of the contour map sequence to obtain corner points. Calculate the corresponding corner points in the next frame contour map. passive motion angle Using affine transformation to predict the corresponding contour map in the next frame Predicted passive motion angle Minimize the passive motion corner point and the predicted passive motion corner point The affine transformation is obtained by solving the distance, and the affine transformation is applied to each frame of the contour map sequence in turn to obtain the predicted passive motion contour map sequence. The difference between the contour map sequence and the predicted passive motion contour map sequence is calculated to obtain the contour map sequence after passive motion cancellation. An intersection contour map sequence is obtained by calculating the neighborhood of the contour map sequence after passive motion cancellation, and behavior detection is performed based on the intersection contour map sequence.
2. The method for recognizing active movement in experimental animals according to claim 1, characterized in that, The corresponding corner points in the next frame contour map are calculated using the optical flow method. passive motion angle .
3. The method for recognizing active movement in experimental animals according to claim 2, characterized in that, The optical flow methods include one or more of the following: Lucas-Kanade method, Horn-Schunck method, Farneback method, pyramid Lucas-Kanade optical flow algorithm, and deep learning-based optical flow algorithm.
4. The method for recognizing active movement in experimental animals according to claim 2, characterized in that, The corner points were identified using the Lucas-Kanade optical flow algorithm. The contour map is... The scale is scaled to different levels, and the optical flow is first calculated at the smallest scale level. and the optical flow Used as initial values for calculating optical flow at the previous scale. Iterate until the optical flow at the largest scale is calculated. .
5. The method for recognizing active movement in experimental animals according to claim 2, characterized in that, The optical flow is calculated as follows: Where V represents optical flow, and These are the gray-level gradients of the image in the x and y directions, respectively. The gradient of image grayscale over time. This represents the size of the local image region for solving the gradient. This represents the gray-level gradient along the i-th column in the x-direction of a local image region. This represents the gray-level gradient along the i-th row in the y-direction of a local image region; in middle This represents the gradient of the i-th column in the x-direction of a local image region at time t as a function of time. middle This represents the gradient of the i-th row in the y-direction of a local image region at time t as a function of time.
6. The method for recognizing active movement in experimental animals according to claim 1, characterized in that, The corner detection methods include one or more of the following: Harris corner detection, Shi-Tomasi corner detection, FAST corner detection, ORB corner detection, GFTT corner detection, and Moravec corner detection.
7. The method for recognizing active movement in experimental animals according to claim 6, characterized in that, The corner detection is performed using Harris corner detection. A window slides along the x and y directions of the image, and the grayscale changes within the window are calculated. For each window position, a corner response function is calculated, and a threshold is set. For pixels whose corner response function is greater than the threshold, non-maximum suppression is used to filter for locally optimal corners. These filtered corners are then included in the total number of corners detected. .
8. The method for recognizing active movement in experimental animals according to claim 7, characterized in that, The formula for calculating the corner response function is as follows: Where R represents the corner response function, det(M) is the determinant of the covariance matrix M, and trace(M) is the trace of the covariance matrix M. The covariance matrix M is a constant, and its calculation is based on the gradient information of local regions of the image. The gradients in the x and y directions are respectively... and The covariance matrix M is defined as follows: in, The weights of the pixels in the window. and These are the grayscale gradients of the window image in the x and y directions, respectively.
9. The method for recognizing active movement in experimental animals according to claim 1, characterized in that, The intersection contour map is obtained using a three-frame method. The three-frame method includes the following steps: calculating the difference between the contour map of the current frame in the contour map sequence and the predicted passive motion contour map of the corresponding frame in the predicted passive motion contour map sequence to obtain a first difference image; calculating the difference between the contour map of the next frame in the contour map sequence and the predicted passive motion contour map of the corresponding frame in the predicted passive motion contour map sequence to obtain a second difference image; performing an AND operation on the first difference image and the second difference image to obtain the intersection contour map of the three-frame method; and sequentially calculating the intersection contour map of each frame to form the intersection contour map sequence; binarizing the first difference image to obtain a first binary image; binarizing the second difference image to obtain a second binary image; performing an AND operation on the first binary image and the second binary image to obtain the intersection contour map of the three-frame method; and sequentially calculating the intersection contour map of each frame to form the intersection contour map sequence.
10. The method for recognizing active movement in experimental animals according to claim 1, characterized in that, The behavior detection uses the image frame difference method to determine the animal's behavior, which determines the animal's behavior based on the area threshold of the difference image between adjacent frames.
11. The method for recognizing active movement in experimental animals according to claim 10, characterized in that, The image frame difference method binarizes the difference images of adjacent frames according to a threshold to obtain a binarized image, and judges the animal's behavior based on the area threshold of the binarized image.
12. The method for recognizing active movement in experimental animals according to claim 11, characterized in that, The binarized image is subjected to morphological processing before behavior detection. The morphological processing includes one or more of the following: dilation, erosion, opening operation, and closing operation.
13. The method for recognizing active movement in experimental animals according to claim 1, characterized in that, The contour recognition is performed after the video of the experimental animal is preprocessed. The preprocessing includes one or more of the following: camera calibration, recognition area selection, and recognition area standardization.
14. The method for recognizing active movement in experimental animals according to claim 1, characterized in that, The behavior sequence is divided into time windows according to a preset time granularity. The state of the time window is determined as active motion based on the proportion of the number of frames with motion state sequences greater than a threshold within the time window to the total number of frames in the time window. The behavior sequence with the preset time granularity is obtained by performing the above judgment on all time windows.
15. The method for recognizing active movement in experimental animals according to claim 14, characterized in that, The motion state sequence is processed to obtain a processed sequence. The processed sequence is divided into time windows according to a preset time granularity. The judgment is performed on all time windows to obtain a behavior sequence with a set time granularity. The data processing includes one or more of the following: floating-point conversion and Gaussian smoothing.
16. A method for analyzing the cognitive mechanisms of experimental animal behavior, characterized in that, The method includes: Obtain the behavioral sequence of the experimental animal, as described in any one of claims 1-15; The behavioral sequences of the experimental animals in different experimental animal groups were spliced together to obtain the group behavioral sequences of different experimental animal groups; The group behavior sequence was fitted using a Bayesian modeling method to obtain the model and parameters; The cognitive mechanisms of the experimental animal group were analyzed based on the model and parameters described above.
17. The method for analyzing the cognitive mechanisms of experimental animal behavior according to claim 16, characterized in that, The Bayesian modeling methods include one or more of the following: Rescorla-Wagner model, counterfactual model, and physical force model.
18. The method for analyzing the cognitive mechanisms of experimental animal behavior according to claim 17, characterized in that, The group behavior sequence was fitted using the Rescorla-Wagner model, which is as follows: in, The probability of experimental animals moving voluntarily. It is the reciprocal of temperature. The value corresponding to active movement, For learning rate, For prediction error, For the reward or punishment experienced by the animal, This represents the value corresponding to active movement at time t. This represents the value corresponding to active movement at time t+1. This represents the reward or punishment experienced by the animal at time t.
19. The method for analyzing the cognitive mechanisms of experimental animal behavior according to claim 17, characterized in that, The group's behavioral sequence was fitted using a counterfactual model, which is as follows: in, The probability of experimental animals moving voluntarily. It is the reciprocal of temperature. For learning rate, This represents the value corresponding to behavior that is consistent at time t and time t-1. This represents the value corresponding to behaviors that are inconsistent between time t and time t-1. This represents the value corresponding to the behavior at time t+1 that is consistent with the behavior at time t. This represents the value corresponding to behaviors that are inconsistent between time t+1 and time t. Let t be the reward or punishment experienced by the animal at time t. and The values corresponding to active and passive motion, respectively. and These represent the prediction errors corresponding to behaviors consistent with and inconsistent with the current moment's behavior, respectively.
20. The method for analyzing the cognitive mechanisms of experimental animal behavior according to claim 17, characterized in that, The group's behavioral sequences were fitted using a physical fitness model, which is as follows: in As to the animal's physical condition, The coefficient representing the influence of physical strength. For physical fitness renewal coefficient, and These represent the total number of active movements and the total number of passive movements of the animal so far. The probability of experimental animals moving voluntarily. It is the reciprocal of temperature. For learning rate, For prediction error, This represents the value corresponding to active movement at time t. This represents the value corresponding to active movement at time t+1. This represents the reward or punishment experienced by the animal at time t.
21. The method for analyzing the cognitive mechanisms of experimental animal behavior according to claim 17, characterized in that, The superior model is selected through model comparison, and the cognitive mechanism of the experimental animal group is analyzed based on the superior model and its parameters.
22. The method for analyzing the cognitive mechanisms of experimental animal behavior according to claim 21, characterized in that, The model is used to generate predicted animal behavior sequences. If the actual experimental animal behavior sequences are located within the posterior confidence interval of the predicted animal behavior sequences, the model is considered effective.
23. The method for analyzing the cognitive mechanisms of experimental animal behavior according to claim 21, characterized in that, Model comparisons are performed using information criteria, which include one or more of the following: AIC, BIC, DIC, MDL, and WAIC.
24. The method for analyzing the cognitive mechanisms of experimental animal behavior according to claim 23, characterized in that, The WAIC (Wasteless Inference of Models) is used for model comparison, and the model with the smallest WAIC is selected as the winning model. The WAIC is calculated as follows: in For sample observations, For parameters, Representing each sample, This represents the logarithmic point prediction density; Indicates the estimated number of effective parameters; For the parameters estimated in the first posterior, uppercase This represents the posterior estimate of the parameters obtained from animal behavior sequences. Indicates the number of samples. It represents the variance under the posterior distribution of the parameters.
25. A system, characterized in that, The system includes a computer program, which, when executed by a processor, implements the steps of the active motion recognition method for experimental animals as described in any one of claims 1-15 or the steps of the cognitive mechanism analysis method for experimental animal behavior as described in any one of claims 16-24.
26. An apparatus comprising: Memory and processor; The memory is used to store program instructions; The processor is used to call program instructions, which, when executed, implement the steps of the active motion recognition method for experimental animals as described in any one of claims 1-15 or the steps of the cognitive mechanism analysis method for experimental animal behavior as described in any one of claims 16-24.
27. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the active motion recognition method for experimental animals as described in any one of claims 1-15 or the steps of the cognitive mechanism analysis method for experimental animal behavior as described in any one of claims 16-24.
Citation Information
Patent Citations
Moving object rapid detection method based on video sequence
CN106846359A
A method, device and system for detecting the behavior of laboratory animals
CN117994850B