vtrace-behavior 1.0.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 (175) hide show
  1. vtrace_behavior-1.0.0/LICENSE +176 -0
  2. vtrace_behavior-1.0.0/MANIFEST.in +24 -0
  3. vtrace_behavior-1.0.0/PKG-INFO +218 -0
  4. vtrace_behavior-1.0.0/README.md +177 -0
  5. vtrace_behavior-1.0.0/configs/__init__.py +0 -0
  6. vtrace_behavior-1.0.0/configs/_dataset.py +93 -0
  7. vtrace_behavior-1.0.0/configs/_model.py +29 -0
  8. vtrace_behavior-1.0.0/configs/calms21_demo.py +169 -0
  9. vtrace_behavior-1.0.0/configs/calms21_distill_vmaeB.py +189 -0
  10. vtrace_behavior-1.0.0/configs/calms21_vjepa2.py +108 -0
  11. vtrace_behavior-1.0.0/configs/maev2.py +179 -0
  12. vtrace_behavior-1.0.0/configs/vjepa2.py +164 -0
  13. vtrace_behavior-1.0.0/pyproject.toml +65 -0
  14. vtrace_behavior-1.0.0/setup.cfg +4 -0
  15. vtrace_behavior-1.0.0/setup.py +3 -0
  16. vtrace_behavior-1.0.0/tools/__init__.py +0 -0
  17. vtrace_behavior-1.0.0/tools/bake_distill_adapters.py +83 -0
  18. vtrace_behavior-1.0.0/tools/distill_jepa_to_vmae.py +450 -0
  19. vtrace_behavior-1.0.0/tools/infer.py +625 -0
  20. vtrace_behavior-1.0.0/tools/prep_dataset.py +82 -0
  21. vtrace_behavior-1.0.0/tools/select_backbone.py +171 -0
  22. vtrace_behavior-1.0.0/tools/select_head.py +232 -0
  23. vtrace_behavior-1.0.0/tools/test.py +168 -0
  24. vtrace_behavior-1.0.0/tools/train.py +285 -0
  25. vtrace_behavior-1.0.0/tools/tune_train.py +42 -0
  26. vtrace_behavior-1.0.0/vtrace/__init__.py +17 -0
  27. vtrace_behavior-1.0.0/vtrace/cli.py +1021 -0
  28. vtrace_behavior-1.0.0/vtrace/config.py +233 -0
  29. vtrace_behavior-1.0.0/vtrace/cores/__init__.py +6 -0
  30. vtrace_behavior-1.0.0/vtrace/cores/eval_engine.py +456 -0
  31. vtrace_behavior-1.0.0/vtrace/cores/layer_decay_optimizer.py +93 -0
  32. vtrace_behavior-1.0.0/vtrace/cores/optimizer.py +145 -0
  33. vtrace_behavior-1.0.0/vtrace/cores/scheduler.py +212 -0
  34. vtrace_behavior-1.0.0/vtrace/cores/train_engine.py +161 -0
  35. vtrace_behavior-1.0.0/vtrace/data_prep.py +1059 -0
  36. vtrace_behavior-1.0.0/vtrace/datasets/__init__.py +10 -0
  37. vtrace_behavior-1.0.0/vtrace/datasets/builder.py +65 -0
  38. vtrace_behavior-1.0.0/vtrace/datasets/sliding.py +1009 -0
  39. vtrace_behavior-1.0.0/vtrace/datasets/transforms.py +1519 -0
  40. vtrace_behavior-1.0.0/vtrace/demo.py +493 -0
  41. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/classmap.txt +3 -0
  42. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse071_task1_annotator1.csv +106 -0
  43. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse072_task1_annotator1.csv +61 -0
  44. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse073_task1_annotator1.csv +77 -0
  45. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse074_task1_annotator1.csv +141 -0
  46. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse075_task1_annotator1.csv +66 -0
  47. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse076_task1_annotator1.csv +187 -0
  48. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse077_task1_annotator1.csv +115 -0
  49. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse078_task1_annotator1.csv +277 -0
  50. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse079_task1_annotator1.csv +79 -0
  51. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse080_task1_annotator1.csv +52 -0
  52. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse081_task1_annotator1.csv +12 -0
  53. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse082_task1_annotator1.csv +42 -0
  54. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse083_task1_annotator1.csv +33 -0
  55. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse084_task1_annotator1.csv +31 -0
  56. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse085_task1_annotator1.csv +75 -0
  57. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse086_task1_annotator1.csv +33 -0
  58. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse087_task1_annotator1.csv +44 -0
  59. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse088_task1_annotator1.csv +46 -0
  60. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/test/mouse089_task1_annotator1.csv +63 -0
  61. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse001_task1_annotator1.csv +87 -0
  62. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse002_task1_annotator1.csv +170 -0
  63. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse003_task1_annotator1.csv +51 -0
  64. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse004_task1_annotator1.csv +33 -0
  65. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse005_task1_annotator1.csv +23 -0
  66. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse006_task1_annotator1.csv +24 -0
  67. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse007_task1_annotator1.csv +45 -0
  68. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse008_task1_annotator1.csv +62 -0
  69. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse009_task1_annotator1.csv +24 -0
  70. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse010_task1_annotator1.csv +32 -0
  71. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse011_task1_annotator1.csv +22 -0
  72. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse012_task1_annotator1.csv +32 -0
  73. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse013_task1_annotator1.csv +6 -0
  74. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse014_task1_annotator1.csv +33 -0
  75. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse015_task1_annotator1.csv +24 -0
  76. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse016_task1_annotator1.csv +11 -0
  77. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse017_task1_annotator1.csv +12 -0
  78. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse018_task1_annotator1.csv +32 -0
  79. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse019_task1_annotator1.csv +9 -0
  80. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse020_task1_annotator1.csv +6 -0
  81. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse021_task1_annotator1.csv +23 -0
  82. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse022_task1_annotator1.csv +16 -0
  83. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse023_task1_annotator1.csv +5 -0
  84. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse024_task1_annotator1.csv +15 -0
  85. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse025_task1_annotator1.csv +33 -0
  86. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse026_task1_annotator1.csv +29 -0
  87. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse027_task1_annotator1.csv +12 -0
  88. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse028_task1_annotator1.csv +16 -0
  89. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse029_task1_annotator1.csv +14 -0
  90. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse030_task1_annotator1.csv +15 -0
  91. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse031_task1_annotator1.csv +23 -0
  92. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse032_task1_annotator1.csv +30 -0
  93. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse033_task1_annotator1.csv +13 -0
  94. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse034_task1_annotator1.csv +10 -0
  95. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse035_task1_annotator1.csv +18 -0
  96. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse036_task1_annotator1.csv +2 -0
  97. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse037_task1_annotator1.csv +8 -0
  98. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse038_task1_annotator1.csv +19 -0
  99. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse039_task1_annotator1.csv +24 -0
  100. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse040_task1_annotator1.csv +15 -0
  101. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse041_task1_annotator1.csv +8 -0
  102. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse042_task1_annotator1.csv +11 -0
  103. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse043_task1_annotator1.csv +9 -0
  104. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse044_task1_annotator1.csv +25 -0
  105. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse045_task1_annotator1.csv +44 -0
  106. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse046_task1_annotator1.csv +29 -0
  107. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse047_task1_annotator1.csv +21 -0
  108. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse048_task1_annotator1.csv +11 -0
  109. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse049_task1_annotator1.csv +10 -0
  110. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse050_task1_annotator1.csv +11 -0
  111. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse051_task1_annotator1.csv +72 -0
  112. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse052_task1_annotator1.csv +68 -0
  113. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse053_task1_annotator1.csv +91 -0
  114. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse054_task1_annotator1.csv +59 -0
  115. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse055_task1_annotator1.csv +87 -0
  116. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse056_task1_annotator1.csv +46 -0
  117. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse057_task1_annotator1.csv +66 -0
  118. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse058_task1_annotator1.csv +79 -0
  119. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse059_task1_annotator1.csv +30 -0
  120. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse060_task1_annotator1.csv +22 -0
  121. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse061_task1_annotator1.csv +25 -0
  122. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse062_task1_annotator1.csv +48 -0
  123. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse063_task1_annotator1.csv +53 -0
  124. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse064_task1_annotator1.csv +41 -0
  125. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse065_task1_annotator1.csv +27 -0
  126. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse066_task1_annotator1.csv +31 -0
  127. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse067_task1_annotator1.csv +34 -0
  128. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse068_task1_annotator1.csv +33 -0
  129. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse069_task1_annotator1.csv +64 -0
  130. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/train/mouse070_task1_annotator1.csv +124 -0
  131. vtrace_behavior-1.0.0/vtrace/demo_data/calms21/videos.json +540 -0
  132. vtrace_behavior-1.0.0/vtrace/evaluations/__init__.py +5 -0
  133. vtrace_behavior-1.0.0/vtrace/evaluations/builder.py +29 -0
  134. vtrace_behavior-1.0.0/vtrace/evaluations/mAP.py +477 -0
  135. vtrace_behavior-1.0.0/vtrace/evaluations/precision.py +801 -0
  136. vtrace_behavior-1.0.0/vtrace/model_artifacts.py +87 -0
  137. vtrace_behavior-1.0.0/vtrace/models/__init__.py +22 -0
  138. vtrace_behavior-1.0.0/vtrace/models/backbones.py +1242 -0
  139. vtrace_behavior-1.0.0/vtrace/models/bricks.py +911 -0
  140. vtrace_behavior-1.0.0/vtrace/models/builder.py +42 -0
  141. vtrace_behavior-1.0.0/vtrace/models/detectors.py +1225 -0
  142. vtrace_behavior-1.0.0/vtrace/models/heads.py +450 -0
  143. vtrace_behavior-1.0.0/vtrace/models/necks.py +397 -0
  144. vtrace_behavior-1.0.0/vtrace/models/postprocess.py +534 -0
  145. vtrace_behavior-1.0.0/vtrace/models/projections.py +173 -0
  146. vtrace_behavior-1.0.0/vtrace/pipeline_plan.py +281 -0
  147. vtrace_behavior-1.0.0/vtrace/proxy_geometry.py +243 -0
  148. vtrace_behavior-1.0.0/vtrace/registry.py +27 -0
  149. vtrace_behavior-1.0.0/vtrace/remote_zip.py +96 -0
  150. vtrace_behavior-1.0.0/vtrace/selection/__init__.py +34 -0
  151. vtrace_behavior-1.0.0/vtrace/selection/extract.py +174 -0
  152. vtrace_behavior-1.0.0/vtrace/selection/head_proxy.py +272 -0
  153. vtrace_behavior-1.0.0/vtrace/selection/lc_extrap.py +310 -0
  154. vtrace_behavior-1.0.0/vtrace/selection/lead.py +267 -0
  155. vtrace_behavior-1.0.0/vtrace/selection/rankme.py +116 -0
  156. vtrace_behavior-1.0.0/vtrace/selection/transferability.py +363 -0
  157. vtrace_behavior-1.0.0/vtrace/shell.py +236 -0
  158. vtrace_behavior-1.0.0/vtrace/splash.py +216 -0
  159. vtrace_behavior-1.0.0/vtrace/static/gui/index.html +3203 -0
  160. vtrace_behavior-1.0.0/vtrace/steps.py +404 -0
  161. vtrace_behavior-1.0.0/vtrace/utils/__init__.py +21 -0
  162. vtrace_behavior-1.0.0/vtrace/utils/auto_tune.py +248 -0
  163. vtrace_behavior-1.0.0/vtrace/utils/checkpoint.py +37 -0
  164. vtrace_behavior-1.0.0/vtrace/utils/ema.py +27 -0
  165. vtrace_behavior-1.0.0/vtrace/utils/logger.py +24 -0
  166. vtrace_behavior-1.0.0/vtrace/utils/misc.py +67 -0
  167. vtrace_behavior-1.0.0/vtrace/utils/train_tune.py +233 -0
  168. vtrace_behavior-1.0.0/vtrace/version.py +1 -0
  169. vtrace_behavior-1.0.0/vtrace/weights.py +210 -0
  170. vtrace_behavior-1.0.0/vtrace_behavior.egg-info/PKG-INFO +218 -0
  171. vtrace_behavior-1.0.0/vtrace_behavior.egg-info/SOURCES.txt +173 -0
  172. vtrace_behavior-1.0.0/vtrace_behavior.egg-info/dependency_links.txt +1 -0
  173. vtrace_behavior-1.0.0/vtrace_behavior.egg-info/entry_points.txt +2 -0
  174. vtrace_behavior-1.0.0/vtrace_behavior.egg-info/requires.txt +16 -0
  175. vtrace_behavior-1.0.0/vtrace_behavior.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,24 @@
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
+ # The V-TRACE GUI (a single static page, shipped as-is)
8
+ recursive-include vtrace/static *
9
+
10
+ # CalMS21 demo annotations (~50 KB). The videos are NOT here: they are
11
+ # fetched from the dataset's own record at CaltechDATA.
12
+ recursive-include vtrace/demo_data *.csv *.txt *.json
13
+
14
+ # Documentation
15
+ include README.md
16
+ include LICENSE
17
+
18
+ # Exclude dev/test files
19
+ exclude .gitignore
20
+ prune exps
21
+ prune data
22
+ prune pretrained
23
+ prune figures
24
+ prune literature_review
@@ -0,0 +1,218 @@
1
+ Metadata-Version: 2.4
2
+ Name: vtrace-behavior
3
+ Version: 1.0.0
4
+ Summary: V-TRACE: continuous ethograms of animal behavior from untrimmed video
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: ethogram,animal-behavior,behavior-annotation,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: static-ffmpeg>=2.5
35
+ Requires-Dist: rich>=13.0
36
+ Requires-Dist: prompt_toolkit>=3.0
37
+ Provides-Extra: dev
38
+ Requires-Dist: pytest; extra == "dev"
39
+ Requires-Dist: flake8; extra == "dev"
40
+ Dynamic: license-file
41
+
42
+ # V-TRACE — Video-based Temporal Recognition and Annotation of Continuous Ethograms of Animal Behavior
43
+
44
+ V-TRACE turns untrimmed animal-behavior video into continuous ethograms: label a few
45
+ recordings in the browser, train a detector on them, and have it annotate the rest.
46
+
47
+ ## Documentation
48
+
49
+ [kunmings.github.io/TRACE](https://kunmings.github.io/TRACE/)
50
+
51
+ ## Install
52
+
53
+ Create a Python 3.9+ environment first. Choose one:
54
+
55
+ ```bash
56
+ conda create -n vtrace python=3.11 pip
57
+ conda activate vtrace
58
+ ```
59
+
60
+ ```bash
61
+ mamba create -n vtrace python=3.11 pip
62
+ mamba activate vtrace
63
+ ```
64
+
65
+ ```bash
66
+ uv venv --python 3.11 --seed .venv
67
+ source .venv/bin/activate
68
+ ```
69
+
70
+ Then install V-TRACE and download the model weights:
71
+
72
+ ```bash
73
+ python -m pip install vtrace-behavior
74
+ vtrace prepare --weights all
75
+ ```
76
+
77
+ Training, evaluation and prediction need a CUDA-capable PyTorch environment.
78
+ Annotation does not — the browser app works anywhere.
79
+
80
+ ## Usage
81
+
82
+ Run it with no arguments:
83
+
84
+ ```bash
85
+ vtrace
86
+ ```
87
+
88
+ That opens an interactive session. The annotator starts with it, so the screen
89
+ gives you its address — open `http://localhost:8765` in Chrome or Edge — and you
90
+ type the rest of the commands at the `vtrace >` prompt, without repeating the
91
+ program's name (`demo predict`, not `vtrace demo predict`). Tab completes,
92
+ ctrl-r searches history, `exit` leaves.
93
+
94
+ The annotator is a single static page. It reads videos and writes annotations
95
+ **on the computer running the browser**, through the File System Access API:
96
+ nothing is uploaded and there is no server-side state. Use it to open
97
+ recordings, define behaviors, mark events on the timeline, and review model
98
+ predictions; training, evaluation and prediction run from the command line.
99
+
100
+ `vtrace app` serves the annotator on its own, without the session — for scripts,
101
+ or when that is all you want.
102
+
103
+ Every command below also works directly from a shell, prefixed with `vtrace`.
104
+
105
+ ## Try the demo
106
+
107
+ A walkthrough on CalMS21 mouse social behavior, using the *complete* Task-1
108
+ benchmark in its official split — 70 training videos (4.7 h, 2287 labelled
109
+ bouts) and 19 test videos (2.4 h, 1521 bouts):
110
+
111
+ ```bash
112
+ vtrace demo predict # predict on a held-out video, write its predictions
113
+ vtrace demo download # fetch the videos (train ~19 GB, test ~11 GB)
114
+ vtrace demo train # prep + train on the 70 official training videos
115
+ ```
116
+
117
+ V-TRACE does not re-host CalMS21. The annotation CSVs ship with the package; the
118
+ videos come straight from the
119
+ [official CalMS21 release](https://data.caltech.edu/records/s0vdx-0k302)
120
+ (doi:10.22002/D1.1991), one member at a time over HTTP range requests, so
121
+ nothing downloads the full 28 GB archive and an interrupted fetch resumes by
122
+ skipping what is already on disk. `--split train` / `--split test` limits what
123
+ is pulled, and `--from /path/to/task1_videos_mp4.zip` reads a copy you already
124
+ have.
125
+
126
+ `vtrace demo predict` pulls the single video it needs and runs in about a minute.
127
+ `vtrace demo train` is a real training run on the full benchmark, not a smoke
128
+ test: 337 iterations per epoch over ten epochs, roughly three hours on one
129
+ modern GPU (~23 GB of VRAM).
130
+
131
+ If you use the demo data, cite CalMS21: Sun et al., *The Multi-Agent Behavior
132
+ Dataset: Mouse Dyadic Social Interactions*, NeurIPS 2021 Datasets & Benchmarks.
133
+
134
+ `vtrace demo download` assembles an ordinary model directory in `~/.vtrace/demo`, so
135
+ afterwards the plain commands work against it too:
136
+
137
+ ```bash
138
+ vtrace predict --model-dir ~/.vtrace/demo/model --input /my/video.mp4
139
+ ```
140
+
141
+ ```bash
142
+ # Check whether PyPI has a newer V-TRACE release
143
+ vtrace update
144
+
145
+ # Train from selected video/annotation pairs
146
+ vtrace train --model maev2 --work-dir /my/dataset --pairs video01.mp4=video01_final.csv video02.mp4=video02.csv
147
+
148
+ # Evaluate the training artifact, or evaluate on held-out video/annotation pairs
149
+ vtrace eval --model-dir /my/dataset/model_YYYYMMDD_HHMMSS
150
+ vtrace eval --model-dir /my/dataset/model_YYYYMMDD_HHMMSS --work-dir /my/testset --pairs video03.mp4=video03.csv
151
+
152
+ # Predict on new videos and write annotation drafts
153
+ vtrace predict --model-dir /my/dataset/model_YYYYMMDD_HHMMSS --input /path/to/video.mp4 --threshold 0.25
154
+
155
+ # Run prep -> train -> predict end to end
156
+ vtrace pipeline --train --infer --model maev2 \
157
+ --work-dir /my/dataset --pairs video01.mp4=video01_final.csv \
158
+ --input /path/to/new/videos
159
+ ```
160
+
161
+ `--pairs` is explicit: each item is `VIDEO_PATH=CSV_PATH`. A source video can
162
+ have multiple annotation CSVs beside it, such as `video01_draft.csv`,
163
+ `video01_final.csv`, or a reviewed prediction exported from the annotator; each
164
+ training or evaluation pair chooses the annotation file to use for that video.
165
+ Relative paths are resolved against `--work-dir`, so
166
+ `video01.mp4=video01_final.csv` means both files are inside the work directory.
167
+ Training creates a self-contained `model_YYYYMMDD_HHMMSS/` folder under
168
+ `--work-dir`.
169
+
170
+ V-TRACE annotation CSVs are time-based:
171
+
172
+ ```csv
173
+ labelId,timestamp,endTimestamp
174
+ grooming,12.430,18.970
175
+ rearing,42.100,45.650
176
+ ```
177
+
178
+ Prediction writes **one file per video**, named after it and placed beside it:
179
+
180
+ ```
181
+ my_video.mp4
182
+ my_video.predict.json
183
+ ```
184
+
185
+ Re-running prediction replaces that file rather than accumulating copies — a
186
+ video has exactly one current prediction. The JSON holds the merged behaviour
187
+ bouts with their confidences, in the shape the V-TRACE annotator imports, so the
188
+ same folder opened in `vtrace app` shows the video with its predictions ready for
189
+ review. `--output DIR` writes the files somewhere else, keeping the names.
190
+
191
+ ## Shipped research configs and checkpoints
192
+
193
+ The repo carries the CalMS21 configurations behind the paper's results, and the
194
+ matching checkpoints are hosted on the GitHub `weights` release. **No checkpoint
195
+ is bundled in the repo or the wheel** — any config or `--checkpoint` argument
196
+ that names a registered file downloads it on first use (SHA256-verified, cached
197
+ under `~/.vtrace/pretrained`, override with `TRACE_WEIGHTS_DIR`):
198
+
199
+ | Config | Checkpoint | What it is |
200
+ |---|---|---|
201
+ | `configs/calms21_distill_vmaeB.py` | `calms21_vitB_distilled_best.pth` | The CalMS21 detector: a VideoMAE V2 ViT-B student, frozen ViT plus trained per-block adapters and a dense per-frame head. This is what `vtrace demo predict` runs. |
202
+ | `configs/calms21_vjepa2.py` | `calms21_vjepa2_teacher95.pth` | The V-JEPA2 ViT-L **encoder** fine-tuned on CalMS21 — the teacher the student above was distilled from. Encoder weights only, so it initialises a backbone rather than predicting on its own. |
203
+
204
+ Two pretrained bases complete the distillation chain: `vitB_videomaev2_k400.pth`
205
+ (the student's frozen ViT-B) and `vjepa2_vitl_encoder.pth` (the teacher's
206
+ starting encoder, before CalMS21 fine-tuning). To reproduce the distillation
207
+ itself, see `tools/distill_jepa_to_vmae.py` and `tools/bake_distill_adapters.py`.
208
+
209
+ Example — score the CalMS21 detector on the 19 official test videos:
210
+
211
+ ```bash
212
+ torchrun --nproc_per_node=1 tools/test.py configs/calms21_distill_vmaeB.py \
213
+ --checkpoint calms21_vitB_distilled_best.pth
214
+ ```
215
+
216
+ ## License
217
+
218
+ Apache 2.0. See [LICENSE](LICENSE).
@@ -0,0 +1,177 @@
1
+ # V-TRACE — Video-based Temporal Recognition and Annotation of Continuous Ethograms of Animal Behavior
2
+
3
+ V-TRACE turns untrimmed animal-behavior video into continuous ethograms: label a few
4
+ recordings in the browser, train a detector on them, and have it annotate the rest.
5
+
6
+ ## Documentation
7
+
8
+ [kunmings.github.io/TRACE](https://kunmings.github.io/TRACE/)
9
+
10
+ ## Install
11
+
12
+ Create a Python 3.9+ environment first. Choose one:
13
+
14
+ ```bash
15
+ conda create -n vtrace python=3.11 pip
16
+ conda activate vtrace
17
+ ```
18
+
19
+ ```bash
20
+ mamba create -n vtrace python=3.11 pip
21
+ mamba activate vtrace
22
+ ```
23
+
24
+ ```bash
25
+ uv venv --python 3.11 --seed .venv
26
+ source .venv/bin/activate
27
+ ```
28
+
29
+ Then install V-TRACE and download the model weights:
30
+
31
+ ```bash
32
+ python -m pip install vtrace-behavior
33
+ vtrace prepare --weights all
34
+ ```
35
+
36
+ Training, evaluation and prediction need a CUDA-capable PyTorch environment.
37
+ Annotation does not — the browser app works anywhere.
38
+
39
+ ## Usage
40
+
41
+ Run it with no arguments:
42
+
43
+ ```bash
44
+ vtrace
45
+ ```
46
+
47
+ That opens an interactive session. The annotator starts with it, so the screen
48
+ gives you its address — open `http://localhost:8765` in Chrome or Edge — and you
49
+ type the rest of the commands at the `vtrace >` prompt, without repeating the
50
+ program's name (`demo predict`, not `vtrace demo predict`). Tab completes,
51
+ ctrl-r searches history, `exit` leaves.
52
+
53
+ The annotator is a single static page. It reads videos and writes annotations
54
+ **on the computer running the browser**, through the File System Access API:
55
+ nothing is uploaded and there is no server-side state. Use it to open
56
+ recordings, define behaviors, mark events on the timeline, and review model
57
+ predictions; training, evaluation and prediction run from the command line.
58
+
59
+ `vtrace app` serves the annotator on its own, without the session — for scripts,
60
+ or when that is all you want.
61
+
62
+ Every command below also works directly from a shell, prefixed with `vtrace`.
63
+
64
+ ## Try the demo
65
+
66
+ A walkthrough on CalMS21 mouse social behavior, using the *complete* Task-1
67
+ benchmark in its official split — 70 training videos (4.7 h, 2287 labelled
68
+ bouts) and 19 test videos (2.4 h, 1521 bouts):
69
+
70
+ ```bash
71
+ vtrace demo predict # predict on a held-out video, write its predictions
72
+ vtrace demo download # fetch the videos (train ~19 GB, test ~11 GB)
73
+ vtrace demo train # prep + train on the 70 official training videos
74
+ ```
75
+
76
+ V-TRACE does not re-host CalMS21. The annotation CSVs ship with the package; the
77
+ videos come straight from the
78
+ [official CalMS21 release](https://data.caltech.edu/records/s0vdx-0k302)
79
+ (doi:10.22002/D1.1991), one member at a time over HTTP range requests, so
80
+ nothing downloads the full 28 GB archive and an interrupted fetch resumes by
81
+ skipping what is already on disk. `--split train` / `--split test` limits what
82
+ is pulled, and `--from /path/to/task1_videos_mp4.zip` reads a copy you already
83
+ have.
84
+
85
+ `vtrace demo predict` pulls the single video it needs and runs in about a minute.
86
+ `vtrace demo train` is a real training run on the full benchmark, not a smoke
87
+ test: 337 iterations per epoch over ten epochs, roughly three hours on one
88
+ modern GPU (~23 GB of VRAM).
89
+
90
+ If you use the demo data, cite CalMS21: Sun et al., *The Multi-Agent Behavior
91
+ Dataset: Mouse Dyadic Social Interactions*, NeurIPS 2021 Datasets & Benchmarks.
92
+
93
+ `vtrace demo download` assembles an ordinary model directory in `~/.vtrace/demo`, so
94
+ afterwards the plain commands work against it too:
95
+
96
+ ```bash
97
+ vtrace predict --model-dir ~/.vtrace/demo/model --input /my/video.mp4
98
+ ```
99
+
100
+ ```bash
101
+ # Check whether PyPI has a newer V-TRACE release
102
+ vtrace update
103
+
104
+ # Train from selected video/annotation pairs
105
+ vtrace train --model maev2 --work-dir /my/dataset --pairs video01.mp4=video01_final.csv video02.mp4=video02.csv
106
+
107
+ # Evaluate the training artifact, or evaluate on held-out video/annotation pairs
108
+ vtrace eval --model-dir /my/dataset/model_YYYYMMDD_HHMMSS
109
+ vtrace eval --model-dir /my/dataset/model_YYYYMMDD_HHMMSS --work-dir /my/testset --pairs video03.mp4=video03.csv
110
+
111
+ # Predict on new videos and write annotation drafts
112
+ vtrace predict --model-dir /my/dataset/model_YYYYMMDD_HHMMSS --input /path/to/video.mp4 --threshold 0.25
113
+
114
+ # Run prep -> train -> predict end to end
115
+ vtrace pipeline --train --infer --model maev2 \
116
+ --work-dir /my/dataset --pairs video01.mp4=video01_final.csv \
117
+ --input /path/to/new/videos
118
+ ```
119
+
120
+ `--pairs` is explicit: each item is `VIDEO_PATH=CSV_PATH`. A source video can
121
+ have multiple annotation CSVs beside it, such as `video01_draft.csv`,
122
+ `video01_final.csv`, or a reviewed prediction exported from the annotator; each
123
+ training or evaluation pair chooses the annotation file to use for that video.
124
+ Relative paths are resolved against `--work-dir`, so
125
+ `video01.mp4=video01_final.csv` means both files are inside the work directory.
126
+ Training creates a self-contained `model_YYYYMMDD_HHMMSS/` folder under
127
+ `--work-dir`.
128
+
129
+ V-TRACE annotation CSVs are time-based:
130
+
131
+ ```csv
132
+ labelId,timestamp,endTimestamp
133
+ grooming,12.430,18.970
134
+ rearing,42.100,45.650
135
+ ```
136
+
137
+ Prediction writes **one file per video**, named after it and placed beside it:
138
+
139
+ ```
140
+ my_video.mp4
141
+ my_video.predict.json
142
+ ```
143
+
144
+ Re-running prediction replaces that file rather than accumulating copies — a
145
+ video has exactly one current prediction. The JSON holds the merged behaviour
146
+ bouts with their confidences, in the shape the V-TRACE annotator imports, so the
147
+ same folder opened in `vtrace app` shows the video with its predictions ready for
148
+ review. `--output DIR` writes the files somewhere else, keeping the names.
149
+
150
+ ## Shipped research configs and checkpoints
151
+
152
+ The repo carries the CalMS21 configurations behind the paper's results, and the
153
+ matching checkpoints are hosted on the GitHub `weights` release. **No checkpoint
154
+ is bundled in the repo or the wheel** — any config or `--checkpoint` argument
155
+ that names a registered file downloads it on first use (SHA256-verified, cached
156
+ under `~/.vtrace/pretrained`, override with `TRACE_WEIGHTS_DIR`):
157
+
158
+ | Config | Checkpoint | What it is |
159
+ |---|---|---|
160
+ | `configs/calms21_distill_vmaeB.py` | `calms21_vitB_distilled_best.pth` | The CalMS21 detector: a VideoMAE V2 ViT-B student, frozen ViT plus trained per-block adapters and a dense per-frame head. This is what `vtrace demo predict` runs. |
161
+ | `configs/calms21_vjepa2.py` | `calms21_vjepa2_teacher95.pth` | The V-JEPA2 ViT-L **encoder** fine-tuned on CalMS21 — the teacher the student above was distilled from. Encoder weights only, so it initialises a backbone rather than predicting on its own. |
162
+
163
+ Two pretrained bases complete the distillation chain: `vitB_videomaev2_k400.pth`
164
+ (the student's frozen ViT-B) and `vjepa2_vitl_encoder.pth` (the teacher's
165
+ starting encoder, before CalMS21 fine-tuning). To reproduce the distillation
166
+ itself, see `tools/distill_jepa_to_vmae.py` and `tools/bake_distill_adapters.py`.
167
+
168
+ Example — score the CalMS21 detector on the 19 official test videos:
169
+
170
+ ```bash
171
+ torchrun --nproc_per_node=1 tools/test.py configs/calms21_distill_vmaeB.py \
172
+ --checkpoint calms21_vitB_distilled_best.pth
173
+ ```
174
+
175
+ ## License
176
+
177
+ Apache 2.0. See [LICENSE](LICENSE).
File without changes