Skip to content

automated pipeline for sleap inference batch processing

License

Notifications You must be signed in to change notification settings

WeissShahaf/autosleap

Repository files navigation

Automated sleap inference script / GUI

half_logo

written by Shahaf Weiss 2024.

This App is used to run SLEAP inference of multiple models, on multiple videos, in parallel.

the GUI is written with PySide2 to keep inline with SLEAP dependencies.

Models can be manually loaded or read from a CSV file (see example in Docs). the parameters used are stored in a json file, and preloaded the next time the app is loaded.

Use case #1: 10 videos of a mouse hunting crickets, require running each video through a mouse tracking model and a cricket tracking model.

Use case #2: a folder containing 10 videos of a mouse in an open field. you can use a "folder" option to run the model(s) on all videos in the folder.

The core script does the following: gets user input: input_path: a video file or folder containing video files csv_path: path to a csv file containing model paths model_type: a list of model types (must exit in csv_path file)

Installling

-install sleap:

mamba create -y -n autosleap -c conda-forge -c nvidia -c sleap -c anaconda sleap=1.3.3

-Activate autosleap: mamba activate autosleap

-install pip dependencies: pip install GPUtil IPython

-Download the repository into the folder you want to put the repo:

git clone https://github.com/WeissShahaf/autosleap # or optionally add PATH to your desired folder

cd autosleap

checking sleap works:

run sleap-diagnostic

run:

make sure you have access to the model_paths.csv file that you will use to get the models' paths. if using spyder access GPFS from spyder before trying to run.

cd into the cloned repository's "sleapgui" folder (e.g. D:\GitHub\autosleap\sleapgui)

run: python autosleap.py

  • The script runs sleap sleap-track,sleap-convert,sleap-render commands on all files for all model types.

  • Includes autmated GPU and RAM managment and can run multiple video files in parallel.

Using the GUI:

When you start the GUI, It first looks for a config file in the environment folder: 'autosleap_config.json' The config file stores parameters from the last run. And used to pre-fill input fields. GUI

The first field to fill is the path to the data. Here you have several options:

  1. First decide if you want to run on a specific video file or a whole folder. If the latter tick the box.
  2. You can manually enter the path (‘no “r” needed)
  3. Alternatively, browse for the video folder / file
  4. Enter any optional arguments for sleap-track

vid

There are several ways to use the GUI: The two methods are mutually exclusive and choosing one will deselect the other.

  1. From a csv file
  2. Manually enter model folder

selection

  1. Get models path From a CSV file, and run any combination of models in the csv file: a. Fill in path to csv file b. Alternatively, browse for the csv file
    c. If using default settings, choose combination of models to infer from a dropdown menu d. if model path was changed in a/b, update model combination and choose from menu

csv

  1. Manually input a model’s path. a. Enter a prefix for the model b. Browse for model folder c. Enter a prefix model d. save the model prefix and path to the csv file

manual

Now you can hit “Run” to run, refill the GUI using the config file by hitting “reset”, or exit by hitting “quit”. Note that any errors will appear in the bottom of the gui as a status text.

run

Crashes / Trouble shooting:

A log file is created in the tracked subfolder. it sohuld contain information about any crashes.

About

automated pipeline for sleap inference batch processing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages