jbohnslav commited on
Commit
ce7036e
·
verified ·
1 Parent(s): 2a31dfd

Publish NAS-sourced pretrained MotionNet

Browse files
Files changed (6) hide show
  1. LICENSE +39 -0
  2. README.md +104 -0
  3. SHA256SUMS +4 -0
  4. checkpoint.pt +3 -0
  5. hyperparameters.yaml +94 -0
  6. model_config.json +19 -0
LICENSE ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Academic and Non-Commercial Research Use Software License and Terms of Use
2
+ DeepEthogram: Automated behavior classification (the “Software”, tracked by Harvard Case No. 8336). The Software was developed by Christopher Harvey and Jim Bohnslav, Department of Neurobiology, Harvard Medical School.
3
+ Using the Software indicates your agreement to be bound by the terms of this Software Use Agreement (“Agreement”). Absent your agreement to the terms below, you (the “End User”) have no rights to hold or use the Software whatsoever.
4
+ President and Fellows of Harvard College (“Harvard”) agrees to grant hereunder the limited non-exclusive license to End User for the use of the Software in the performance of End User’s internal, non-commercial research and academic use at End User’s academic or not-for-profit research institution (“Institution”) on the following terms and conditions:
5
+ 1. NO REDISTRIBUTION. The Software remains the property of Harvard, and End User shall not publish, distribute, or otherwise transfer or make available the Software to any other party.
6
+
7
+ 2. NO COMMERCIAL USE. End User shall not use the Software for commercial purposes, including for any internal research purposes for or on behalf of any for-profit entity, and any such use of the Software is expressly prohibited. This prohibition includes, but is not limited to, use of the Software in fee-for-service arrangements, core facilities or laboratories or to provide research services to (or in collaboration with) third parties for a fee, and in industry-sponsored collaborative research projects where any commercial rights are granted to the sponsor. If End User wishes to use the Software for commercial purposes or for any other restricted purpose, End User must execute a separate license agreement with Harvard.
8
+
9
+ Requests for use of the Software for or on behalf of for-profit entities or for any commercial purposes, please contact:
10
+
11
+ Office of Technology Development
12
+ Harvard University
13
+ Smith Campus Center, Suite 727E
14
+ 1350 Massachusetts Avenue
15
+ Cambridge, MA 02138 USA
16
+ Telephone: (617) 495-3067
17
+ E-mail: otd@harvard.edu
18
+
19
+ 3. OWNERSHIP AND COPYRIGHT NOTICE. Harvard owns all intellectual property in the Software. End User shall gain no ownership to the Software. End User shall not remove or delete and shall retain in the Software, in any modifications to Software and in any Derivative Works, the copyright, trademark, or other notices pertaining to Software as provided with the Software.
20
+
21
+ 4. DERIVATIVE WORKS. End User may create and use Derivative Works, as such term is defined under U.S. copyright laws, provided that any such Derivative Works shall be restricted to non-commercial, internal research and academic use at End User’s Institution. End User shall not distribute Derivative Works to any third party without the express written consent of Harvard.
22
+
23
+ 5. FEEDBACK. In order to improve the Software, comments from End Users may be useful. End User agrees to provide Harvard with feedback on the End User’s use of the Software (e.g., any bugs in the Software, the user experience, etc.). Harvard is permitted to use such information provided by End User in making changes and improvements to the Software without compensation or an accounting to End User.
24
+
25
+ 6. NON ASSERT. End User acknowledges that Harvard may develop modifications to the Software that may be based on the feedback provided by End User under Section 5 above. Harvard shall not be restricted in any way by End User regarding the use of such information. End User acknowledges the right of Harvard to prepare, publish, display, reproduce, transmit and or use modifications to the Software that may be substantially similar or functionally equivalent to End User’s modifications and/or improvements if any. In the event that End User obtains patent protection for any modification or improvement to Software, End User agrees not to allege or enjoin infringement of End User’s patent against Harvard or any of its researchers, medical or research staff, officers, directors and employees.
26
+
27
+ 7. PUBLICATION & ATTRIBUTION. End User has the right to publish, present, or share results from the use of the Software.  In accordance with customary academic practice, End User will acknowledge Harvard as the provider of the Software and may cite the relevant reference(s) from the following list of publications: N/A
28
+
29
+ 8. NO WARRANTIES. THE SOFTWARE IS PROVIDED "AS IS." TO THE FULLEST EXTENT PERMITTED BY LAW, HARVARD HEREBY DISCLAIMS ALL WARRANTIES OF ANY KIND (EXPRESS, IMPLIED OR OTHERWISE) REGARDING THE SOFTWARE, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OWNERSHIP, AND NON-INFRINGEMENT. HARVARD MAKES NO WARRANTY ABOUT THE ACCURACY, RELIABILITY, COMPLETENESS, TIMELINESS, SUFFICIENCY OR QUALITY OF THE SOFTWARE. HARVARD DOES NOT WARRANT THAT THE SOFTWARE WILL OPERATE WITHOUT ERROR OR INTERRUPTION.
30
+
31
+ 9. Limitations of Liability and Remedies. USE OF THE SOFTWARE IS AT END USER’S OWN RISK. IF END USER IS DISSATISFIED WITH THE SOFTWARE, ITS EXCLUSIVE REMEDY IS TO STOP USING IT. IN NO EVENT SHALL HARVARD BE LIABLE TO END USER OR ITS INSTITUTION, IN CONTRACT, TORT OR OTHERWISE, FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR OTHER DAMAGES OF ANY KIND WHATSOEVER ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE, EVEN IF HARVARD IS NEGLIGENT OR OTHERWISE AT FAULT, AND REGARDLESS OF WHETHER HARVARD IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
32
+
33
+ 10. INDEMNIFICATION. To the extent permitted by law, End User shall indemnify, defend and hold harmless Harvard and its current or future directors, trustees, officers, faculty, medical and professional staff, employees, students and agents and their respective successors, heirs and assigns (the "Indemnitees"), against any liability, damage, loss or expense (including reasonable attorney's fees and expenses of litigation) incurred by or imposed upon the Indemnitees or any one of them in connection with any claims, suits, actions, demands or judgments arising from End User’s breach of this Agreement or its Institution’s use of the Software except to the extent caused by the gross negligence or willful misconduct of Harvard. This indemnification provision shall survive expiration or termination of this Agreement.
34
+
35
+ 11. GOVERNING LAW. This Agreement shall be construed and governed by the laws of the Commonwealth of Massachusetts regardless of otherwise applicable choice of law standards.
36
+
37
+ 12. NON-USE OF NAME. Nothing in this License and Terms of Use shall be construed as granting End Users or their Institutions any rights or licenses to use any trademarks, service marks or logos associated with the Software. You may not use the terms “Harvard” (or a substantially similar term) in any way that is inconsistent with the permitted uses described herein. You agree not to use any name or emblem of Harvard or any of its subdivisions for any purpose, or to falsely suggest any relationship between End User (or its Institution) and Harvard, or in any manner that would infringe or violate any of Harvard’s rights.
38
+
39
+ 13. End User represents and warrants that it has the legal authority to enter into this License and Terms of Use on behalf of itself and its Institution.
README.md ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ model_name: DeepEthogram MotionNet
3
+ language: en
4
+ license: other
5
+ license_name: deepethogram-academic-noncommercial
6
+ license_link: LICENSE
7
+ library_name: deepethogram
8
+ tags:
9
+ - deepethogram
10
+ - pytorch
11
+ - optical-flow
12
+ - motionnet
13
+ - motionnet
14
+ - kinetics700
15
+ - animal-behavior
16
+ - pretrained
17
+ ---
18
+
19
+ # DeepEthogram MotionNet
20
+
21
+ MotionNet is a optical-flow generator pretrained on Kinetics700 videos for [DeepEthogram](https://github.com/jbohnslav/deepethogram).
22
+ This repository contains this model's checkpoint and historical training hyperparameters.
23
+ See the [DeepEthogram collection](https://huggingface.co/collections/jbohnslav/deepethogram-pretrained-models-6ad61e8af1ac368c56d8deec) for the other models.
24
+
25
+ ## Model details
26
+
27
+ | Property | Value |
28
+ | --- | --- |
29
+ | Architecture | MotionNet |
30
+ | Task | optical-flow |
31
+ | Input | 11 RGB frames stacked as `(N, 33, H, W)` |
32
+ | Output | a three-scale optical-flow pyramid; highest-resolution shape `(1, 20, 32, 32)` for the example |
33
+ | Pretraining data | Kinetics700, as recorded in the historical hyperparameters |
34
+ | Source run | `200310_174416_MotionNet_kinetics` |
35
+ | Framework | PyTorch; DeepEthogram |
36
+
37
+ The model predicts motion fields from video frames. It does not classify behaviors.
38
+ Hugging Face has no dedicated optical-flow pipeline category in its current task registry;
39
+ this repo uses the explicit `optical-flow` tag and DeepEthogram library metadata.
40
+
41
+ ## Download and load
42
+
43
+ Install DeepEthogram and the [Hugging Face CLI](https://huggingface.co/docs/huggingface_hub/guides/cli).
44
+ Download only this model into an existing DeepEthogram project's pretrained directory:
45
+
46
+ ```bash
47
+ hf download jbohnslav/deepethogram-motionnet --revision nas-2026-10-19 --local-dir /path/to/project/models/pretrained_models/200310_174416_MotionNet_kinetics
48
+ ```
49
+
50
+ From that run directory, verify the artifacts with `shasum -a 256 -c SHA256SUMS`.
51
+ The `checkpoint.pt` and `hyperparameters.yaml` at its root let DeepEthogram discover
52
+ this model using its existing project layout.
53
+
54
+ To load directly in Python, set `run_dir` to the directory downloaded above:
55
+
56
+ ```python
57
+ from pathlib import Path
58
+ import torch
59
+ from deepethogram import utils
60
+
61
+ from deepethogram.flow_generator.models.MotionNet import MotionNet
62
+ model = MotionNet()
63
+ run_dir = Path('/path/to/project/models/pretrained_models/200310_174416_MotionNet_kinetics')
64
+ state_dict, _, _ = utils.load_state_dict_from_file(run_dir / 'checkpoint.pt')
65
+ model.load_state_dict(state_dict, strict=True)
66
+ model.eval()
67
+ with torch.inference_mode():
68
+ output = model(torch.zeros(1, 33, 64, 64))
69
+ ```
70
+
71
+ The zero-valued example checks shapes and loading. For real videos use DeepEthogram's
72
+ video preprocessing and normalization. Historical settings are in `hyperparameters.yaml`;
73
+ `model_config.json` summarizes architecture and input/output conventions.
74
+
75
+ ## Intended use and limitations
76
+
77
+ Historical YAML files contain old filesystem paths and legacy serialization tags; they are
78
+ provenance records, not portable project configs. Checkpoints retain their original PyTorch
79
+ serialization. Use DeepEthogram, rather than Transformers `AutoModel`, to load them.
80
+
81
+ This release contains initialization weights, not a complete trained behavior inference run:
82
+ newer inference helpers expect `config.yaml` and associated metrics from your fine-tuned run.
83
+ The complete historical plots, metrics, and additional stream snapshots remain in the
84
+ [legacy archive](https://huggingface.co/jbohnslav/deepethogram-pretrained).
85
+
86
+ ## Validation and provenance
87
+
88
+ The checkpoint and hyperparameters were copied without conversion from the author's NAS
89
+ pretrained directory for `niv_revision_deepethogram`. Their SHA-256 checksums match the
90
+ verified legacy archive; `SHA256SUMS` also covers this repo's license and model configuration.
91
+ Validated with PyTorch 2.4.1 and DeepEthogram source revision
92
+ `1541eec6958f90673b79c402e10b434c8cb7c868`: strict parameter loading and finite CPU
93
+ outputs on the synthetic input above. This is a compatibility check, not an accuracy benchmark.
94
+
95
+ ## License and citation
96
+
97
+ [LICENSE](LICENSE) reproduces the original DeepEthogram Harvard Academic and Non-Commercial
98
+ Research Use Software License and Terms of Use unchanged. It restricts commercial use and
99
+ end-user redistribution. This mirror grants no additional permissions and does not relicense
100
+ the assets; commercial inquiries should go to Harvard OTD as described in the license.
101
+
102
+ Bohnslav et al. (2021). *DeepEthogram, a machine learning pipeline for supervised behavior
103
+ classification from raw pixels*. eLife 10:e63377.
104
+ [doi:10.7554/eLife.63377](https://doi.org/10.7554/eLife.63377).
SHA256SUMS ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ 899e15e791552500b93f3ddcc239f570670edd9d9016c05b482ba04cb87415b0 LICENSE
2
+ c75e175724ae04a94fc622cfe8949e63656a60639556b65f8d640eb2944a511a checkpoint.pt
3
+ fc8f58e37e37dccc2f6bddb0ad8ce1b39b0d448d78048adedf8a60b32f6668eb hyperparameters.yaml
4
+ 2cd6a01c655785a101d2efcf54f90f456dd8e2127553e6e249a0e69d256526d2 model_config.json
checkpoint.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c75e175724ae04a94fc622cfe8949e63656a60639556b65f8d640eb2944a511a
3
+ size 183604611
hyperparameters.yaml ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ LR: 0.5
2
+ UD: 0.0
3
+ batch_size: 16
4
+ brightness: 0.25
5
+ classifier: resnet18
6
+ config_file: null
7
+ contrast: 0.1
8
+ crop_size: !!python/tuple
9
+ - 256
10
+ - 256
11
+ dali: true
12
+ data_dir: /media/jim/FASTER/kinetics700
13
+ dataset: kinetics
14
+ degrees: 10
15
+ distributed: false
16
+ early_stopping_begins: null
17
+ final_activation: softmax
18
+ flow_generator: MotionNet
19
+ flow_loss: MotionNet
20
+ flow_max: 5
21
+ fp16: false
22
+ gpu_id: 1
23
+ input_images: 11
24
+ inputs: rgb
25
+ lr: 0.0001
26
+ milestones:
27
+ - 50
28
+ - 100
29
+ - 150
30
+ - 200
31
+ - 250
32
+ - 300
33
+ min_lr: 5.0e-07
34
+ model: flow_generator
35
+ model_dir: models
36
+ name: kinetics
37
+ normalization:
38
+ flow:
39
+ N: 2097152000000
40
+ mean: null
41
+ std: null
42
+ rgb:
43
+ N: 209715200000
44
+ mean:
45
+ - 0.4345759153366089
46
+ - 0.39914101362228394
47
+ - 0.37257176637649536
48
+ std:
49
+ - 0.2809292674064636
50
+ - 0.27423909306526184
51
+ - 0.27391594648361206
52
+ notes: dali_only_3_resolutions
53
+ num_epochs: 1000
54
+ num_flows: null
55
+ num_rgb: 11
56
+ num_workers: 8
57
+ pad: null
58
+ patience: 10
59
+ preset: null
60
+ project_dir: null
61
+ random_resize: false
62
+ reduction_factor: !!python/object/apply:numpy.core.multiarray.scalar
63
+ - !!python/object/apply:numpy.dtype
64
+ args:
65
+ - f8
66
+ - 0
67
+ - 1
68
+ state: !!python/tuple
69
+ - 3
70
+ - <
71
+ - null
72
+ - null
73
+ - null
74
+ - -1
75
+ - -1
76
+ - 0
77
+ - !!binary |
78
+ D0lIYhM91D8=
79
+ reload_split: true
80
+ resize: null
81
+ scheduler: plateau
82
+ should_overwrite_args: false
83
+ should_viz: true
84
+ splitfile: null
85
+ steps_per_epoch: 1000
86
+ steps_per_test_epoch: 20
87
+ steps_per_validation_epoch: 1000
88
+ stopping_type: plateau
89
+ train_val_test_split:
90
+ - 0.8
91
+ - 0.2
92
+ - 0.0
93
+ weight_loss: true
94
+ weights: null
model_config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format_version": 1,
3
+ "library_name": "deepethogram",
4
+ "model_name": "MotionNet",
5
+ "architecture": "MotionNet",
6
+ "task": "optical-flow",
7
+ "source_run": "200310_174416_MotionNet_kinetics",
8
+ "checkpoint": "checkpoint.pt",
9
+ "flow_generator": "MotionNet",
10
+ "num_rgb_frames": 11,
11
+ "input_shape": [
12
+ "N",
13
+ 33,
14
+ "H",
15
+ "W"
16
+ ],
17
+ "num_classes": null,
18
+ "deepethogram_source_revision": "1541eec6958f90673b79c402e10b434c8cb7c868"
19
+ }