Mouse face video data set making system and method for deep learning
By combining the infrared camera, experimental condition control module and PC-side video processing module, the mouse facial video data set production system solves the automation problem of mouse facial video data set collection and annotation, and achieves efficient and accurate data set production. Improved data quality and production efficiency.
Patent Information
- Application Number
- CN202310148919.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-22
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2043-02-22
AI Technical Summary
In the existing technology, the collection and annotation of mouse facial video data sets have problems such as manual time-consuming and high labor costs, and the inability to timely couple the video data and experimental conditions, resulting in a decrease in data quality.
A mouse facial video data set production system including an infrared camera, experimental condition control module and PC-side video processing module is designed. The Arduino development board and OpenCV library are used to realize automated video data collection and annotation through level signals and serial ports. Communication highly couples experimental conditions to color labels in video frames.
It realizes automated data set production, saves manual annotation time and cost, improves the quality and production efficiency of data sets, ensures the time consistency between data and experimental conditions, and reduces human errors.
Smart Images

Figure CN118537667A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of deep learning image classification data, and in particular to a system and method for producing a mouse facial video data set for deep learning. Background Art
[0002] In recent years, with the continuous emergence of deep learning methods and deep neural network models, the performance of algorithms has been constantly updated, and the application areas of computer vision technology have become increasingly broad. In the field of neuroscience, when exploring the function of a certain brain area, there is no good way to quantify the behavior of animals when designing animal experiments. We can only rely on subjective observations by human eyes, which is very subjective. At the same time, it is difficult to timely observe the subtle changes in the behavior of animals when the experimental conditions change. Computer vision technology makes up for this. Computer vision technology quantitatively explains the intrinsic relationship between machine vision behavior understanding and brain nerves, and can establish a stable mapping model, forming a new research paradigm based on large-scale computer vision behavior detection-brain nerve signal association to discover behavioral neural circuits.
[0003] However, applying computer vision technology to analyze the facial behavior of mice requires the collection of a large number of high-precision data sets. Since different experimental conditions will change in mouse experiments, the collected videos need to be annotated immediately when the conditions are triggered in order to distinguish the facial behaviors of mice collected under different conditions. Manual labeling not only consumes a lot of time and labor costs, but also cannot guarantee timely labeling when the conditions are triggered, resulting in the video data and electrophysiological data being uncoupled in time, which leads to a decline in data quality and affects the analysis results of biological experiments.
[0004] Therefore, there is an urgent need for a data set acquisition system and method that can record the video data of mice in real time during the experimental condition triggering process. Summary of the invention
[0005] In order to overcome the problems in the prior art, the present invention provides a mouse facial video dataset production system for deep learning.
[0006] The present invention provides the following technical solutions:
[0007] A mouse face video data set production system for deep learning comprises an infrared camera, an experimental condition control module, an Arduino development board and a PC-end video processing module, wherein the infrared camera collects mouse face video data, and is connected to the PC-end video processing module to transmit and store the video data in the PC-end video processing module; the experimental condition control module sends stimulation conditions to the mouse, and sends a level signal to the Arduino development board; the Arduino development board sends pin feedback information to the PC-end video processing module, and the PC-end video processing module controls the infrared camera based on an OpenCV library to mark color labels in video frames.
[0008] Furthermore, the experimental condition control module controls the release of the stimulation condition, which is the release of the irritating gas or the release of the voltage, and sends a low level signal to the A0-A5 pins of the Arduino development board when the stimulation condition is released.
[0009] Furthermore, the start and end of video recording are controlled by the keyboard S key and E key in the PC-side video processing module, or by the Arduino start pin 8 and end pin 13. When the experimental condition control module starts, a low level signal is sent to the start pin 8 of the Arduino development board. When the experimental condition control module stops, a low level signal is sent to the end pin 13 of the Arduino development board.
[0010] Furthermore, the Arduino development board is connected to the experimental condition control module through a DuPont line. The Arduino development board detects the low-level signals of each pin, and establishes a one-to-one mapping relationship between each pin and different pin feedback information. The pin feedback information is a number or an English character. The conditional trigger pin A0 corresponds to the character "0", the conditional trigger pin A1 corresponds to the character "1", the conditional trigger pin A2 corresponds to the character "2", the conditional trigger pin A3 corresponds to the character "3", the conditional trigger pin A4 corresponds to the character "4", and the conditional trigger pin A5 corresponds to the character "5". The start pin 8 and the end pin 13 correspond to the characters "s" and "e", respectively. The character signal is sent to the PC-side video processing module through serial port communication, and the low-level transmission signal time is coupled with the experimental condition trigger time.
[0011] Furthermore, the PC-side video processing module establishes a one-to-one mapping relationship between different digital characters and different color labels, controls video recording, calls the camera to start the recording function, receives video data, detects the serial port status, and marks color labels on corresponding video frames when the digital characters are successfully matched. The PC-side video processing module stores the recorded continuous frames of video data, and the pin feedback information matching success time is coupled with the label marking time.
[0012] Furthermore, the PC-side video processing module starts the timing function when it detects the character "s" or detects that the S key on the keyboard is triggered; records the corresponding time when the corresponding experimental condition is triggered when different digital characters are detected; ends the timing function when it detects the character "e" or detects that the E key on the keyboard is triggered, and generates and stores a table of experimental condition triggers and time points.
[0013] Furthermore, the video processing module on the PC side captures the video frames with the same color label and classifies and saves the video files.
[0014] The method for producing a video dataset using the above-mentioned mouse facial video dataset production system comprises the following steps:
[0015] Step 1: The PC-side video processing module controls the infrared camera to start, collects video of the mouse face, and stores the video data in the PC-side video processing module;
[0016] Step 2: Start the experimental condition control module. The experimental condition control module sends a low-level signal to the start pin 8 of the Arduino development board. After the Arduino development board detects the low-level signal of the start pin 8, it sends the character "s" to the PC-side video processing module through serial communication. The PC-side video processing module calls the camera to start the recording function, and the PC-side video processing module receives the video data.
[0017] Step 3: The experimental condition control module controls the release of the stimulus condition and sends a low-level signal to the A0-A5 pins of the Arduino development board. The Arduino development board detects the low-level pulse and sends a digital character signal to the PC-side video processing module through serial communication.
[0018] Step 4: The PC-side video processing module detects the serial port status. After the character matching is successful, the corresponding color label is added to the current video frame. The PC-side video processing module stores the recorded continuous frame number video;
[0019] Step 5. At the end of the experiment, when the PC video processing module detects the character "e", the PC video processing module records the video file and saves it in the specified path.
[0020] Furthermore, in step 2, the PC video processing module starts the timing function and records the start time; in step 4, the trigger time points of different experimental conditions are recorded; in step 5, the end time is recorded, and a table of experimental condition triggers and time points is generated and stored.
[0021] Furthermore, it also includes step six, in which the PC-side video processing module reads the video, detects pixel values of different colors on the collected data at the position reserved for the label, classifies the detected pixel values, captures video frames with the same color label, and saves the video files in the classified manner.
[0022] By adopting the above technical solution, the present invention has the following beneficial effects:
[0023] (1) The dataset production method and system proposed in the present invention are an automated process that only requires providing a video data storage path, saving the time and labor costs caused by manual labeling and greatly improving the efficiency of dataset production.
[0024] (2) The labeling action and the conditional triggering action of the present invention are highly coupled in time, which improves the quality of the data set in terms of biological experiments, reduces experimental errors caused by humans, ensures that subsequent analysis will not be affected by time lags, and plans a set of standard data set production processes, which has important practical significance for the application of deep learning methods in the field of neuroscience. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 This is a schematic diagram of the structure of the mouse face video dataset system;
[0026] Figure 2 It is a schematic diagram of the experimental results time table;
[0027] Figure 3 It is a schematic diagram of the video frame capture experiment results. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the structural diagrams and specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0029] Example 1
[0030] The present invention provides a system for preparing a mouse facial video dataset for deep learning, such as Figure 1 As shown, it includes an infrared camera, an experimental condition control module, an Arduino development board and a PC-side video processing module. The infrared camera collects mouse facial video data, and is connected to the PC-side video processing module to transmit and store the video data in the PC-side video processing module; the experimental condition control module sends stimulation conditions to the mouse, and sends a level signal to the Arduino development board; the Arduino development board sends pin feedback information to the PC-side video processing module, and the PC-side video processing module controls the infrared camera based on the OpenCV library to mark color labels in the video image.
[0031] The experimental condition control module controls the release of stimulation conditions, including the release of different proportions of stimulating gases, the release of different voltages, and other stimulation experimental conditions that need to be set.
[0032] The Arduino development board is connected to the experimental condition control module via a DuPont line. The Arduino development board detects the low-level signals of each pin and establishes a one-to-one mapping relationship between each pin and the feedback information of different pins. The pin feedback information can be a number or an English character or other characters. In this embodiment, a digital character is used for the conditional trigger pin, and an English character corresponds to the start pin. For example: the conditional trigger pin A0 corresponds to the character "0", the conditional trigger pin A1 corresponds to the character "1", the conditional trigger pin A2 corresponds to the character "2", the conditional trigger pin A3 corresponds to the character "3", the conditional trigger pin A4 corresponds to the character "4", the conditional trigger pin A5 corresponds to the character "5", and the start pin 8 and the end pin 13 correspond to the characters "s" and "e" respectively. The number of pins can be adjusted, and it can correspond to the trigger condition one by one. The character signal is sent to the PC-side video processing module through serial communication, and the low-level transmission signal time is coupled with the experimental condition trigger time.
[0033] By specifying the mapping relationship between different stimulus conditions and characters through software, the rigor from the initial design of the experiment to the final data collection is strictly ensured. When designing the experiment, you only need to correspond the colors and stimulus conditions to ensure zero error in the triggering of the conditions and the marking of different colors during the experiment. The character signal and the low-level signal are triggered at the same time to ensure time consistency.
[0034] The experimental condition control module controls the release of stimulus conditions, including the release of irritating gas and voltage. When the stimulus conditions are released, a low-level signal is sent to the A0-A5 pins of the Arduino development board. The start and end of video recording are controlled by the keyboard S and E keys in the PC-side video processing module, or by the Arduino start pin 8 and end pin 13. When the experimental condition control module starts, a low-level signal is sent to the start pin 8 of the Arduino development board, and when the experimental condition control module ends, a low-level signal is sent to the end pin 13 of the Arduino development board. The recording process of video frame data can be started or terminated manually, or it can be controlled by the experimental condition control module, which increases the flexibility of experimental progress control. The experimental condition control module can also fully control the entire process without manual control.
[0035] The PC-side video processing module establishes a one-to-one mapping relationship between different digital characters and different color labels. The corresponding relationship is shown in Table 1. The PC-side video processing module controls video recording. The OpenCV library calls the camera to start the recording function. The PC-side video processing module receives video data, detects the serial port status, and successfully marks the color label on the corresponding video frame through the function in the OpenCV library: cv.addWeighted(). The PC-side video processing module stores the recorded continuous frame video data, and the pin feedback information matching success time is coupled with the label marking time. The corresponding relationship between the stimulus conditions and the color labels can be shown in Table 1. The PC-side video processing module receives the character signal and labels at the same time, ensuring the consistency in time and the accuracy and completeness of the video data under the stimulation of experimental conditions.
[0036]
[0037] Table 1
[0038] The PC-side video processing module starts the timing function when it detects the character "s" or the S key on the keyboard is triggered; it records the corresponding time of the corresponding experimental condition triggering when different digital characters are detected; it ends the timing function when it detects the character "e" or the E key on the keyboard is triggered, and generates and stores a table of experimental condition triggering and time points. The table is generated for the analysis of subsequent experimental data, providing a time dimension to analyze the relationship between animal behavior and neuroscience, and also provides a log for the data.
[0039] The OpenCV library calls the video reading function to capture video frames with the same color label and save the video files in categories.
[0040] Example 2
[0041] The present invention provides a method for producing a video data set by a mouse facial video data set production system, comprising the following steps:
[0042] Step 1: The PC-side video processing module controls the infrared camera to start, collects video of the mouse face, and stores the video data in the PC-side video processing module;
[0043] Step 2: Start the experimental condition control module. The experimental condition control module sends a low-level signal to the start pin 8 of the Arduino development board. After the Arduino development board detects the low-level signal of the start pin 8, it sends the character "s" to the PC-side video processing module through serial communication. The PC-side video processing module calls the camera to start the recording function, and the PC-side video processing module receives the video data.
[0044] Step 3: The experimental condition control module controls the release of the stimulus condition and sends a low-level signal to the A0-A5 pins of the Arduino development board. The Arduino development board detects the low-level pulse and sends a digital character signal to the PC-side video processing module through serial communication.
[0045] Step 4: The PC-side video processing module detects the serial port status. After the character matching is successful, the corresponding color label is added to the current video frame. The PC-side video processing module stores the recorded continuous frame number video;
[0046] Step 5. At the end of the experiment, when the PC video processing module detects the character "e", the PC video processing module records the video file and saves it in the specified path.
[0047] Preferably, in step 2, the PC video processing module turns on the timing function and records the start time; in step 4, the triggering time points of different experimental conditions are recorded; in step 5, the end time is recorded, and a table of experimental condition triggers and time points is generated and stored.
[0048] Preferably, the method further includes step six, wherein the PC-side video processing module reads the video, detects pixel values of different colors on the collected data at the position reserved for the label, classifies the detected pixel values, captures video frames with the same color label, and saves the video files in the classified manner.
[0049] The stimulation conditions in this embodiment are shown in Table 1 as an example. The purpose is to obtain the facial movements of mice under the stimulation of six experimental conditions. The mice were subjected to the release of different proportions of gas and different voltages. Each stimulation was performed 100 times, the stimulation time was 2S, the interval time was 5S, the total video frame length was about 80 minutes, and finally a total of 600 segments of six-category video data were generated.
[0050] The generated table of experimental condition triggers and time points is shown in Figure 2 The results of randomly selecting a frame of image from 600 segments of six classification data are shown in Figure 3 As shown, the color label is placed in the upper right corner of the annotation.
[0051] The method of the present invention only needs to ensure that the color labels correspond to the stimulation conditions one by one. When starting the device, only the video saving path needs to be input. When the experiment is over, a time record table and video segments classified by color are automatically generated. This saves the time and labor costs caused by manual labeling, greatly improves the efficiency of data set production, and ensures the accuracy and integrity of the intercepted video segments under stimulation conditions due to the coupling of various signals.
[0052] The above-mentioned embodiments only express the implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that 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. Therefore, the protection scope of the patent of the present invention shall be based on the attached claims.
Claims
1. A mouse facial video dataset production system for deep learning, comprising an infrared camera, an experimental condition control module, an Arduino development board and a PC-side video processing module, characterized in that: The infrared camera collects mouse facial video data, and is connected to a PC-side video processing module to transmit and store the video data in the PC-side video processing module; the experimental condition control module sends stimulation conditions to the mouse, and sends a level signal to the Arduino development board; the Arduino development board sends pin feedback information to the PC-side video processing module, and the PC-side video processing module controls the infrared camera based on the OpenCV library and marks color labels in the video frames.
2. The mouse facial video data set production system according to claim 1, characterized in that: The experimental condition control module controls the release of the stimulus condition, which is the release of irritating gas or voltage, and sends a low-level signal to the A0-A5 pin of the Arduino development board when the stimulus condition is released.
3. The mouse facial video data set production system according to claim 2, characterized in that: The start and end of video recording are controlled by the keyboard S and E keys in the PC video processing module, or by the Arduino start pin 8 and end pin 13. When the experimental condition control module starts, a low level signal is sent to the start pin 8 of the Arduino development board. When the experimental condition control module ends, a low level signal is sent to the end pin 13 of the Arduino development board.
4. The mouse facial video data set production system according to claim 2 or 3, characterized in that: The Arduino development board is connected to the experimental condition control module through a DuPont line. The Arduino development board detects low-level signals of various pins, establishes a one-to-one mapping relationship between various pins and different pin feedback information, and the pin feedback information is a number or an English character. The conditional trigger pin A0 corresponds to the character "0", the conditional trigger pin A1 corresponds to the character "1", the conditional trigger pin A2 corresponds to the character "2", the conditional trigger pin A3 corresponds to the character "3", the conditional trigger pin A4 corresponds to the character "4", the conditional trigger pin A5 corresponds to the character "5", the start pin 8 and the end pin 13 correspond to the characters "s" and "e" respectively, and the character signal is sent to the PC-side video processing module through serial port communication, and the low-level transmission signal time is coupled with the experimental condition trigger time.
5. The mouse facial video data set production system according to claim 4, characterized in that: The PC-side video processing module establishes a one-to-one mapping relationship between different digital characters and different color labels. The PC-side video processing module controls video recording and calls the camera to start the recording function. The PC-side video processing module receives video data and detects the serial port status. If the digital characters are successfully matched, the color label is marked on the corresponding video frame. The PC-side video processing module stores the recorded continuous frame video data, and the pin feedback information matching success time is coupled with the label marking time.
6. The mouse facial video data set production system according to claim 5, characterized in that: The PC-side video processing module starts the timing function when it detects the character "s" or detects that the keyboard S key is triggered; when different digital characters are detected, the corresponding time of the corresponding experimental condition triggering is recorded; When the character "e" is detected or the E key on the keyboard is triggered, the timing function ends, and a table of experimental condition triggers and time points is generated and stored.
7. The mouse facial video data set production system according to claim 6, characterized in that: The video processing module on the PC side captures the video frames with the same color label and saves the video files in categories.
8. The method for producing a video dataset according to the mouse facial video dataset production system according to any one of claim 7, characterized in that: The following steps are involved: Step 1: The PC-side video processing module controls the infrared camera to start, collects video of the mouse face, and stores the video data in the PC-side video processing module; Step 2: Start the experimental condition control module. The experimental condition control module sends a low-level signal to the start pin 8 of the Arduino development board. After the Arduino development board detects the low-level signal of the start pin 8, it sends the character "s" to the PC-side video processing module through serial communication. The PC-side video processing module calls the camera to start the recording function, and the PC-side video processing module receives the video data. Step 3: The experimental condition control module controls the release of the stimulus condition and sends a low-level signal to the A0-A5 pins of the Arduino development board. The Arduino development board detects the low-level pulse and sends a digital character signal to the PC-side video processing module through serial communication. Step 4: The PC-side video processing module detects the serial port status. After the character matching is successful, the corresponding color label is added to the current video frame. The PC-side video processing module stores the recorded continuous frame number video; Step 5. At the end of the experiment, when the PC video processing module detects the character "e", the PC video processing module records the video file and saves it in the specified path.
9. The facial video dataset production method according to claim 8, characterized in that: In step 2, the PC video processing module starts the timing function and records the start time; in step 4, the triggering time points of different experimental conditions are recorded; in step 5, the end time is recorded, and a table of experimental condition triggers and time points is generated and stored.
10. The facial video dataset production method according to claim 8, characterized in that: The method also includes step six, in which the PC-side video processing module reads the video, detects pixel values of different colors at the position reserved for the label on the collected data, classifies the detected pixel values, captures video frames with the same color label, and saves the video files in the classified manner.
Citation Information
Patent Citations
Visual target active attention training system for sober rats / mice
CN103314871A
Automatic face annotation method and system
CN105100894A
Automatic label labeling method and system, equipment and storage medium
CN113961725A
Cited By
Experimental device for mouse facial expression
CN120836454A
