Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New behavior #21

Merged
merged 32 commits into from
Dec 2, 2021
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
737134d
updated readme
chadhat Jun 7, 2021
27ab5b5
Update README.md
chadhat Jun 7, 2021
bec0cc0
setup.sh
chadhat Jun 7, 2021
208b32c
Merge branch 'update_readme' of https://github.com/damaggu/SIPEC into…
chadhat Jun 7, 2021
54fdff0
update setup.sh
chadhat Jun 7, 2021
ace08a9
Update README.md
chadhat Jun 7, 2021
c604349
readme rst
chadhat Jun 7, 2021
e07fcd5
update sphinx index
chadhat Jun 7, 2021
23357b7
Update README.md
chadhat Jun 8, 2021
7daa9d1
Merge pull request #14 from SIPEC-Animal-Data-Analysis/update_readme
chadhat Jun 9, 2021
cb3479f
test for github runner
chadhat Jun 11, 2021
9ee38c4
update yaml file to run on custom github runner
chadhat Jun 11, 2021
f7ce618
extending documentation #1
damaggu Jun 24, 2021
0c4d330
Merge pull request #17 from SIPEC-Animal-Data-Analysis/devel
damaggu Jun 25, 2021
85e26dd
Update README.md
chadhat Jun 25, 2021
5c3718a
Update README.md
chadhat Jun 25, 2021
220cafd
change default flag to avoid bug
damaggu Jun 26, 2021
b5b620a
fixing image out of bounds exception
damaggu Jun 28, 2021
ab4621b
Merge pull request #18 from SIPEC-Animal-Data-Analysis/improvements_a…
damaggu Jun 28, 2021
87df0ea
Merge branch 'main' into docs
damaggu Jun 28, 2021
56e25b2
adding Dockerfile and removing it from m gitignore
chadhat Jun 28, 2021
fb257c2
Update README.md
damaggu Jun 28, 2021
7ed5802
Update README.md
damaggu Jun 28, 2021
1f0afe8
Docker image to latest
chadhat Jun 28, 2021
f7c2dc4
updated doccs sources
chadhat Jun 28, 2021
2ac03fc
Merge pull request #16 from SIPEC-Animal-Data-Analysis/docs
chadhat Jun 28, 2021
473b0fb
changing dataloading of behavior to generator to minimize ram usage
damaggu Sep 6, 2021
7385aca
updated inference and visualization configs to include behavior recog…
damaggu Dec 1, 2021
88b7fdc
updated and cleaned utils file
damaggu Dec 1, 2021
26b4e35
fix behaviornet paths
damaggu Dec 1, 2021
a555873
fix behaviornet paths2
damaggu Dec 1, 2021
3e3805b
update dockerfile to incorporate the ineichen models
chadhat Dec 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
readme rst
  • Loading branch information
chadhat committed Jun 7, 2021
commit c604349397bac1f84d3d49cdc08e7a486d481a3b
159 changes: 159 additions & 0 deletions docs/source/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
Usage/Installation
------------------

**For really making use of SIPEC, your machine should have a powerful
GPU. We have tested the scripts with NVIDIA GTX 1080, NVIDIA GTX 2080 Ti
and V100 GPUs.**

Docker
~~~~~~

We provide a docker image with the required environment to run the SIPEC
scripts.

In order to pull the docker image you would first need to install
``docker`` and ``nvidia-docker2`` following the instructions on:

https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html

After installing ``docker`` and ``nvidia-docker2`` you can download the
SIPEC image by executing:

::

docker pull chadhat/sipec:tf2

**Note:** In order to run docker without ``sudo`` you would need to
create a docker group and add your user to it. Please follow the
instructions on:
https://docs.docker.com/engine/install/linux-postinstall/

The docker image contains the environment and SIPEC scripts.

Environment installation
~~~~~~~~~~~~~~~~~~~~~~~~

If you do not want to use the docker container you can follow these
installation instructions for **Linux**. These instructions have been
tested on Ubuntu 18 and 20.04.

Step 1: Install Cuda 11.0.3
^^^^^^^^^^^^^^^^^^^^^^^^^^^

Download and install Cuda 11. We have tested the setup with cuda 11.0.3.

After the installation is finised run ``nvcc --version`` to check the
installed cuda version.

Step 2: Install cuDNN 8
^^^^^^^^^^^^^^^^^^^^^^^

Download and install cuDNN 8. For this you would need to register for
NVIDIA’s developer program (it is free):

https://developer.nvidia.com/cudnn-download-survey

Step 3:
^^^^^^^

After you have successfully installed cuda and cuDNN: \* clone the SIPEC
repository \* open a terminal and go to the cloned SIPEC directory:
``cd PATH_TO_SIPEC_ON_YOUR_MACHINE`` \* run the following commands

::

chmod +x setup.sh
./setup.sh

The script will ask you for the root password.

Usage
-----

predefined pipelines
~~~~~~~~~~~~~~~~~~~~

You can run these template pipelines for training or evaluation of SIPEC
networks.

If your system has multiple GPUs, the ``--gpu`` flag allows you to run a
script on a specific GPU while keeping other GPUs free to run other
scripts.

Here are some example command line usages of the pipeline

.. raw:: html

<pre><code>
docker container run -v "<b>RESULTS_PATH</b>:/home/user/results" --runtime=nvidia --rm sipec:main_tf2
classification_comparison.py --gpu 0 --config_name behavior_config_final --random_seed 1 --output_path=/home/user/results

docker container run -v "<b>RESULTS_PATH</b>:/home/user/results" --runtime=nvidia --rm sipec:main_tf2
poseestimation.py --gpu 0 --operation train_mouse --output_path=/home/user/results/

docker container run -v "<b>RESULTS_PATH</b>:/home/user/results" --runtime=nvidia --rm sipec:main_tf2
behavior.py --gpu 0 --annotations /home/user/data/20180124T113800-20180124T115800_0.csv --video /home/user/data/fullvids_20180124T113800-20180124T115800_%T1_0.mp4 --output_path /home/user/results

docker container run -v "<b>RESULTS_PATH</b>:/home/user/results" --runtime=nvidia --rm sipec:main_tf2
full_inference.py --gpu 0 --species mouse --video /home/user/data/full_inference_and_vis_data/animal5678_day2.avi --segnet_path "/home/user/data/full_inference_and_vis_data/mask_rcnn_mouse_0095.h5" --max_ids 4 --results_sink /home/user/results/full_inference

docker container run -v "<b>RESULTS_PATH</b>:/home/user/results" --runtime=nvidia --rm sipec:main_tf2
segmentation.py --cv_folds 0 --gpu 0 --frames /home/user/data/mouse_segmentation_single/annotated_frames --annotations /home/user/data/mouse_segmentation_single/mouse_top_segmentation.json
</pre>

Where, **RESULTS_PATH** is the path on your machine where you would like
to write the results.

The output of these workflows are results files that quantify the
network performance, and a .h5 file that are the network weights for
subsequent use. Depending on modules to be trained, and the GPUs
available the training can take multiple hours or days.

In order to find all the arguments that can be passed to the scripts use
the flag ``--help``, e.g.,

::

docker container run --runtime=nvidia --rm sipec:main_tf2 segmentation.py --help

own pipline
~~~~~~~~~~~

You can build your own workflow by combining functions of the different
SIPEC modules. To do so, you usually need to define a config file, that
specifies parameters for the network and training to be used. Next, you
will need to load your data via the dataloader module. This enables you
to run the different SIPEC modules.

Annotation of Data
------------------

For the annotation of segmentation as well as behavioral data we
recommend the use of the VGG annotator, that can be found here:
http://www.robots.ox.ac.uk/~vgg/software/via/ For the annotation of
identification data we provide a GUI:
https://github.com/damaggu/idtracking_gui

Example Data
------------

Mouse OFT behavioral videos
~~~~~~~~~~~~~~~~~~~~~~~~~~~

For open field (OFT) mouse behavioral analysis, you can use the
exemplary data from Sturman et al. from zenedo.
https://zenodo.org/record/3608658 The corresponding labels can be
accessed here.
https://github.com/ETHZ-INS/DLCAnalyzer/tree/master/data/OFT/Labels

Cite
----

If you use any part of this code for your work, please cite the
following:

::

SIPEC: the deep-learning Swiss knife for behavioral data analysis
Markus Marks, Jin Qiuhan, Oliver Sturman, Lukas von Ziegler, Sepp Kollmorgen, Wolfger von der Behrens, Valerio Mante, Johannes Bohacek, Mehmet Fatih Yanik
bioRxiv 2020.10.26.355115; doi: https://doi.org/10.1101/2020.10.26.355115