Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
0693770
Make scripts work with tf 2.4
diegoaldarondo Jul 16, 2021
a96ea18
Add mirror augmentation
diegoaldarondo Jul 16, 2021
d1b4130
Use Session instead of interactive session to execute in eager mode
diegoaldarondo Jul 16, 2021
51721aa
formatting
diegoaldarondo Jul 16, 2021
26581ad
formatting
diegoaldarondo Jul 16, 2021
b3ad8be
Add multiple read attempts
diegoaldarondo Jul 16, 2021
4091152
formatting
diegoaldarondo Jul 16, 2021
d99ebde
Add euclidean distance metric to logging
diegoaldarondo Jul 16, 2021
23367ae
Add ability to specify left and right keypoints for mirror augmentati…
diegoaldarondo Aug 23, 2021
4737f7d
formatting and modified comment
diegoaldarondo Aug 23, 2021
125f17c
Load modules explicitly instead of through user scripts
diegoaldarondo Aug 24, 2021
e4b77ae
formatting
diegoaldarondo Aug 24, 2021
26c0196
Add psutil requirement to help callback memory leak debugging.
diegoaldarondo Aug 24, 2021
9f023b2
Fix bug in com multipredict script
diegoaldarondo Aug 26, 2021
b1b75c5
fix video loading bugs
spoonsso Aug 30, 2021
3f1d15b
Added saveMaxPreds callback that enables distance metrics when runnin…
spoonsso Sep 1, 2021
df3eac1
changing cluster scripts to work on DCC
spoonsso Sep 3, 2021
3b42606
added support for avg+max training and prediction; removed deprecated…
spoonsso Sep 7, 2021
7d38596
testing instance normalization in nets.py
joshuahwu Sep 13, 2021
e922c07
added instance normalization to nets.py
joshuahwu Sep 14, 2021
ff61469
sigmoid normalization for p_max in dannce-predict
spoonsso Sep 15, 2021
0393bd3
fixed com_debug bug
spoonsso Sep 16, 2021
8b54c3b
integrating norm_method across nets.py, interface.py, __init__.py, an…
joshuahwu Sep 20, 2021
9058136
updated readme and setup.py to upgrade to tf2.6
Sep 24, 2021
e2c43e1
testing cross entropy loss on max network
Sep 27, 2021
4a15f66
fix video loading bugs
spoonsso Aug 30, 2021
a5ef7b7
Local Changes to cluster scripts for making tf2.4 dcc compatible
data-hound Sep 27, 2021
2a16c03
fixed merge conflicts with tf2.4
Sep 27, 2021
6e53d7a
Merge branch 'dev_fix_1.2' into jhw_dev
Sep 28, 2021
c4a0588
Revert "updated readme and setup.py to upgrade to tf2.6"
diegoaldarondo Oct 5, 2021
cd71814
Add gpu_test to the list of partitions for multiprediction to account…
diegoaldarondo Oct 5, 2021
3138cbe
Fix bug in which videos from previously loaded experiments are never …
diegoaldarondo Oct 8, 2021
7fff3ff
fixed instance normalization dimension, testing cross entropy with ga…
Oct 12, 2021
03037c8
Upgraded to tf2.6, and added more workaround for dsplus
data-hound Oct 14, 2021
eaeae4d
merged as_tf2.6 main and jhw_dev
data-hound Oct 24, 2021
dc2306b
Resolved Huber Loss and LogCosh loss
data-hound Nov 30, 2021
a779089
Pre-pull commit. Pulling from local as_avgmax.
data-hound Dec 1, 2021
5b8c9bb
Merge ../dannce_new/ into as_tf2.6
data-hound Dec 1, 2021
456b551
Generalize video closing to cameranames with underscores
diegoaldarondo Dec 3, 2021
16706b0
revert to assuming that camnames have no underscores
diegoaldarondo Dec 4, 2021
63977db
Added functionality to support multiple slurm configurations in a yam…
diegoaldarondo Dec 4, 2021
c4c7294
Improve docstrings
diegoaldarondo Dec 7, 2021
29b3027
Improve docstrings
diegoaldarondo Dec 7, 2021
66908b7
Simplify imports
diegoaldarondo Dec 7, 2021
180acd0
Remove shell scripts from git tracking
diegoaldarondo Dec 10, 2021
37e5e9e
Replace CONFIG_PARAMS with params
diegoaldarondo Dec 10, 2021
1e0f0a4
passing keyword arguments instead of position arguments when train_mo…
data-hound Dec 13, 2021
54ccb7e
tf2.4 first drop - without removing cluster scripts
data-hound Dec 13, 2021
e8b95ca
tf2.4 second drop - modified __init__.py and grid.py
data-hound Dec 13, 2021
865cd90
Made Duke Cluster specific changes to holyoke.yaml
data-hound Dec 13, 2021
331ca45
Delete cluster scripts and remove unwanted imports from grid.py
data-hound Dec 13, 2021
e0b03e5
formatting and docstring
diegoaldarondo Dec 16, 2021
09a0daa
Change different results_dir naming conventions to results_dir
diegoaldarondo Dec 16, 2021
5e31e78
Refactoring and reformatting interface
diegoaldarondo Dec 16, 2021
44ead8e
Rework testing scripts to use absl testcase, make testing configs mor…
diegoaldarondo Dec 20, 2021
2652dbd
Remove compare_predictions.py. now in cli_test.py
diegoaldarondo Dec 20, 2021
c2fab87
remove testing file from git revision
diegoaldarondo Dec 20, 2021
5e26ad2
remove previous testing script
diegoaldarondo Dec 20, 2021
ae2a12a
Fix dannce predict bug, add temporary multimode definition, change sy…
diegoaldarondo Dec 20, 2021
d26c998
add mirror augmentation attributes to the npy data generator
diegoaldarondo Dec 20, 2021
258cd9b
Fix naming bug when training for only 1 epoch
diegoaldarondo Dec 20, 2021
c17b798
merge with tf2.4 testing changes and refactoring
diegoaldarondo Dec 21, 2021
0af1807
Add norm argument to finetune avg function
diegoaldarondo Dec 21, 2021
9243512
Now run via , reformatting
diegoaldarondo Dec 21, 2021
9fbba4c
Remove shell scripts
diegoaldarondo Dec 21, 2021
21bcf42
Keep separate config files for holyoke and duke clusters
diegoaldarondo Dec 21, 2021
da3658b
Add a standard python .gitignore
diegoaldarondo Dec 21, 2021
b0fcb99
Make compatible with tf2.6
diegoaldarondo Dec 22, 2021
b8d71d7
refactoring
diegoaldarondo Dec 22, 2021
aff848c
Rename valid generator to predict generator
diegoaldarondo Dec 23, 2021
7e749e4
Automate multi-instance prediction for multi gpu
diegoaldarondo Dec 23, 2021
49332ff
Fix imports
diegoaldarondo Dec 23, 2021
1aa5b43
docstrings and formatting
diegoaldarondo Dec 24, 2021
db9f200
move callbacks to new module
diegoaldarondo Dec 24, 2021
af0334f
Fix tests for multi instance automation
diegoaldarondo Dec 24, 2021
9eefba5
Make dgp test faster, split cli tests into constituent functions for …
diegoaldarondo Dec 24, 2021
a4d806b
update slurm config file to use tf2.6 environment
diegoaldarondo Dec 30, 2021
175c222
ignore the error log file and the testing file
diegoaldarondo Dec 30, 2021
b32ec98
write stderr to a log file during testing
diegoaldarondo Dec 30, 2021
2cbb5d4
Remove dupe params
diegoaldarondo Dec 31, 2021
4ea86d6
Fix missing save_tag bug
diegoaldarondo Dec 31, 2021
60d5b84
Fix bug in specifying com model that prevented loading of weights tha…
diegoaldarondo Jan 1, 2022
9cf8645
Fix bug that prevented proper setting of batch normalization for some…
diegoaldarondo Jan 1, 2022
e6e0cba
add setup to mono testing
diegoaldarondo Jan 1, 2022
1a395e9
Add inference and multi-instance-inference cli and sbatch tools to pr…
diegoaldarondo Jan 1, 2022
b498f17
Merge branch 'as_landing' of https://github.com/spoonsso/dannce into …
data-hound Jan 11, 2022
4fed05d
Update README with tf2.6/torch1.9
spoonsso Jan 13, 2022
bf08f67
Finished converted norm_method arguments to keyword.
spoonsso Jan 14, 2022
e401129
Merge pull request #91 from spoonsso/automated_multi_instance_refactor
spoonsso Jan 14, 2022
fb35bad
hotfix for norm_method in fargs
spoonsso Jan 14, 2022
94fac81
Blacklist problematic node
diegoaldarondo Jan 17, 2022
026b7f2
Update to work with inference scripts. Small bug fixes for multi inst…
diegoaldarondo Jan 17, 2022
4a312a3
fixed dcc GPU management issue
spoonsso Jan 26, 2022
dc71a59
remove gpu device placement
tqxli Jan 27, 2022
ab07fb7
remove gpu device placement
tqxli Jan 27, 2022
e9ba56a
remove gpu placement during dannce inference
tqxli Jan 27, 2022
5ff2997
keep consistent with use_temporal branch
tqxli Jan 28, 2022
a7f82e2
Logging Messages - First Drop
data-hound Jan 29, 2022
6235066
Logging messages into release
data-hound Jan 29, 2022
9128a5c
Resolving conflicts in processing.py
data-hound Jan 29, 2022
45293f2
Merge pull request #96 from spoonsso/release_bugfix
spoonsso Feb 9, 2022
3e124a5
updated setup.py for tf2.4; fixed visible gpu assignment
spoonsso Feb 17, 2022
62cb707
adding unsaved gpu_id component
spoonsso Feb 17, 2022
06424e6
run save_pred_targets at the end of training
spoonsso Apr 5, 2022
25f34b8
Added a print statement to interface
Apr 12, 2022
e64c97b
Merge branch 'as_logging_msgs' of https://github.com/spoonsso/dannce …
Apr 12, 2022
7fab6df
Added check for confirming the log directory location
Apr 15, 2022
64d66a9
Add checks for log_dir location. Create if does not exist.
Apr 15, 2022
88ed457
Added logging messages to cli.py. Included datetime in the default lo…
data-hound Apr 19, 2022
36c28a7
Make com multi-instance check also ignore files named 'com3d.pickle'
diegoaldarondo Apr 29, 2022
727e9fb
Rectified grid script to use proper load_params function. Changed the…
May 2, 2022
316b76c
save training data into npy volumes
tqxli May 6, 2022
d2c3168
remove unused
tqxli May 6, 2022
866dcb7
Making the n_rand_views to work for None values
May 12, 2022
ee8ca2f
Adding markerless_mouse io temporarily
May 12, 2022
e246ff5
Add command line utility to plot projections in a mirrored arena setup.
May 12, 2022
903cbe4
Remove debug points
May 12, 2022
a6ee3c3
Merge branch 'as_logging' of https://github.com/spoonsso/dannce into …
May 12, 2022
0dcdf71
Changing to tf2.6
May 12, 2022
984842d
Merge branch 'release' into as_logging
data-hound May 12, 2022
9bcb3e3
Merge pull request #108 from spoonsso/as_logging
data-hound May 12, 2022
136db21
formatting, change n retries in multi inference, change holyoke.yaml …
diegoaldarondo Jul 29, 2022
e3936b7
fix bug in multimode n instances
diegoaldarondo Jul 29, 2022
4244b5b
Merge remote-tracking branch 'origin/release_development' into releas…
diegoaldarondo Jul 29, 2022
a361e90
multi_gpu fixed hard coded io.yaml
jmr137 Aug 23, 2022
d4f3781
Fixing type errors in logging statements
Sep 29, 2022
3858380
Update README.md
data-hound Sep 29, 2022
eed6621
Remove Intermediate Supervision Code
data-hound Nov 17, 2022
c32beec
Pulled in release_minorfixes
Dec 7, 2022
cb70aeb
Pulled in release branch to incorporate all the logging statements
Dec 7, 2022
ed70f14
Merged and Tested release and release_minorfixes
Dec 12, 2022
1b65a7d
Merge branch 'release_dev_savedata' of https://github.com/spoonsso/da…
Dec 12, 2022
558966d
Merge branch 'release_develpment_feature' of https://github.com/spoon…
Dec 12, 2022
96aa81b
Change merged print statement
Dec 12, 2022
af8a161
Merge branch 'pdb_viz' of https://github.com/spoonsso/dannce into rel…
Dec 12, 2022
201e64b
Added Gaussian Cross Entropy Loss to custom objects. Added condition …
Dec 14, 2022
b13cecb
Added new tests and ran the full test suite
Jan 31, 2023
f20cdf6
Added new tests and ran the full test suite. Migrated the io for .mat…
data-hound Jan 31, 2023
a242cb5
Merge branch 'release_dev2' of https://github.com/spoonsso/dannce int…
data-hound Jan 31, 2023
7d54aaf
Update Readme
data-hound Jan 31, 2023
87fd513
mat73 integration all throughout. COM-addition to MAX preds before sa…
data-hound Feb 27, 2023
16aecc9
Changing touchstone for max predictions
data-hound Mar 2, 2023
9fc0ba4
Removing symlinks
data-hound May 9, 2023
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
164 changes: 163 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,159 @@
build
dist
dannce.egg-info
__pycache__
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

dannce/engine/__pycache__/
dannce/labeling/__pycache__/
old_repo/
Expand Down Expand Up @@ -31,6 +183,11 @@ demo/markerless_mouse_1/DANNCE/predict_results/
demo/markerless_mouse_1/DANNCE/train_results/AVG/weights*
demo/markerless_mouse_1/DANNCE/predict_test/

demo/markerless_mouse_1/DANNCE/train_test_ln/
demo/markerless_mouse_1/DANNCE/train_test_in/
demo/markerless_mouse_1/DANNCE/train_test_in_dgp/
demo/markerless_mouse_1/DANNCE/train_test_ln_dgp/

demo/markerless_mouse_1/COM/train_test/
demo/markerless_mouse_1/COM/train_test/logs/*
demo/markerless_mouse_1/COM/train_test/*.pickle
Expand All @@ -54,3 +211,8 @@ demo/markerless_mouse_2/DANNCE/predict_results/copy*

demo/markerless_mouse_1/videos/
demo/markerless_mouse_2/videos/

tests/configs/alabel3d_temp_dannce.mat
tests/configs/log_file.txt

.vscode/
73 changes: 53 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ DANNCE (3-Dimensional Aligned Neural Network for Computational Ethology) is a co

| OS | Python | TensorFlow | CUDA | cuDNN | PyTorch |
|:---------------------:|:------:|:----------:|:----:|:-----:|:-------:|
| Ubuntu 16.04 or 18.04 | 3.7.x | 2.2.0 - 2.3.0 | 10.1 | 7.6 | 1.5.0 - 1.7.0 |
| Windows 10 | 3.7.x | 2.2.0 - 2.3.0 | 10.1 | 7.6 | 1.5.0 - 1.7.0 |
| Ubuntu 16.04 or 18.04 | 3.7.x | 2.6.0 | 11.1 | 8.1 | 1.9.1 |
| Windows 10 **_Not yet retested_** | 3.7.x | 2.6.0 | 11.1 | 8.1 | 1.9.1 |

We recommend installing DANNCE using the following steps:

Expand All @@ -35,13 +35,13 @@ cd dannce
2. If you do not already have it, install [Anaconda](https://www.anaconda.com/products/individual).

3. Set up a new Anaconda environment with the following configuration: \
`conda create -n dannce python=3.7 cudatoolkit=10.1 cudnn ffmpeg`
`conda create -n dannce python=3.7 cudatoolkit=11.1 cudnn=8.1 ffmpeg -c nvidia -c conda-forge`

4. Activate the new Anaconda environment: \
`conda activate dannce`

5. Install PyTorch: \
`conda install pytorch=1.7 -c pytorch`
`conda install pytorch=1.9.1 -c pytorch`

6. Update setuptools: \
`pip install -U setuptools`
Expand Down Expand Up @@ -98,9 +98,9 @@ The demo should take less than 2 minutes to run on an NVIDIA Titan X, Titan V, T

Please see the *Wiki* for more details on running DANNCE and customizing configuration files.

## Using DANNCE on your data
# Using DANNCE on your data

### Camera Calibration
## 1. Camera Calibration
To use DANNCE, acquisition cameras must calibrated. Ideally, the acquired data will also be compressed. Synchronization is best done with a frametime trigger and a supplementary readout of frame times. Calibration is the process of determining the distortion introduced into an image from the camera lens (camera intrinsics) and the position and orientation of cameras relative to one another in space (camera extrinsics). When acquiring our data, we typically calibrated cameras in a two-step process. We first used a checkerboard to find the camera intrinsics. We then used an 'L-frame' to determine the camera extrinsics. The L-frame is a calibrated grid of four or more points that are labeled in each camera. A checkerboard can also be used for both procedures. We have included two examples of calibration using MATLAB (in `Calibration/`).

Some tips:
Expand All @@ -120,12 +120,12 @@ Cameras tested:
3. Basler ace aca1920-155uc


## Formatting The Data
## 2. Formatting The Data
DANNCE requires a set of videos across multiple views and a `*dannce.mat` file that contains camera calibration parameters, a structure that synchronizes frames across views, and in the case of training, the 3D labels.

We recommend setting up individual project folders for each video recording session, as in the dannce demos (`./demo`), although the dannce configuration files are flexible enough to support more custom file and directory organizations. The demo project folders also contain examples of all of the following formatting information.

**video directories**.
**2.1-video directories**.

DANNCE requires a parent video directory with *n* sub-directories, one for each of *n* cameras. Within each subdirectory, videos must be named according the frame index of the first frame in the file. For example, for a three-camera system, the video directory must look like:

Expand All @@ -144,44 +144,77 @@ DANNCE requires a parent video directory with *n* sub-directories, one for each
|\_\_+--0.mp4


**configuration files**.
**2.2-configuration files**.

`DANNCE` uses two configuration files and one data file.

- *main config*, e.g. `configs/*.yaml`. This file defines data and model hyperparameters. It can be reused across experiments.
- *io config*, e.g. `demo/markerless_mouse_1/io.yaml`. This file defines input data and ouput directories. It is used for a single experiment.
- *dannce.mat*, e.g. `demo/markerless_mouse_1/label3d_dannce.mat`. This file contains three cell arrays of matlab structures. `params` stores the camera parameters for each camera. `sync` stores a vector that synchronizes all cameras. `labelData` stores the frame identities and 3d labels for hand-labeled frames. This file can be produced automatically with `Label3D.exportDannce()`.

**camera calibration parameters**.
**2.3-camera calibration parameters**.
Dannce requires structs for each camera containing the camera's rotation matrix, translation vector, intrinsic matrix, radial distortion, and tangential distortion. If you use our included calibration scripts, you can convert the output to the required format with `utils/convert_calibration.m`.

A properly formatted calibration struct has the following fields, `['R','t','K','RDistort','TDistort']`.

**synchronization files**.
**2.4-synchronization files**.
DANNCE requires a set of sync structs, one for each camera, which define frame synchrony across the different cameras over time. If you know your cameras are reliably synchronized at all times (e.g. via hardware triggering), these files can be generated with the aid of `dannce/utils/makeSyncFiles.py`. Once your video directories are set up correctly, sync files can get generated by running `python dannce/utils/makeSyncFiles.py {path_to_videos} {acquisition_frame_rate} {number_tracked_landmarks}`, where {.} denotes variables you must replace with relevant values. See the `makeSyncFiles.py` docstring for more information.

If your cameras are not natively synchronized, but you can collect timestaps for each frame, sync files should be generated by `dannce/utils/preprocess_data.m`, which will generate sync files from a properly formatted `.mat` file listing the frameID for each camera at each timepoint. See `/dannce/utils/example_matchedframs.mat` file for how these timestamp data should be formatted before running `preprocess_data.m`.

## Hand-Labeling
## 3. Hand-Labeling
For fine-tuning DANNCE to work with your animal and system, we developed a labeling GUI, which can be found in a separate repo: https://github.com/diegoaldarondo/Label3D. The `Label3D` repository should be cloned with DANNCE automatically as a submodule when using `git clone --recursive https://github.com/spoonsso/dannce` When labeling is completed, the labels can be used to train DANNCE and the COMfinder network (see below) after converting the Label3D files to DANNCE format using `Label3D.exportDannce()`.

### Training and Predicting with the COMfinder U-Net
## 4. Training and Predicting with the COMfinder U-Net
DANNCE requires a reasonable estimate of the 3D position of the animal in each frame. We obtain this by triangulating the 2D center of mass (COM) of the animal in each frame. You can use your favorite method to find an estimate of the animal COM in each frame, but we trained a 2D U-Net to do it. Our U-Net typically requires some additional training data to get it working on new views, new environments, and new species. If working with hand-labeled data, your same data structures can be used to train both the COMfinder network and the DANNCE network.

Given formatted data, a properly organized directory structure, and a config file (see config and demo folder, and wiki), navigate to your project folder and run
`com-train /path/to/main_com_config.yaml`
### 4.1 Training COMfinder U-Net
1. Get the data formatted and directory structure organized as described in section 2.1
2. Get the main config and other config files set as described in 2.2. Note, different _io.yaml_ and _dannce.mat_ config files need to be present in each project directory.(see config and demo folder, and wiki)
3. Navigate to your project folder and run `com-train /path/to/main_com_config.yaml` The trained COM network weights will go into `com_train_dir` defined in the io.yaml.

### 4.2 Generating COM predictions
After training, run
`com-predict /path/to/main_com_config.yaml`
to generate center of mass predictions.
to generate center of mass predictions.

### Training and Predicting with DANNCE
The COM predictions may be stored in a separate file or appended to the `label3d_dannce.mat` file.

Once the COM is found, the main DANNCE network can be trained by running:
## 5. Training and Predicting with DANNCE

### 5.1 Training DANNCE
1. Get the COM predictions for your experiments (Section 4.1 and 4.2)
2. If you want to run Dannce from your experiments directory, you can simply train dannce by running
`dannce-train /path/to/main_config.yaml`
3. The training step for DANNCE can be run from a directory other than the project directory. To do this one needs to define the `label3d_dannce.mat` file and corresponding video directories using the `exp` option. Check the expanded io.yaml
4. Once the io.yaml is set appropriately, dannce can be trined by running
`dannce-train /path/to/main_config.yaml`

After training, run
### 5.2 Generating DANNCE Predictions
1. Navigate to the project folder
2. Make sure that the label3d_dannce.mat and io config files are present and properly configured. The io file should point to the weights file which needs to be loaded.
3. Also verify the directory structure for videos. Note, path to videos can be modified in the io to point to exact video file location, and will default to `./videos`.
4. Run `dannce-predict /path/to/main_config.yaml` from within an experiment/project folder to make 3D predictions using the trained model.

`dannce-predict /path/to/main_config.yaml` from within an experiment folder to make 3D predictions using the trained model.

Consult the demo folder for directory and config file formatting examples

__*Note*__: All the dannce scripts should be ideally run from the project folders. This is because, dannce scripts look for all config files (except main_config), videos and `dannce.mat` file inside the directory from which they are called. `dannce-train` could be run from a separate folder, but the directory paths need to be adjusted accordingly in both io config and main config.

__*Note*__: If you are running dannce scripts on a slurm cluster, there are additional config files that can be set according to your node configurations. Please refer to Wiki section Dannce on Slurm HPC for more details

## Contributing

Before you push into the repository, make sure to run the standard tests on the code. The `tests` directory contains all the standard tests to be run. You will need to have the weights and videos in order to run the tests.

After your changes are done, the tests can be run by using the following simple steps:
- Go to the dannce install directory
- Do a pip install
- run `tests/tests.sh`
```
cd dannce
pip install -e .
sh tests/tests.sh
```

If you think the functionality you have included needs to be tested separately, you can include a test for the same under `tests/cli_test.py`
15 changes: 0 additions & 15 deletions cluster/com.sh

This file was deleted.

20 changes: 0 additions & 20 deletions cluster/com_and_dannce.sh

This file was deleted.

34 changes: 0 additions & 34 deletions cluster/com_and_dannce_multi_gpu.sh

This file was deleted.

Loading