trace-tad 0.2.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.
Files changed (137) hide show
  1. trace_tad-0.2.0/LICENSE +176 -0
  2. trace_tad-0.2.0/MANIFEST.in +21 -0
  3. trace_tad-0.2.0/PKG-INFO +142 -0
  4. trace_tad-0.2.0/README.md +101 -0
  5. trace_tad-0.2.0/configs/__init__.py +0 -0
  6. trace_tad-0.2.0/configs/_dataset.py +98 -0
  7. trace_tad-0.2.0/configs/_model.py +52 -0
  8. trace_tad-0.2.0/configs/large.py +149 -0
  9. trace_tad-0.2.0/configs/small.py +146 -0
  10. trace_tad-0.2.0/pyproject.toml +64 -0
  11. trace_tad-0.2.0/setup.cfg +4 -0
  12. trace_tad-0.2.0/setup.py +3 -0
  13. trace_tad-0.2.0/tests/test_backend_app.py +378 -0
  14. trace_tad-0.2.0/tests/test_cli.py +236 -0
  15. trace_tad-0.2.0/tests/test_data_prep_pts.py +393 -0
  16. trace_tad-0.2.0/tests/test_eval_engine.py +24 -0
  17. trace_tad-0.2.0/tests/test_infer_discovery.py +119 -0
  18. trace_tad-0.2.0/tests/test_job_manager.py +323 -0
  19. trace_tad-0.2.0/tests/test_jobs_router.py +156 -0
  20. trace_tad-0.2.0/tests/test_pipeline_plan.py +181 -0
  21. trace_tad-0.2.0/tests/test_prep_dataset.py +460 -0
  22. trace_tad-0.2.0/tests/test_pts_phase2.py +407 -0
  23. trace_tad-0.2.0/tests/test_pts_phase3.py +268 -0
  24. trace_tad-0.2.0/tests/test_train_tune.py +116 -0
  25. trace_tad-0.2.0/tests/test_training_resources.py +75 -0
  26. trace_tad-0.2.0/tests/test_video_annotation.py +78 -0
  27. trace_tad-0.2.0/tools/__init__.py +0 -0
  28. trace_tad-0.2.0/tools/infer.py +603 -0
  29. trace_tad-0.2.0/tools/prep_dataset.py +83 -0
  30. trace_tad-0.2.0/tools/test.py +187 -0
  31. trace_tad-0.2.0/tools/train.py +250 -0
  32. trace_tad-0.2.0/tools/tune_train.py +42 -0
  33. trace_tad-0.2.0/trace_tad/__init__.py +17 -0
  34. trace_tad-0.2.0/trace_tad/cli.py +945 -0
  35. trace_tad-0.2.0/trace_tad/config.py +179 -0
  36. trace_tad-0.2.0/trace_tad/cores/__init__.py +6 -0
  37. trace_tad-0.2.0/trace_tad/cores/eval_engine.py +341 -0
  38. trace_tad-0.2.0/trace_tad/cores/layer_decay_optimizer.py +93 -0
  39. trace_tad-0.2.0/trace_tad/cores/optimizer.py +135 -0
  40. trace_tad-0.2.0/trace_tad/cores/scheduler.py +212 -0
  41. trace_tad-0.2.0/trace_tad/cores/train_engine.py +156 -0
  42. trace_tad-0.2.0/trace_tad/data_prep.py +1183 -0
  43. trace_tad-0.2.0/trace_tad/datasets/__init__.py +8 -0
  44. trace_tad-0.2.0/trace_tad/datasets/base/__init__.py +5 -0
  45. trace_tad-0.2.0/trace_tad/datasets/base/padding_dataset.py +168 -0
  46. trace_tad-0.2.0/trace_tad/datasets/base/sliding_dataset.py +212 -0
  47. trace_tad-0.2.0/trace_tad/datasets/base/util.py +40 -0
  48. trace_tad-0.2.0/trace_tad/datasets/builder.py +65 -0
  49. trace_tad-0.2.0/trace_tad/datasets/thumos.py +148 -0
  50. trace_tad-0.2.0/trace_tad/datasets/transforms/__init__.py +17 -0
  51. trace_tad-0.2.0/trace_tad/datasets/transforms/end_to_end.py +360 -0
  52. trace_tad-0.2.0/trace_tad/datasets/transforms/formatting.py +305 -0
  53. trace_tad-0.2.0/trace_tad/datasets/transforms/loading.py +263 -0
  54. trace_tad-0.2.0/trace_tad/datasets/transforms/video_transforms.py +502 -0
  55. trace_tad-0.2.0/trace_tad/evaluations/__init__.py +5 -0
  56. trace_tad-0.2.0/trace_tad/evaluations/builder.py +29 -0
  57. trace_tad-0.2.0/trace_tad/evaluations/mAP.py +477 -0
  58. trace_tad-0.2.0/trace_tad/evaluations/precision.py +524 -0
  59. trace_tad-0.2.0/trace_tad/export.py +50 -0
  60. trace_tad-0.2.0/trace_tad/jobs/__init__.py +24 -0
  61. trace_tad-0.2.0/trace_tad/jobs/manager.py +705 -0
  62. trace_tad-0.2.0/trace_tad/jobs/models.py +126 -0
  63. trace_tad-0.2.0/trace_tad/model_artifacts.py +84 -0
  64. trace_tad-0.2.0/trace_tad/models/__init__.py +24 -0
  65. trace_tad-0.2.0/trace_tad/models/backbones/__init__.py +4 -0
  66. trace_tad-0.2.0/trace_tad/models/backbones/backbone_wrapper.py +267 -0
  67. trace_tad-0.2.0/trace_tad/models/backbones/vit_adapter.py +463 -0
  68. trace_tad-0.2.0/trace_tad/models/bricks/__init__.py +7 -0
  69. trace_tad-0.2.0/trace_tad/models/bricks/conv.py +112 -0
  70. trace_tad-0.2.0/trace_tad/models/bricks/gradient_ops.py +37 -0
  71. trace_tad-0.2.0/trace_tad/models/bricks/misc.py +21 -0
  72. trace_tad-0.2.0/trace_tad/models/bricks/sgp.py +123 -0
  73. trace_tad-0.2.0/trace_tad/models/bricks/transformer.py +608 -0
  74. trace_tad-0.2.0/trace_tad/models/builder.py +70 -0
  75. trace_tad-0.2.0/trace_tad/models/dense_heads/__init__.py +6 -0
  76. trace_tad-0.2.0/trace_tad/models/dense_heads/anchor_free_head.py +309 -0
  77. trace_tad-0.2.0/trace_tad/models/dense_heads/prior_generator/__init__.py +2 -0
  78. trace_tad-0.2.0/trace_tad/models/dense_heads/prior_generator/point_generator.py +36 -0
  79. trace_tad-0.2.0/trace_tad/models/dense_heads/tridet_bm_head.py +377 -0
  80. trace_tad-0.2.0/trace_tad/models/dense_heads/tridet_head.py +393 -0
  81. trace_tad-0.2.0/trace_tad/models/detectors/__init__.py +6 -0
  82. trace_tad-0.2.0/trace_tad/models/detectors/base.py +83 -0
  83. trace_tad-0.2.0/trace_tad/models/detectors/single_stage.py +138 -0
  84. trace_tad-0.2.0/trace_tad/models/detectors/tridet.py +194 -0
  85. trace_tad-0.2.0/trace_tad/models/detectors/tridet_bm.py +20 -0
  86. trace_tad-0.2.0/trace_tad/models/losses/__init__.py +5 -0
  87. trace_tad-0.2.0/trace_tad/models/losses/boundary_loss.py +202 -0
  88. trace_tad-0.2.0/trace_tad/models/losses/focal_loss.py +166 -0
  89. trace_tad-0.2.0/trace_tad/models/losses/iou_loss.py +47 -0
  90. trace_tad-0.2.0/trace_tad/models/necks/__init__.py +4 -0
  91. trace_tad-0.2.0/trace_tad/models/necks/fpn.py +127 -0
  92. trace_tad-0.2.0/trace_tad/models/necks/temporal_deformable_fpn.py +181 -0
  93. trace_tad-0.2.0/trace_tad/models/projections/__init__.py +2 -0
  94. trace_tad-0.2.0/trace_tad/models/projections/actionformer_proj.py +186 -0
  95. trace_tad-0.2.0/trace_tad/models/projections/tridet_proj.py +140 -0
  96. trace_tad-0.2.0/trace_tad/models/utils/__init__.py +1 -0
  97. trace_tad-0.2.0/trace_tad/models/utils/bbox_tools.py +58 -0
  98. trace_tad-0.2.0/trace_tad/models/utils/iou_tools.py +150 -0
  99. trace_tad-0.2.0/trace_tad/models/utils/misc.py +25 -0
  100. trace_tad-0.2.0/trace_tad/models/utils/post_processing/__init__.py +9 -0
  101. trace_tad-0.2.0/trace_tad/models/utils/post_processing/classifier.py +187 -0
  102. trace_tad-0.2.0/trace_tad/models/utils/post_processing/nms/__init__.py +0 -0
  103. trace_tad-0.2.0/trace_tad/models/utils/post_processing/nms/nms.py +236 -0
  104. trace_tad-0.2.0/trace_tad/models/utils/post_processing/utils.py +160 -0
  105. trace_tad-0.2.0/trace_tad/pipeline.py +375 -0
  106. trace_tad-0.2.0/trace_tad/pipeline_plan.py +488 -0
  107. trace_tad-0.2.0/trace_tad/registry.py +27 -0
  108. trace_tad-0.2.0/trace_tad/server/__init__.py +1 -0
  109. trace_tad-0.2.0/trace_tad/server/app.py +1347 -0
  110. trace_tad-0.2.0/trace_tad/server/jobs_router.py +366 -0
  111. trace_tad-0.2.0/trace_tad/static/annotator/assets/classnames.f9d2a9c9.js +6 -0
  112. trace_tad-0.2.0/trace_tad/static/annotator/assets/index.480a38ed.css +1 -0
  113. trace_tad-0.2.0/trace_tad/static/annotator/assets/index.de688db8.js +1 -0
  114. trace_tad-0.2.0/trace_tad/static/annotator/assets/lodash.5a06a1a1.js +9 -0
  115. trace_tad-0.2.0/trace_tad/static/annotator/assets/moment.40bc58bf.js +8 -0
  116. trace_tad-0.2.0/trace_tad/static/annotator/assets/runtime-dom.4eada9c7.js +21 -0
  117. trace_tad-0.2.0/trace_tad/static/annotator/assets/runtime.a4816b2b.js +1 -0
  118. trace_tad-0.2.0/trace_tad/static/annotator/assets/ui.7b72c5dc.js +8 -0
  119. trace_tad-0.2.0/trace_tad/static/annotator/index.html +32 -0
  120. trace_tad-0.2.0/trace_tad/static/annotator/trace-logo.svg +16 -0
  121. trace_tad-0.2.0/trace_tad/training_resources.py +507 -0
  122. trace_tad-0.2.0/trace_tad/utils/__init__.py +21 -0
  123. trace_tad-0.2.0/trace_tad/utils/auto_tune.py +248 -0
  124. trace_tad-0.2.0/trace_tad/utils/checkpoint.py +37 -0
  125. trace_tad-0.2.0/trace_tad/utils/ema.py +27 -0
  126. trace_tad-0.2.0/trace_tad/utils/logger.py +24 -0
  127. trace_tad-0.2.0/trace_tad/utils/misc.py +67 -0
  128. trace_tad-0.2.0/trace_tad/utils/train_tune.py +226 -0
  129. trace_tad-0.2.0/trace_tad/version.py +1 -0
  130. trace_tad-0.2.0/trace_tad/video_annotation.py +622 -0
  131. trace_tad-0.2.0/trace_tad/weights.py +143 -0
  132. trace_tad-0.2.0/trace_tad.egg-info/PKG-INFO +142 -0
  133. trace_tad-0.2.0/trace_tad.egg-info/SOURCES.txt +135 -0
  134. trace_tad-0.2.0/trace_tad.egg-info/dependency_links.txt +1 -0
  135. trace_tad-0.2.0/trace_tad.egg-info/entry_points.txt +2 -0
  136. trace_tad-0.2.0/trace_tad.egg-info/requires.txt +16 -0
  137. trace_tad-0.2.0/trace_tad.egg-info/top_level.txt +3 -0
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,21 @@
1
+ # Config files (Python-based configs, included as package data)
2
+ recursive-include configs *.py
3
+
4
+ # Entry-point scripts
5
+ recursive-include tools *.py
6
+
7
+ # Bundled frontend assets (built by `trace build-frontend`)
8
+ recursive-include trace_tad/static *
9
+
10
+ # Documentation
11
+ include README.md
12
+ include LICENSE
13
+
14
+ # Exclude dev/test files
15
+ exclude .gitignore
16
+ prune trace-annotator
17
+ prune exps
18
+ prune data
19
+ prune pretrained
20
+ prune figures
21
+ prune literature_review
@@ -0,0 +1,142 @@
1
+ Metadata-Version: 2.4
2
+ Name: trace-tad
3
+ Version: 0.2.0
4
+ Summary: TRACE: Temporal action detection for animal behavior analysis
5
+ License: Apache-2.0
6
+ Project-URL: Homepage, https://github.com/KunmingS/TRACE
7
+ Project-URL: Documentation, https://kunmings.github.io/TRACE/
8
+ Project-URL: Repository, https://github.com/KunmingS/TRACE
9
+ Project-URL: Issues, https://github.com/KunmingS/TRACE/issues
10
+ Keywords: temporal-action-detection,animal-behavior,video-analysis,deep-learning,pytorch
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Classifier: Topic :: Scientific/Engineering :: Image Recognition
22
+ Requires-Python: >=3.9
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: torch>=2.0.1
26
+ Requires-Dist: torchvision>=0.15.2
27
+ Requires-Dist: decord>=0.6.0
28
+ Requires-Dist: einops>=0.6.0
29
+ Requires-Dist: scipy>=1.9.0
30
+ Requires-Dist: pandas>=1.5.0
31
+ Requires-Dist: tqdm>=4.64.0
32
+ Requires-Dist: numpy>=1.23.5
33
+ Requires-Dist: opencv-python-headless>=4.6.0
34
+ Requires-Dist: fastapi
35
+ Requires-Dist: uvicorn
36
+ Requires-Dist: python-multipart
37
+ Provides-Extra: dev
38
+ Requires-Dist: pytest; extra == "dev"
39
+ Requires-Dist: flake8; extra == "dev"
40
+ Dynamic: license-file
41
+
42
+ # TRACE — Temporal Recognition of Animal Behaviors Captured from Video
43
+
44
+ TRACE is a temporal action detection system for animal behavior analysis in untrimmed video.
45
+
46
+ ![TRACE Annotator](site/assets/screenshot.png)
47
+
48
+ ## Documentation
49
+
50
+ Project docs are set up for GitHub Pages at
51
+ [kunmings.github.io/TRACE](https://kunmings.github.io/TRACE/). The public site
52
+ source lives in [site/](site/), separate from local engineering notes in
53
+ [docs/](docs/).
54
+
55
+ ## Install
56
+
57
+ ```bash
58
+ python -m pip install trace-tad
59
+ ```
60
+
61
+ For a local checkout:
62
+
63
+ ```bash
64
+ pip install -e .
65
+ ```
66
+
67
+ Training, evaluation, and prediction require a CUDA-capable PyTorch
68
+ environment. The annotation app can still be used for labeling workflows without
69
+ running model jobs locally.
70
+
71
+ ## Usage
72
+
73
+ ```bash
74
+ # Prepare local model weights used by the packaged configs
75
+ trace prepare --weights all
76
+
77
+ # Check whether PyPI has a newer TRACE release
78
+ trace update
79
+
80
+ # Start the bundled annotation app
81
+ trace app
82
+
83
+ # Train from selected video/annotation pairs
84
+ trace train --model large --work-dir /my/dataset --pairs video01.mp4=video01_final.csv video02.mp4=video02.csv
85
+
86
+ # Evaluate the training artifact, or evaluate on held-out video/annotation pairs
87
+ trace eval --model-dir /my/dataset/model_YYYYMMDD_HHMMSS
88
+ trace eval --model-dir /my/dataset/model_YYYYMMDD_HHMMSS --work-dir /my/testset --pairs video03.mp4=video03.csv
89
+
90
+ # Predict on new videos and write annotation drafts
91
+ trace predict --model-dir /my/dataset/model_YYYYMMDD_HHMMSS --input /path/to/video.mp4 --annotated-video --threshold 0.25
92
+
93
+ # Run a configured end-to-end workflow
94
+ trace pipeline configs/small.py --export csv
95
+ ```
96
+
97
+ You can stay in the UI for annotation and still keep training or inference
98
+ reproducible from the command line. The app lets you choose video/annotation
99
+ pairs, configure model runs, and generate the matching CLI command, so a lab
100
+ operator can annotate in the browser while a server or batch job runs the
101
+ generated `trace train`, `trace eval`, `trace predict`, or `trace pipeline`
102
+ command.
103
+
104
+ `--pairs` is explicit: each item is `VIDEO_PATH=CSV_PATH`. A source video can
105
+ have multiple annotation CSVs beside it, such as `video01_draft.csv`,
106
+ `video01_final.csv`, or a model-generated `video01_predictions.csv`; each
107
+ training or evaluation pair chooses the annotation file to use for that video.
108
+ Relative paths are resolved against `--work-dir`, so
109
+ `video01.mp4=video01_final.csv` means both files are inside the work directory.
110
+ Training creates a self-contained `model_YYYYMMDD_HHMMSS/` folder under
111
+ `--work-dir`.
112
+
113
+ TRACE annotation CSVs are time-based:
114
+
115
+ ```csv
116
+ labelId,timestamp,endTimestamp
117
+ grooming,12.430,18.970
118
+ rearing,42.100,45.650
119
+ ```
120
+
121
+ Prediction creates a `predict_YYYYMMDD_HHMMSS/` folder beside the selected input
122
+ video or input video directory, unless `--output` is provided. The CSV output
123
+ uses the annotation format, so a reviewer can treat model predictions as draft
124
+ annotation files. Use `--annotated-video` to render MP4 overlays with the same
125
+ confidence threshold as the JSON/CSV outputs.
126
+
127
+ ## Development
128
+
129
+ ```bash
130
+ # Start backend and Vite dev servers
131
+ trace dev serve
132
+
133
+ # Build the frontend and bundle it into the Python package
134
+ trace dev build-frontend
135
+ ```
136
+
137
+ The committed public website in [site/](site/) is intentionally small and
138
+ publishable; deeper engineering notes stay under [docs/](docs/).
139
+
140
+ ## License
141
+
142
+ Apache 2.0. See [LICENSE](LICENSE).
@@ -0,0 +1,101 @@
1
+ # TRACE — Temporal Recognition of Animal Behaviors Captured from Video
2
+
3
+ TRACE is a temporal action detection system for animal behavior analysis in untrimmed video.
4
+
5
+ ![TRACE Annotator](site/assets/screenshot.png)
6
+
7
+ ## Documentation
8
+
9
+ Project docs are set up for GitHub Pages at
10
+ [kunmings.github.io/TRACE](https://kunmings.github.io/TRACE/). The public site
11
+ source lives in [site/](site/), separate from local engineering notes in
12
+ [docs/](docs/).
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ python -m pip install trace-tad
18
+ ```
19
+
20
+ For a local checkout:
21
+
22
+ ```bash
23
+ pip install -e .
24
+ ```
25
+
26
+ Training, evaluation, and prediction require a CUDA-capable PyTorch
27
+ environment. The annotation app can still be used for labeling workflows without
28
+ running model jobs locally.
29
+
30
+ ## Usage
31
+
32
+ ```bash
33
+ # Prepare local model weights used by the packaged configs
34
+ trace prepare --weights all
35
+
36
+ # Check whether PyPI has a newer TRACE release
37
+ trace update
38
+
39
+ # Start the bundled annotation app
40
+ trace app
41
+
42
+ # Train from selected video/annotation pairs
43
+ trace train --model large --work-dir /my/dataset --pairs video01.mp4=video01_final.csv video02.mp4=video02.csv
44
+
45
+ # Evaluate the training artifact, or evaluate on held-out video/annotation pairs
46
+ trace eval --model-dir /my/dataset/model_YYYYMMDD_HHMMSS
47
+ trace eval --model-dir /my/dataset/model_YYYYMMDD_HHMMSS --work-dir /my/testset --pairs video03.mp4=video03.csv
48
+
49
+ # Predict on new videos and write annotation drafts
50
+ trace predict --model-dir /my/dataset/model_YYYYMMDD_HHMMSS --input /path/to/video.mp4 --annotated-video --threshold 0.25
51
+
52
+ # Run a configured end-to-end workflow
53
+ trace pipeline configs/small.py --export csv
54
+ ```
55
+
56
+ You can stay in the UI for annotation and still keep training or inference
57
+ reproducible from the command line. The app lets you choose video/annotation
58
+ pairs, configure model runs, and generate the matching CLI command, so a lab
59
+ operator can annotate in the browser while a server or batch job runs the
60
+ generated `trace train`, `trace eval`, `trace predict`, or `trace pipeline`
61
+ command.
62
+
63
+ `--pairs` is explicit: each item is `VIDEO_PATH=CSV_PATH`. A source video can
64
+ have multiple annotation CSVs beside it, such as `video01_draft.csv`,
65
+ `video01_final.csv`, or a model-generated `video01_predictions.csv`; each
66
+ training or evaluation pair chooses the annotation file to use for that video.
67
+ Relative paths are resolved against `--work-dir`, so
68
+ `video01.mp4=video01_final.csv` means both files are inside the work directory.
69
+ Training creates a self-contained `model_YYYYMMDD_HHMMSS/` folder under
70
+ `--work-dir`.
71
+
72
+ TRACE annotation CSVs are time-based:
73
+
74
+ ```csv
75
+ labelId,timestamp,endTimestamp
76
+ grooming,12.430,18.970
77
+ rearing,42.100,45.650
78
+ ```
79
+
80
+ Prediction creates a `predict_YYYYMMDD_HHMMSS/` folder beside the selected input
81
+ video or input video directory, unless `--output` is provided. The CSV output
82
+ uses the annotation format, so a reviewer can treat model predictions as draft
83
+ annotation files. Use `--annotated-video` to render MP4 overlays with the same
84
+ confidence threshold as the JSON/CSV outputs.
85
+
86
+ ## Development
87
+
88
+ ```bash
89
+ # Start backend and Vite dev servers
90
+ trace dev serve
91
+
92
+ # Build the frontend and bundle it into the Python package
93
+ trace dev build-frontend
94
+ ```
95
+
96
+ The committed public website in [site/](site/) is intentionally small and
97
+ publishable; deeper engineering notes stay under [docs/](docs/).
98
+
99
+ ## License
100
+
101
+ Apache 2.0. See [LICENSE](LICENSE).
File without changes
@@ -0,0 +1,98 @@
1
+ annotation_path = "dataset.json"
2
+ class_map = "classmap.txt"
3
+ data_path = "."
4
+ block_list = None
5
+
6
+ window_size = 256
7
+
8
+ dataset = dict(
9
+ train=dict(
10
+ type="ThumosPaddingDataset",
11
+ ann_file=annotation_path,
12
+ subset_name="training",
13
+ block_list=block_list,
14
+ class_map=class_map,
15
+ data_path=data_path,
16
+ filter_gt=False,
17
+ feature_stride=1,
18
+ sample_stride=1,
19
+ pipeline=[
20
+ dict(type="PrepareVideoInfo", format="mp4"),
21
+ dict(type="VideoInit", num_threads=4),
22
+ dict(
23
+ type="LoadFrames",
24
+ num_clips=1,
25
+ method="random_trunc",
26
+ trunc_len=window_size,
27
+ trunc_thresh=0.5,
28
+ crop_ratio=[0.9, 1.0],
29
+ ),
30
+ dict(type="VideoDecode"),
31
+ dict(type="VideoResize", scale=(-1, 256)),
32
+ dict(type="VideoRandomResizedCrop"),
33
+ dict(type="VideoResize", scale=(224, 224)),
34
+ dict(type="VideoFlip", flip_ratio=0.5),
35
+ dict(type="VideoFormatShape", input_format="NCTHW"),
36
+ dict(type="ConvertToTensor", keys=["imgs", "gt_segments", "gt_labels"]),
37
+ dict(type="Collect", inputs="imgs", keys=["masks", "gt_segments", "gt_labels"]),
38
+ ],
39
+ ),
40
+ val=dict(
41
+ type="ThumosSlidingDataset",
42
+ ann_file=annotation_path,
43
+ subset_name="validation",
44
+ block_list=block_list,
45
+ class_map=class_map,
46
+ data_path=data_path,
47
+ filter_gt=False,
48
+ feature_stride=1,
49
+ sample_stride=1,
50
+ window_size=window_size,
51
+ window_overlap_ratio=0.25,
52
+ pipeline=[
53
+ dict(type="PrepareVideoInfo", format="mp4"),
54
+ dict(type="VideoInit", num_threads=4),
55
+ dict(type="LoadFrames", num_clips=1, method="sliding_window"),
56
+ dict(type="VideoDecode"),
57
+ dict(type="VideoResize", scale=(-1, 224)),
58
+ dict(type="VideoCenterCrop", crop_size=224),
59
+ dict(type="VideoFormatShape", input_format="NCTHW"),
60
+ dict(type="ConvertToTensor", keys=["imgs", "gt_segments", "gt_labels"]),
61
+ dict(type="Collect", inputs="imgs", keys=["masks", "gt_segments", "gt_labels"]),
62
+ ],
63
+ ),
64
+ test=dict(
65
+ type="ThumosSlidingDataset",
66
+ ann_file=annotation_path,
67
+ subset_name="validation",
68
+ block_list=block_list,
69
+ class_map=class_map,
70
+ data_path=data_path,
71
+ filter_gt=False,
72
+ test_mode=True,
73
+ feature_stride=1,
74
+ sample_stride=1,
75
+ window_size=window_size,
76
+ window_overlap_ratio=0.5,
77
+ pipeline=[
78
+ dict(type="PrepareVideoInfo", format="mp4"),
79
+ dict(type="VideoInit", num_threads=4),
80
+ dict(type="LoadFrames", num_clips=1, method="sliding_window"),
81
+ dict(type="VideoDecode"),
82
+ dict(type="VideoResize", scale=(-1, 224)),
83
+ dict(type="VideoCenterCrop", crop_size=224),
84
+ dict(type="VideoFormatShape", input_format="NCTHW"),
85
+ dict(type="ConvertToTensor", keys=["imgs"]),
86
+ dict(type="Collect", inputs="imgs", keys=["masks"]),
87
+ ],
88
+ ),
89
+ )
90
+
91
+ evaluation = dict(
92
+ type="Precision",
93
+ subset="validation",
94
+ tiou_thresholds=[0.3, 0.4, 0.5, 0.6, 0.7],
95
+ ground_truth_filename=annotation_path,
96
+ gt_fps=30.0,
97
+ eval_fps=30.0,
98
+ )
@@ -0,0 +1,52 @@
1
+ model = dict(
2
+ type="TriDet",
3
+ projection=dict(
4
+ type="TriDetProj",
5
+ in_channels=2048,
6
+ out_channels=512,
7
+ sgp_mlp_dim=768,
8
+ arch=(2, 2, 5), # layers in embed / stem / branch
9
+ downsample_type="max",
10
+ sgp_win_size=[1, 1, 1, 1, 1, 1],
11
+ k=5,
12
+ init_conv_vars=0,
13
+ conv_cfg=dict(kernel_size=3),
14
+ norm_cfg=dict(type="LN"),
15
+ path_pdrop=0.1,
16
+ use_abs_pe=True,
17
+ max_seq_len=768,
18
+ input_noise=0.0,
19
+ ),
20
+ neck=dict(
21
+ type="FPNIdentity",
22
+ in_channels=512,
23
+ out_channels=512,
24
+ num_levels=6,
25
+ ),
26
+ rpn_head=dict(
27
+ type="TriDetHead",
28
+ num_classes=3,
29
+ in_channels=512,
30
+ feat_channels=512,
31
+ num_convs=2,
32
+ cls_prior_prob=0.01,
33
+ prior_generator=dict(
34
+ type="PointGenerator",
35
+ strides=[1, 2, 4, 8, 16, 32],
36
+ regression_range=[(0, 4), (4, 8), (8, 16), (16, 32), (32, 64), (64, 10000)],
37
+ ),
38
+ loss_normalizer=100,
39
+ loss_normalizer_momentum=0.9,
40
+ center_sample="radius",
41
+ center_sample_radius=1.5,
42
+ label_smoothing=0.0,
43
+ boundary_kernel_size=3,
44
+ iou_weight_power=0.2,
45
+ num_bins=16,
46
+ loss=dict(
47
+ cls_loss=dict(type="ClassBalancedFocalLoss", beta=0.999),
48
+ reg_loss=dict(type="DIOULoss"),
49
+ iou_rate=dict(type="GIOULoss"),
50
+ ),
51
+ ),
52
+ )