Skip to content

Latest commit

 

History

History
142 lines (118 loc) · 5.77 KB

README.md

File metadata and controls

142 lines (118 loc) · 5.77 KB

Behavior analysis tutorial

Another short tutorial of HOW TO NEUROPSYTOX:

Installation

DeepLabCut (already installed in laboratory laptops)

  1. By hand:

    1. Install Python 3.7 or higher.
    2. Install DeepLabCut using pip: pip install deeplabcut[gui].
  2. Through anaconda yalm file

    1. Install anaconda environments
    2. Create a new environment: conda create -n my_env python=3.7.
    3. Activate the environment: conda activate my_env.
    4. Install DeepLabCut using conda: conda install -c conda-forge deeplabcut.
    5. Install additional dependencies: pip install deeplabcut[gui].
    6. Verify the installation: deeplabcut check-requirements.

    alt text

  3. Install anaconda environments alt text

  4. git clone https://github.com/DeepLabCut/DeepLabCut.git or download as a zip file

  5. Open the Anaconda Navigator

  6. Select the yalm file and install it alt text

  7. After installing, run ipython terminal alt text

  8. Run:

  9. Import deeplabcut

  10. Run deeplabcut.launch() alt text

  11. Open DLC gui alt text

Links 📖: https://deeplabcut.github.io/DeepLabCut/docs/installation.html

Running DLC for animal tracking

DeepLabCut to analyze videos of EPM or NOR

  1. Import library import deeplabcut

  2. Launch the gui: deeplabcut.launch_dlc() alt text

  3. Open the config file with Load project

    1. EPM alt text
    2. NOR alt text
  4. To analyze videos, first you must have your videos cropped and/or with a compression (reduce the resolution)

    1. If not, use the DLC tool

    alt text alt text 2. Just click crop as many videos you have 3. Also, you can rotate or flip your videos 4. If is borring to click, you can do it with a script by using ffmpeg (-crf to adjust the resolution, higher is low res): ffmpeg -i input.mp4 -vcodec libx265 -crf 28 input_cropped.mp4

  5. You can now analyze your videos with just one-click, remember to allow the save as csv option alt text

  6. You can see the progress on the terminal alt text

  7. For quality control, is highly recommendable to view some videos of each batch to be sure that the network is predicting your animal (mouse or rat) pose and the maze. To do that, just click on create videos tab and in the button. alt text

  8. Your animals are tracked! You can work with the coordinates in the best way you want to (see Behavior metrics or Discovering behaviors). alt text

  9. You will have 3 more files:

    1. coordinates csv
    2. python datafile (h5)
    3. python metadata alt text alt text

Re-train your network

If the pose DLC or NOR -network is doing a terrible job to tracking, you can re-train it using your own videos.

  1. Use a few videos to re-train (maybe 4 per recording conditions).
  2. You have to re-label, in total would be 5 frames per video.
  3. Extracting outliers.
  4. Re-label.
  5. Re-training the network
  6. Analyze and quality control (See above section)

Behavior metrics

Using the shiny app to run DLCAnalyzer scripts

Please read the paper and check the github repository: https://github.com/ETHZ-INS/DLCAnalyzer

Based on those scripts i built a quick shiny app to run the scripts by GUI

  1. Open RStudio alt text
  2. Load the app file alt text
  3. Just run the app alt text
  4. It will open the GUI alt text
  5. Fill the inputs
  6. Add the input directory, the files are the coordinates in csv obtained by DLC alt text
  7. Load the zoneinfo file from EPM or NOR alt text
  8. Fill the frames of your videos, all csv files must have been obtained from videos with the same fps, you can check it by see the videos details alt text
  9. Fill the options, you can allow the export option to create the excel table alt text
  10. Metrics are ready for each csv file! alt text alt text
  11. You can explore the metrics based on demographics, just upload it and click submit alt text
    1. The first column must be each csv filename, with "file" as first row
    2. The rest could be as you want alt text
  12. You will see the same table as before, but now, in the graph tab you can create different visualization of the metrics and demographics, select the Y,X,Z that you're interested. alt text
  13. At the end, you will have the indexes file with all basic DLCAnalyzer metrics alt text

Assistent watchers to create ethograms

Using BORIS

Discovering behaviors (pose + frame networks)