/deeplabcut-social-interaction

An application that cleans the output from DeepLabCut and produces a CSV file containing information for rodent social interaction test. Additionally, the application has a feature that allows for live video analysis of the behavioral test. This application was made specifically for the Eisch Lab at the Children's Hospital of Philadelphia.

Primary LanguagePython

deeplabcut-social-interaction

This is an application that cleans and wrangles the output from DeepLabCut and produces a CSV file containing information about rodent social interaction test. There is also a feature that allows for live video analysis of social interaction test and it can also produce a CSV file containing all the empirical information for each trial. The live video analysis feature provides a visual aid to help researchers see what is being considered sniffle bout. Additionally, the live video analysis results are highly correlated with the result given from DeepLabCut.

This application is adapted to the Eisch Lab's rodent social interaction protocol in which they perform a SI test on two mice within 1 trial (left and right mouse).

The original model was trained on 200 frames that spanned across 4 videos. The model was trained for 200,000 iterations and has around a 95% accuracy.

This project was inspired by papers such as Nagai, M., Nagai, H., Numa, C. et al. "Stress-induced sleep-like inactivity modulates stress susceptibility in mice" and Worley, Nicholas B., et al. “Deeplabcut Analysis of Social Novelty Preference.”

Some Pictures of the Application

Modules

cv2
cvzone
glob
math
literal_eval
numpy
os
pandas
re
tkinter
tkinter.filedialog
webbrowser

Installation

pip install opencv-python
pip install cvzone
pip install pandas
pip install numpy
pip install webbrowser

Files

main.py

The main file that gets ran. Creates the GUI and calls on the other files for functions.

accuracy.py

This file calculates the accuracy of the model on the video by calculating the amount of dropped frames in the video.

social_interaction.py

This file produces a CSV that contains empirical information about the social interaction test, such as sniffle count 
and sniffle time in seconds.

extract_frames.py

This file extracts frames in the video to use as a reference and produces live video analysis of the social interaction
test. Additionally, it can produce a CSV file that shows all the sniffle counts and sniffle time for all trials.

interaction_zone.py

This file produces a CSV that contains information on mice activity within a designated interaction zone. This interaction
zone is the area that's 9cm from the arena corners and 14 cm outward.