Skip to content

RRaphaell/mouse_behaviour_tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Pytorch Streamlit Docker

Streamlit App

Overview

This project aims to automate the tracking of rats' behavior.

We use deep learning to track a rats position and analyze it based on that information.
Using the canvas, you can draw segments and it generates a video marked the rats' bodies parts and also making some statistics, such as the time spent in each segment, number of segments crossings, and visualization of the entire path. (in the future, we might add some analysis)

final_62d71621ea46fb00aae8291f_153535.mp4

How to use

you can just open the website and upload the video you want to track, or use our example if you just want to see how it works.
Draw all segments on the canvas and click the start button to generate the report.
Based on the length of the video, it may take several minutes

Features

  • easy. no installation needed
  • friendly and sophisticated UI
  • allows specific segment analysis
  • modern reporting
  • continuously developing
  • open to contribute

Run locally

Installation

Quick install

pip install -r requiremenets.txt

Using conda (recommended)

conda create -n <env_name> python==3.8
conda activate <env_name>
pip install -r requiremenets.txt

how to run

streamlit run app.py

Project structure graph

Using this illustration, we can see how the project works in general.
We have two related models, one for detecting the center of the rat and the remaining one for detecting rats body parts (nose, left eye, right eye, backbone, tail start, tail end). We use the first model to detect the backbone of rats, then crop the image around it and use the second model to detect body parts accurately. Preprocessing techniques such as rescaling, normalization, etc., are applied.

Screenshot-from-2022-07-01-16-55-53.png

File structure

this tree graph helps you to dive into our code and understand project file structure quickly.

.
├── app.py    # main script
├── Dockerfile
├── environment.yml
├── README.md
├── requirements.txt
├── scripts   # all necessary scripts
│   ├── Models    # two models with training and inference scripts
│   │   ├── CenterDetector    # model for center detector
│   │   │   ├── center_detector_training.ipynb    # center detection model training notebook
│   │   │   ├── config.py       
│   │   │   ├── Dataset.py        
│   │   │   └── weights.bin 
│   │   ├── Controller    # module that controls both model predictions and processing
│   │   │   ├── config.py
│   │   │   ├── Controller.py
│   │   │   └── utils.py
│   │   ├── PartsDetector   # model for parts detections. using after the center detection model
│   │   │   ├── config.py
│   │   │   ├── Dataset.py
│   │   │   ├── parts_detector_training.ipynb_
│   │   │   └── weights.bin
│   │   ├── Dataset.py
│   │   ├── Metrics.py
│   │   ├── ModelBuilder.py
│   │   ├── Trainer.py
│   │   ├── UNet.py   # Unet model written from scratch
│   │   └── utils.py
│   ├── Report    # module to show all analyses based on rats' tracking
│   │   ├── Bar.py
│   │   ├── Card.py
│   │   ├── Dashboard.py
│   │   ├── Pie.py
│   │   └── utils.py
│   ├── Analyzer.py
│   ├── config.py
│   ├── Pipeline.py
│   ├── Tracker.py
│   └── utils.py
├── style.css

Contact

if you have any questions, ideas please contact us

raffo.kalandadze@gmail.com LinkedIn Twitter

tatiatsmindashvili@gmail.com LinkedIn Twitter

License

this app is released under a Clear BSD License and is intended for research/academic use only