deepethogram 0.1.4__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {deepethogram-0.1.4 → deepethogram-0.3.0}/MANIFEST.in +1 -1
- {deepethogram-0.1.4/deepethogram.egg-info → deepethogram-0.3.0}/PKG-INFO +107 -35
- deepethogram-0.1.4/PKG-INFO → deepethogram-0.3.0/README.md +87 -41
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/__init__.py +5 -2
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/__main__.py +2 -2
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/base.py +141 -140
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/callbacks.py +54 -74
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/augs.yaml +1 -1
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/config.yaml +2 -2
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/debug.yaml +1 -1
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/gui.yaml +1 -1
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/inference.yaml +2 -2
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/model/feature_extractor.yaml +1 -1
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/model/flow_generator.yaml +1 -1
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/model/sequence.yaml +2 -2
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/postprocessor.yaml +1 -1
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/preset/deg_f.yaml +1 -1
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/preset/deg_m.yaml +1 -1
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/preset/deg_s.yaml +1 -1
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/train.yaml +0 -1
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/tune/feature_extractor.yaml +2 -2
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/tune/sequence.yaml +2 -2
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/tune/tune.yaml +2 -2
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/configuration.py +57 -57
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/data/augs.py +31 -35
- deepethogram-0.3.0/deepethogram/data/dali.py +258 -0
- deepethogram-0.3.0/deepethogram/data/dataloaders.py +542 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/data/datasets.py +321 -310
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/data/keypoint_utils.py +40 -36
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/data/utils.py +96 -95
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/debug.py +53 -52
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/feature_extractor/inference.py +198 -179
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/feature_extractor/losses.py +24 -47
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/feature_extractor/models/CNN.py +23 -16
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/feature_extractor/models/classifiers/alexnet.py +9 -9
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/feature_extractor/models/classifiers/densenet.py +85 -58
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/feature_extractor/models/classifiers/inception.py +15 -20
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/feature_extractor/models/classifiers/resnet.py +52 -33
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/feature_extractor/models/classifiers/resnet3d.py +33 -72
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/feature_extractor/models/classifiers/squeezenet.py +22 -32
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/feature_extractor/models/classifiers/vgg.py +73 -67
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/feature_extractor/models/hidden_two_stream.py +189 -143
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/feature_extractor/models/utils.py +35 -27
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/feature_extractor/train.py +198 -238
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/file_io.py +22 -24
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/flow_generator/inference.py +91 -84
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/flow_generator/losses.py +154 -64
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/flow_generator/models/FlowNetS.py +13 -19
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/flow_generator/models/MotionNet.py +10 -46
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/flow_generator/models/TinyMotionNet.py +7 -16
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/flow_generator/models/TinyMotionNet3D.py +30 -37
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/flow_generator/models/components.py +61 -41
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/flow_generator/train.py +100 -89
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/flow_generator/utils.py +42 -56
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/gui/custom_widgets.py +118 -284
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/gui/main.py +311 -412
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/gui/mainwindow.py +31 -21
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/gui/menus_and_popups.py +39 -31
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/losses.py +63 -68
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/metrics.py +171 -208
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/postprocessing.py +56 -56
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/projects.py +340 -413
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/schedulers.py +31 -27
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/sequence/__main__.py +1 -1
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/sequence/inference.py +123 -125
- deepethogram-0.3.0/deepethogram/sequence/models/__init__.py +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/sequence/models/mlp.py +14 -7
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/sequence/models/sequence.py +38 -16
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/sequence/models/tgm.py +66 -100
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/sequence/train.py +90 -92
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/stoppers.py +33 -24
- deepethogram-0.3.0/deepethogram/tune/__init__.py +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/tune/feature_extractor.py +68 -55
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/tune/sequence.py +61 -57
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/tune/utils.py +17 -15
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/utils.py +156 -218
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/viz.py +451 -528
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/zscore.py +37 -49
- deepethogram-0.1.4/README.md → deepethogram-0.3.0/deepethogram.egg-info/PKG-INFO +114 -31
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram.egg-info/SOURCES.txt +10 -2
- deepethogram-0.3.0/deepethogram.egg-info/requires.txt +16 -0
- deepethogram-0.3.0/pyproject.toml +108 -0
- deepethogram-0.3.0/tests/test_data.py +28 -0
- deepethogram-0.3.0/tests/test_flow_generator.py +31 -0
- deepethogram-0.3.0/tests/test_gui.py +33 -0
- deepethogram-0.3.0/tests/test_integration.py +182 -0
- deepethogram-0.3.0/tests/test_models.py +18 -0
- deepethogram-0.3.0/tests/test_projects.py +119 -0
- deepethogram-0.3.0/tests/test_softmax.py +0 -0
- deepethogram-0.3.0/tests/test_z_score.py +21 -0
- deepethogram-0.1.4/deepethogram/data/dali.py +0 -189
- deepethogram-0.1.4/deepethogram/data/dataloaders.py +0 -433
- deepethogram-0.1.4/deepethogram/flow_generator/__init__.py +0 -1
- deepethogram-0.1.4/deepethogram/flow_generator/models/__init__.py +0 -1
- deepethogram-0.1.4/deepethogram.egg-info/requires.txt +0 -15
- deepethogram-0.1.4/setup.py +0 -22
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/__init__.py +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/project/project_config_default.yaml +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/conf/zscore.yaml +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/data/__init__.py +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/feature_extractor/__init__.py +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/feature_extractor/__main__.py +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/feature_extractor/models/__init__.py +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/feature_extractor/models/classifiers/__init__.py +0 -0
- {deepethogram-0.1.4/deepethogram/gui → deepethogram-0.3.0/deepethogram/flow_generator}/__init__.py +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/flow_generator/__main__.py +0 -0
- {deepethogram-0.1.4/deepethogram/sequence → deepethogram-0.3.0/deepethogram/flow_generator/models}/__init__.py +0 -0
- {deepethogram-0.1.4/deepethogram/sequence/models → deepethogram-0.3.0/deepethogram/gui}/__init__.py +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/gui/icons/noun_Home_1158721.png +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/gui/icons/noun_Zoom In_744781.png +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/gui/icons/noun_pause_159135.png +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/gui/icons/noun_play_1713293.png +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram/gui/icons/noun_tap_145047.png +0 -0
- {deepethogram-0.1.4/deepethogram/tune → deepethogram-0.3.0/deepethogram/sequence}/__init__.py +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram.egg-info/dependency_links.txt +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram.egg-info/entry_points.txt +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/deepethogram.egg-info/top_level.txt +0 -0
- {deepethogram-0.1.4 → deepethogram-0.3.0}/setup.cfg +0 -0
|
@@ -1,20 +1,35 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: deepethogram
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Temporal action detection for biology
|
|
5
|
-
Author: Jim Bohnslav
|
|
6
|
-
Author-email: jbohnslav@gmail.com
|
|
5
|
+
Author-email: Jim Bohnslav <jbohnslav@gmail.com>
|
|
7
6
|
Classifier: Programming Language :: Python :: 3
|
|
8
7
|
Classifier: Operating System :: OS Independent
|
|
9
|
-
Requires-Python:
|
|
8
|
+
Requires-Python: <3.12,>=3.9
|
|
10
9
|
Description-Content-Type: text/markdown
|
|
10
|
+
Requires-Dist: chardet
|
|
11
|
+
Requires-Dist: h5py
|
|
12
|
+
Requires-Dist: kornia>=0.5
|
|
13
|
+
Requires-Dist: matplotlib
|
|
14
|
+
Requires-Dist: numpy
|
|
15
|
+
Requires-Dist: omegaconf>=2
|
|
16
|
+
Requires-Dist: opencv-python-headless
|
|
17
|
+
Requires-Dist: opencv-transforms
|
|
18
|
+
Requires-Dist: pandas<2.1,>=1.5
|
|
19
|
+
Requires-Dist: PySide6>=6.6.0
|
|
20
|
+
Requires-Dist: scikit-learn<1.4,>=1.2
|
|
21
|
+
Requires-Dist: scipy<1.11,>=1.9
|
|
22
|
+
Requires-Dist: torch==2.4.1
|
|
23
|
+
Requires-Dist: tqdm
|
|
24
|
+
Requires-Dist: vidio
|
|
25
|
+
Requires-Dist: pytorch_lightning==1.6.5
|
|
11
26
|
|
|
12
27
|
# DeepEthogram
|
|
13
28
|
- Written by Jim Bohnslav, except where as noted
|
|
14
29
|
- JBohnslav@gmail.com
|
|
15
30
|
|
|
16
|
-
DeepEthogram is an open-source package for automatically classifying each frame of a video into a set of pre-defined
|
|
17
|
-
behaviors. Designed for neuroscience research, it could be used in any scenario where you need to detect actions from
|
|
31
|
+
DeepEthogram is an open-source package for automatically classifying each frame of a video into a set of pre-defined
|
|
32
|
+
behaviors. Designed for neuroscience research, it could be used in any scenario where you need to detect actions from
|
|
18
33
|
each frame of a video.
|
|
19
34
|
|
|
20
35
|
Example use cases:
|
|
@@ -23,7 +38,7 @@ Example use cases:
|
|
|
23
38
|
* Counting licks from video for appetite measurement
|
|
24
39
|
* Measuring reach onset times for alignment with neural activity
|
|
25
40
|
|
|
26
|
-
DeepEthogram uses state-of-the-art algorithms for *temporal action detection*. We build on the following previous machine
|
|
41
|
+
DeepEthogram uses state-of-the-art algorithms for *temporal action detection*. We build on the following previous machine
|
|
27
42
|
learning research into action detection:
|
|
28
43
|
* [Hidden Two-Stream Convolutional Networks for Action Recognition](https://arxiv.org/abs/1704.00389)
|
|
29
44
|
* [Temporal Gaussian Mixture Layer for Videos](https://arxiv.org/abs/1803.06316)
|
|
@@ -31,24 +46,46 @@ learning research into action detection:
|
|
|
31
46
|

|
|
32
47
|
|
|
33
48
|
## Installation
|
|
34
|
-
|
|
49
|
+
DeepEthogram recently migrated from Miniconda/pip to [uv](https://docs.astral.sh/uv/). Current releases are uv-first,
|
|
50
|
+
recommend Python 3.11, support Python `>=3.9,<3.12`, and use PySide6 for the GUI.
|
|
35
51
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
52
|
+
Install uv first:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
56
|
+
# or
|
|
57
|
+
brew install uv
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
For development from this repository:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
git clone https://github.com/jbohnslav/deepethogram.git
|
|
64
|
+
cd deepethogram
|
|
65
|
+
uv sync
|
|
66
|
+
uv run deepethogram
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
For a user install:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
uv pip install deepethogram
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Detailed setup, troubleshooting, and legacy conda/pip instructions for older releases are in [docs/installation.md](docs/installation.md).
|
|
39
76
|
|
|
40
77
|
## Data
|
|
41
|
-
**NEW!** All datasets collected and annotated by the DeepEthogram authors are now available from this DropBox link:
|
|
78
|
+
**NEW!** All datasets collected and annotated by the DeepEthogram authors are now available from this DropBox link:
|
|
42
79
|
https://www.dropbox.com/sh/3lilfob0sz21och/AABv8o8KhhRQhYCMNu0ilR8wa?dl=0
|
|
43
80
|
|
|
44
|
-
If you have issues downloading the data, please raise an issue on Github.
|
|
81
|
+
If you have issues downloading the data, please raise an issue on Github.
|
|
45
82
|
|
|
46
83
|
## COLAB
|
|
47
|
-
I've written a Colab notebook that shows how to upload your data and train models. You can also use this if you don't
|
|
48
|
-
have access to a decent GPU.
|
|
84
|
+
I've written a Colab notebook that shows how to upload your data and train models. You can also use this if you don't
|
|
85
|
+
have access to a decent GPU.
|
|
49
86
|
|
|
50
|
-
To use it, please [click this link to the Colab notebook](https://colab.research.google.com/drive/1Nf9FU7FD77wgvbUFc608839v2jPYgDhd?usp=sharing).
|
|
51
|
-
Then, click `copy to Drive` at the top. You won't be able to save your changes to the notebook as-is.
|
|
87
|
+
To use it, please [click this link to the Colab notebook](https://colab.research.google.com/drive/1Nf9FU7FD77wgvbUFc608839v2jPYgDhd?usp=sharing).
|
|
88
|
+
Then, click `copy to Drive` at the top. You won't be able to save your changes to the notebook as-is.
|
|
52
89
|
|
|
53
90
|
|
|
54
91
|
## News
|
|
@@ -56,27 +93,27 @@ We now support docker! Docker is a way to run `deepethogram` in completely repro
|
|
|
56
93
|
with other system dependencies. [See docs/Docker for more information](docs/docker.md)
|
|
57
94
|
|
|
58
95
|
## Pretrained models
|
|
59
|
-
Rather than start from scratch, we will start with model weights pretrained on the Kinetics700 dataset. Go to
|
|
96
|
+
Rather than start from scratch, we will start with model weights pretrained on the Kinetics700 dataset. Go to
|
|
60
97
|
To download the pretrained weights, please use [this Google Drive link](https://drive.google.com/file/d/1ntIZVbOG1UAiFVlsAAuKEBEVCVevyets/view?usp=sharing).
|
|
61
|
-
Unzip the files in your `project/models` directory. Make sure that you don't add an extra directory when unzipping! The path should be
|
|
98
|
+
Unzip the files in your `project/models` directory. Make sure that you don't add an extra directory when unzipping! The path should be
|
|
62
99
|
`your_project/models/pretrained_models/{models 1:6}`, not `your_project/models/pretrained_models/pretrained_models/{models1:6}`.
|
|
63
100
|
|
|
64
101
|
## Licensing
|
|
65
102
|
Copyright (c) 2020 - President and Fellows of Harvard College. All rights reserved.
|
|
66
103
|
|
|
67
|
-
This software is free for academic use. For commercial use, please contact the Harvard Office of Technology
|
|
68
|
-
Development (hms_otd@harvard.edu) with cc to Dr. Chris Harvey. For details, see [license.txt](license.txt).
|
|
104
|
+
This software is free for academic use. For commercial use, please contact the Harvard Office of Technology
|
|
105
|
+
Development (hms_otd@harvard.edu) with cc to Dr. Chris Harvey. For details, see [license.txt](license.txt).
|
|
69
106
|
|
|
70
107
|
## Usage
|
|
71
108
|
### [To use the GUI, click](docs/using_gui.md)
|
|
72
109
|
#### [To use the command line interface, click](docs/using_CLI.md)
|
|
73
110
|
|
|
74
111
|
## Dependencies
|
|
75
|
-
The major dependencies for DeepEthogram are as follows:
|
|
112
|
+
The major dependencies for DeepEthogram are as follows:
|
|
76
113
|
* pytorch, torchvision: all the neural networks, training, and inference pipelines were written in PyTorch
|
|
77
114
|
* pytorch-lightning: for nice model training base classes
|
|
78
115
|
* kornia: for GPU-based image augmentations
|
|
79
|
-
*
|
|
116
|
+
* PySide6: for the GUI
|
|
80
117
|
* opencv: for video and image reading and writing
|
|
81
118
|
* opencv_transforms: for fast image augmentation
|
|
82
119
|
* scikit-learn, scipy: for binary classification metrics
|
|
@@ -87,25 +124,60 @@ The major dependencies for DeepEthogram are as follows:
|
|
|
87
124
|
* tqdm: for nice progress bars
|
|
88
125
|
|
|
89
126
|
## Hardware requirements
|
|
90
|
-
For GUI usage, we expect that the users will be working on a local workstation with a good NVIDIA graphics card. For training via a cluster, you can use the command line interface.
|
|
127
|
+
For GUI usage, we expect that the users will be working on a local workstation with a good NVIDIA graphics card. For training via a cluster, you can use the command line interface.
|
|
91
128
|
|
|
92
129
|
* CPU: 4 cores or more for parallel data loading
|
|
93
130
|
* Hard Drive: SSD at minimum, NVMe drive is better.
|
|
94
|
-
* GPU: DeepEthogram speed is directly related to GPU performance. An NVIDIA GPU is absolutely required, as PyTorch uses
|
|
95
|
-
CUDA, while AMD does not.
|
|
131
|
+
* GPU: DeepEthogram speed is directly related to GPU performance. An NVIDIA GPU is absolutely required, as PyTorch uses
|
|
132
|
+
CUDA, while AMD does not.
|
|
96
133
|
The more VRAM you have, the more data you can fit in one batch, which generally increases performance. a
|
|
97
134
|
I'd recommend 6GB VRAM at absolute minimum. 8GB is better, with 10+ GB preferred.
|
|
98
|
-
Recommended GPUs: `RTX 3090`, `RTX 3080`, `Titan RTX`, `2080 Ti`, `2080 super`, `2080`, `1080 Ti`, `2070 super`, `2070`
|
|
99
|
-
Some older ones might also be fine, like a `1080` or even `1070 Ti`/ `1070`.
|
|
135
|
+
Recommended GPUs: `RTX 3090`, `RTX 3080`, `Titan RTX`, `2080 Ti`, `2080 super`, `2080`, `1080 Ti`, `2070 super`, `2070`
|
|
136
|
+
Some older ones might also be fine, like a `1080` or even `1070 Ti`/ `1070`.
|
|
100
137
|
|
|
101
138
|
## testing
|
|
102
|
-
Test coverage is still low, but in the future we will be expanding our unit tests.
|
|
139
|
+
Test coverage is still low, but in the future we will be expanding our unit tests.
|
|
103
140
|
|
|
104
141
|
First, download a copy of [`testing_deepethogram_archive.zip`](https://drive.google.com/file/d/1IFz4ABXppVxyuhYik8j38k9-Fl9kYKHo/view?usp=sharing)
|
|
105
|
-
|
|
106
|
-
directory, so that the path is `deepethogram/tests/DATA/testing_deepethogram_archive/{DATA,models,project_config.yaml}`.
|
|
107
|
-
|
|
108
|
-
|
|
142
|
+
Make a directory in tests called `DATA`. Unzip this and move it to the `deepethogram/tests/DATA`
|
|
143
|
+
directory, so that the path is `deepethogram/tests/DATA/testing_deepethogram_archive/{DATA,models,project_config.yaml}`.
|
|
144
|
+
|
|
145
|
+
To run tests:
|
|
146
|
+
```bash
|
|
147
|
+
# Run all tests except GPU tests (default)
|
|
148
|
+
uv run pytest tests/
|
|
149
|
+
|
|
150
|
+
# Run only GPU tests (requires NVIDIA GPU)
|
|
151
|
+
uv run pytest -m gpu
|
|
152
|
+
|
|
153
|
+
# Run all tests including GPU tests
|
|
154
|
+
uv run pytest -m ""
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
GPU tests are skipped by default as they require significant computational resources and time to complete. These tests perform end-to-end model training and inference.
|
|
158
|
+
|
|
159
|
+
## Developer Guide
|
|
160
|
+
### Code Style and Pre-commit Hooks
|
|
161
|
+
We use pre-commit hooks to maintain code quality and consistency. The hooks include:
|
|
162
|
+
- Ruff for Python linting and formatting
|
|
163
|
+
- Various file checks (trailing whitespace, YAML validation, etc.)
|
|
164
|
+
|
|
165
|
+
To set up the development environment:
|
|
166
|
+
|
|
167
|
+
1. Install the development dependencies:
|
|
168
|
+
```bash
|
|
169
|
+
uv sync --dev
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
2. Install pre-commit hooks:
|
|
173
|
+
```bash
|
|
174
|
+
uvx pre-commit install
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
The hooks will run automatically on every commit. You can also run them manually on all files:
|
|
178
|
+
```bash
|
|
179
|
+
uvx pre-commit run --all-files
|
|
180
|
+
```
|
|
109
181
|
|
|
110
182
|
## Changelog
|
|
111
183
|
* 0.1.4: bugfixes for dependencies; added docker
|
|
@@ -113,6 +185,6 @@ and inference. Its name reflects the fact that it should come last in testing.
|
|
|
113
185
|
* 0.1.1.post1/2: batch prediction
|
|
114
186
|
* 0.1.1.post0: flow generator metric bug fix
|
|
115
187
|
* 0.1.1: bug fixes
|
|
116
|
-
* 0.1: deepethogram beta! See above for details.
|
|
188
|
+
* 0.1: deepethogram beta! See above for details.
|
|
117
189
|
* 0.0.1.post1: bug fixes and video conversion scripts added
|
|
118
190
|
* 0.0.1: initial version
|
|
@@ -1,20 +1,9 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: deepethogram
|
|
3
|
-
Version: 0.1.4
|
|
4
|
-
Summary: Temporal action detection for biology
|
|
5
|
-
Author: Jim Bohnslav
|
|
6
|
-
Author-email: jbohnslav@gmail.com
|
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
|
8
|
-
Classifier: Operating System :: OS Independent
|
|
9
|
-
Requires-Python: >=3.6
|
|
10
|
-
Description-Content-Type: text/markdown
|
|
11
|
-
|
|
12
1
|
# DeepEthogram
|
|
13
2
|
- Written by Jim Bohnslav, except where as noted
|
|
14
3
|
- JBohnslav@gmail.com
|
|
15
4
|
|
|
16
|
-
DeepEthogram is an open-source package for automatically classifying each frame of a video into a set of pre-defined
|
|
17
|
-
behaviors. Designed for neuroscience research, it could be used in any scenario where you need to detect actions from
|
|
5
|
+
DeepEthogram is an open-source package for automatically classifying each frame of a video into a set of pre-defined
|
|
6
|
+
behaviors. Designed for neuroscience research, it could be used in any scenario where you need to detect actions from
|
|
18
7
|
each frame of a video.
|
|
19
8
|
|
|
20
9
|
Example use cases:
|
|
@@ -23,7 +12,7 @@ Example use cases:
|
|
|
23
12
|
* Counting licks from video for appetite measurement
|
|
24
13
|
* Measuring reach onset times for alignment with neural activity
|
|
25
14
|
|
|
26
|
-
DeepEthogram uses state-of-the-art algorithms for *temporal action detection*. We build on the following previous machine
|
|
15
|
+
DeepEthogram uses state-of-the-art algorithms for *temporal action detection*. We build on the following previous machine
|
|
27
16
|
learning research into action detection:
|
|
28
17
|
* [Hidden Two-Stream Convolutional Networks for Action Recognition](https://arxiv.org/abs/1704.00389)
|
|
29
18
|
* [Temporal Gaussian Mixture Layer for Videos](https://arxiv.org/abs/1803.06316)
|
|
@@ -31,24 +20,46 @@ learning research into action detection:
|
|
|
31
20
|

|
|
32
21
|
|
|
33
22
|
## Installation
|
|
34
|
-
|
|
23
|
+
DeepEthogram recently migrated from Miniconda/pip to [uv](https://docs.astral.sh/uv/). Current releases are uv-first,
|
|
24
|
+
recommend Python 3.11, support Python `>=3.9,<3.12`, and use PySide6 for the GUI.
|
|
25
|
+
|
|
26
|
+
Install uv first:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
30
|
+
# or
|
|
31
|
+
brew install uv
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
For development from this repository:
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
```bash
|
|
37
|
+
git clone https://github.com/jbohnslav/deepethogram.git
|
|
38
|
+
cd deepethogram
|
|
39
|
+
uv sync
|
|
40
|
+
uv run deepethogram
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
For a user install:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
uv pip install deepethogram
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Detailed setup, troubleshooting, and legacy conda/pip instructions for older releases are in [docs/installation.md](docs/installation.md).
|
|
39
50
|
|
|
40
51
|
## Data
|
|
41
|
-
**NEW!** All datasets collected and annotated by the DeepEthogram authors are now available from this DropBox link:
|
|
52
|
+
**NEW!** All datasets collected and annotated by the DeepEthogram authors are now available from this DropBox link:
|
|
42
53
|
https://www.dropbox.com/sh/3lilfob0sz21och/AABv8o8KhhRQhYCMNu0ilR8wa?dl=0
|
|
43
54
|
|
|
44
|
-
If you have issues downloading the data, please raise an issue on Github.
|
|
55
|
+
If you have issues downloading the data, please raise an issue on Github.
|
|
45
56
|
|
|
46
57
|
## COLAB
|
|
47
|
-
I've written a Colab notebook that shows how to upload your data and train models. You can also use this if you don't
|
|
48
|
-
have access to a decent GPU.
|
|
58
|
+
I've written a Colab notebook that shows how to upload your data and train models. You can also use this if you don't
|
|
59
|
+
have access to a decent GPU.
|
|
49
60
|
|
|
50
|
-
To use it, please [click this link to the Colab notebook](https://colab.research.google.com/drive/1Nf9FU7FD77wgvbUFc608839v2jPYgDhd?usp=sharing).
|
|
51
|
-
Then, click `copy to Drive` at the top. You won't be able to save your changes to the notebook as-is.
|
|
61
|
+
To use it, please [click this link to the Colab notebook](https://colab.research.google.com/drive/1Nf9FU7FD77wgvbUFc608839v2jPYgDhd?usp=sharing).
|
|
62
|
+
Then, click `copy to Drive` at the top. You won't be able to save your changes to the notebook as-is.
|
|
52
63
|
|
|
53
64
|
|
|
54
65
|
## News
|
|
@@ -56,27 +67,27 @@ We now support docker! Docker is a way to run `deepethogram` in completely repro
|
|
|
56
67
|
with other system dependencies. [See docs/Docker for more information](docs/docker.md)
|
|
57
68
|
|
|
58
69
|
## Pretrained models
|
|
59
|
-
Rather than start from scratch, we will start with model weights pretrained on the Kinetics700 dataset. Go to
|
|
70
|
+
Rather than start from scratch, we will start with model weights pretrained on the Kinetics700 dataset. Go to
|
|
60
71
|
To download the pretrained weights, please use [this Google Drive link](https://drive.google.com/file/d/1ntIZVbOG1UAiFVlsAAuKEBEVCVevyets/view?usp=sharing).
|
|
61
|
-
Unzip the files in your `project/models` directory. Make sure that you don't add an extra directory when unzipping! The path should be
|
|
72
|
+
Unzip the files in your `project/models` directory. Make sure that you don't add an extra directory when unzipping! The path should be
|
|
62
73
|
`your_project/models/pretrained_models/{models 1:6}`, not `your_project/models/pretrained_models/pretrained_models/{models1:6}`.
|
|
63
74
|
|
|
64
75
|
## Licensing
|
|
65
76
|
Copyright (c) 2020 - President and Fellows of Harvard College. All rights reserved.
|
|
66
77
|
|
|
67
|
-
This software is free for academic use. For commercial use, please contact the Harvard Office of Technology
|
|
68
|
-
Development (hms_otd@harvard.edu) with cc to Dr. Chris Harvey. For details, see [license.txt](license.txt).
|
|
78
|
+
This software is free for academic use. For commercial use, please contact the Harvard Office of Technology
|
|
79
|
+
Development (hms_otd@harvard.edu) with cc to Dr. Chris Harvey. For details, see [license.txt](license.txt).
|
|
69
80
|
|
|
70
81
|
## Usage
|
|
71
82
|
### [To use the GUI, click](docs/using_gui.md)
|
|
72
83
|
#### [To use the command line interface, click](docs/using_CLI.md)
|
|
73
84
|
|
|
74
85
|
## Dependencies
|
|
75
|
-
The major dependencies for DeepEthogram are as follows:
|
|
86
|
+
The major dependencies for DeepEthogram are as follows:
|
|
76
87
|
* pytorch, torchvision: all the neural networks, training, and inference pipelines were written in PyTorch
|
|
77
88
|
* pytorch-lightning: for nice model training base classes
|
|
78
89
|
* kornia: for GPU-based image augmentations
|
|
79
|
-
*
|
|
90
|
+
* PySide6: for the GUI
|
|
80
91
|
* opencv: for video and image reading and writing
|
|
81
92
|
* opencv_transforms: for fast image augmentation
|
|
82
93
|
* scikit-learn, scipy: for binary classification metrics
|
|
@@ -87,25 +98,60 @@ The major dependencies for DeepEthogram are as follows:
|
|
|
87
98
|
* tqdm: for nice progress bars
|
|
88
99
|
|
|
89
100
|
## Hardware requirements
|
|
90
|
-
For GUI usage, we expect that the users will be working on a local workstation with a good NVIDIA graphics card. For training via a cluster, you can use the command line interface.
|
|
101
|
+
For GUI usage, we expect that the users will be working on a local workstation with a good NVIDIA graphics card. For training via a cluster, you can use the command line interface.
|
|
91
102
|
|
|
92
103
|
* CPU: 4 cores or more for parallel data loading
|
|
93
104
|
* Hard Drive: SSD at minimum, NVMe drive is better.
|
|
94
|
-
* GPU: DeepEthogram speed is directly related to GPU performance. An NVIDIA GPU is absolutely required, as PyTorch uses
|
|
95
|
-
CUDA, while AMD does not.
|
|
105
|
+
* GPU: DeepEthogram speed is directly related to GPU performance. An NVIDIA GPU is absolutely required, as PyTorch uses
|
|
106
|
+
CUDA, while AMD does not.
|
|
96
107
|
The more VRAM you have, the more data you can fit in one batch, which generally increases performance. a
|
|
97
108
|
I'd recommend 6GB VRAM at absolute minimum. 8GB is better, with 10+ GB preferred.
|
|
98
|
-
Recommended GPUs: `RTX 3090`, `RTX 3080`, `Titan RTX`, `2080 Ti`, `2080 super`, `2080`, `1080 Ti`, `2070 super`, `2070`
|
|
99
|
-
Some older ones might also be fine, like a `1080` or even `1070 Ti`/ `1070`.
|
|
109
|
+
Recommended GPUs: `RTX 3090`, `RTX 3080`, `Titan RTX`, `2080 Ti`, `2080 super`, `2080`, `1080 Ti`, `2070 super`, `2070`
|
|
110
|
+
Some older ones might also be fine, like a `1080` or even `1070 Ti`/ `1070`.
|
|
100
111
|
|
|
101
112
|
## testing
|
|
102
|
-
Test coverage is still low, but in the future we will be expanding our unit tests.
|
|
113
|
+
Test coverage is still low, but in the future we will be expanding our unit tests.
|
|
103
114
|
|
|
104
115
|
First, download a copy of [`testing_deepethogram_archive.zip`](https://drive.google.com/file/d/1IFz4ABXppVxyuhYik8j38k9-Fl9kYKHo/view?usp=sharing)
|
|
105
|
-
|
|
106
|
-
directory, so that the path is `deepethogram/tests/DATA/testing_deepethogram_archive/{DATA,models,project_config.yaml}`.
|
|
107
|
-
|
|
108
|
-
|
|
116
|
+
Make a directory in tests called `DATA`. Unzip this and move it to the `deepethogram/tests/DATA`
|
|
117
|
+
directory, so that the path is `deepethogram/tests/DATA/testing_deepethogram_archive/{DATA,models,project_config.yaml}`.
|
|
118
|
+
|
|
119
|
+
To run tests:
|
|
120
|
+
```bash
|
|
121
|
+
# Run all tests except GPU tests (default)
|
|
122
|
+
uv run pytest tests/
|
|
123
|
+
|
|
124
|
+
# Run only GPU tests (requires NVIDIA GPU)
|
|
125
|
+
uv run pytest -m gpu
|
|
126
|
+
|
|
127
|
+
# Run all tests including GPU tests
|
|
128
|
+
uv run pytest -m ""
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
GPU tests are skipped by default as they require significant computational resources and time to complete. These tests perform end-to-end model training and inference.
|
|
132
|
+
|
|
133
|
+
## Developer Guide
|
|
134
|
+
### Code Style and Pre-commit Hooks
|
|
135
|
+
We use pre-commit hooks to maintain code quality and consistency. The hooks include:
|
|
136
|
+
- Ruff for Python linting and formatting
|
|
137
|
+
- Various file checks (trailing whitespace, YAML validation, etc.)
|
|
138
|
+
|
|
139
|
+
To set up the development environment:
|
|
140
|
+
|
|
141
|
+
1. Install the development dependencies:
|
|
142
|
+
```bash
|
|
143
|
+
uv sync --dev
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
2. Install pre-commit hooks:
|
|
147
|
+
```bash
|
|
148
|
+
uvx pre-commit install
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The hooks will run automatically on every commit. You can also run them manually on all files:
|
|
152
|
+
```bash
|
|
153
|
+
uvx pre-commit run --all-files
|
|
154
|
+
```
|
|
109
155
|
|
|
110
156
|
## Changelog
|
|
111
157
|
* 0.1.4: bugfixes for dependencies; added docker
|
|
@@ -113,6 +159,6 @@ and inference. Its name reflects the fact that it should come last in testing.
|
|
|
113
159
|
* 0.1.1.post1/2: batch prediction
|
|
114
160
|
* 0.1.1.post0: flow generator metric bug fix
|
|
115
161
|
* 0.1.1: bug fixes
|
|
116
|
-
* 0.1: deepethogram beta! See above for details.
|
|
162
|
+
* 0.1: deepethogram beta! See above for details.
|
|
117
163
|
* 0.0.1.post1: bug fixes and video conversion scripts added
|
|
118
164
|
* 0.0.1: initial version
|
|
@@ -7,9 +7,12 @@
|
|
|
7
7
|
# from deepethogram.sequence.inference import sequence_inference
|
|
8
8
|
import importlib.util
|
|
9
9
|
|
|
10
|
-
spec = importlib.util.find_spec(
|
|
10
|
+
spec = importlib.util.find_spec("hydra")
|
|
11
11
|
if spec is not None:
|
|
12
|
-
raise ValueError(
|
|
12
|
+
raise ValueError(
|
|
13
|
+
"Hydra installation found. Remove it from the current environment, for example with "
|
|
14
|
+
"`uv pip uninstall hydra-core`: {}".format(spec)
|
|
15
|
+
)
|
|
13
16
|
# try:
|
|
14
17
|
# import hydra
|
|
15
18
|
# except Exception as e:
|