dnt 0.2.4__py3-none-any.whl → 0.3.1.3__py3-none-any.whl

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.

Potentially problematic release.


This version of dnt might be problematic. Click here for more details.

Files changed (305) hide show
  1. dnt/__init__.py +3 -2
  2. dnt/analysis/__init__.py +3 -2
  3. dnt/analysis/interaction.py +503 -0
  4. dnt/analysis/stop.py +22 -17
  5. dnt/analysis/stop2.py +289 -0
  6. dnt/analysis/stop3.py +754 -0
  7. dnt/detect/signal/detector.py +317 -0
  8. dnt/detect/yolov8/detector.py +116 -16
  9. dnt/engine/__init__.py +8 -0
  10. dnt/engine/bbox_interp.py +83 -0
  11. dnt/engine/bbox_iou.py +20 -0
  12. dnt/engine/cluster.py +31 -0
  13. dnt/engine/iob.py +66 -0
  14. dnt/filter/filter.py +321 -1
  15. dnt/label/labeler.py +4 -4
  16. dnt/label/labeler2.py +502 -0
  17. dnt/shared/__init__.py +2 -1
  18. dnt/shared/data/coco.names +0 -0
  19. dnt/shared/data/openimages.names +0 -0
  20. dnt/shared/data/voc.names +0 -0
  21. dnt/shared/download.py +12 -0
  22. dnt/shared/synhcro.py +150 -0
  23. dnt/shared/util.py +17 -4
  24. dnt/third_party/fast-reid/__init__.py +1 -0
  25. dnt/third_party/fast-reid/configs/Base-AGW.yml +19 -0
  26. dnt/third_party/fast-reid/configs/Base-MGN.yml +12 -0
  27. dnt/third_party/fast-reid/configs/Base-SBS.yml +63 -0
  28. dnt/third_party/fast-reid/configs/Base-bagtricks.yml +76 -0
  29. dnt/third_party/fast-reid/configs/DukeMTMC/AGW_R101-ibn.yml +12 -0
  30. dnt/third_party/fast-reid/configs/DukeMTMC/AGW_R50-ibn.yml +11 -0
  31. dnt/third_party/fast-reid/configs/DukeMTMC/AGW_R50.yml +7 -0
  32. dnt/third_party/fast-reid/configs/DukeMTMC/AGW_S50.yml +11 -0
  33. dnt/third_party/fast-reid/configs/DukeMTMC/bagtricks_R101-ibn.yml +12 -0
  34. dnt/third_party/fast-reid/configs/DukeMTMC/bagtricks_R50-ibn.yml +11 -0
  35. dnt/third_party/fast-reid/configs/DukeMTMC/bagtricks_R50.yml +7 -0
  36. dnt/third_party/fast-reid/configs/DukeMTMC/bagtricks_S50.yml +11 -0
  37. dnt/third_party/fast-reid/configs/DukeMTMC/mgn_R50-ibn.yml +11 -0
  38. dnt/third_party/fast-reid/configs/DukeMTMC/sbs_R101-ibn.yml +12 -0
  39. dnt/third_party/fast-reid/configs/DukeMTMC/sbs_R50-ibn.yml +11 -0
  40. dnt/third_party/fast-reid/configs/DukeMTMC/sbs_R50.yml +7 -0
  41. dnt/third_party/fast-reid/configs/DukeMTMC/sbs_S50.yml +11 -0
  42. dnt/third_party/fast-reid/configs/MOT17/AGW_R101-ibn.yml +12 -0
  43. dnt/third_party/fast-reid/configs/MOT17/AGW_R50-ibn.yml +11 -0
  44. dnt/third_party/fast-reid/configs/MOT17/AGW_R50.yml +7 -0
  45. dnt/third_party/fast-reid/configs/MOT17/AGW_S50.yml +11 -0
  46. dnt/third_party/fast-reid/configs/MOT17/bagtricks_R101-ibn.yml +12 -0
  47. dnt/third_party/fast-reid/configs/MOT17/bagtricks_R50-ibn.yml +11 -0
  48. dnt/third_party/fast-reid/configs/MOT17/bagtricks_R50.yml +7 -0
  49. dnt/third_party/fast-reid/configs/MOT17/bagtricks_S50.yml +11 -0
  50. dnt/third_party/fast-reid/configs/MOT17/mgn_R50-ibn.yml +11 -0
  51. dnt/third_party/fast-reid/configs/MOT17/sbs_R101-ibn.yml +12 -0
  52. dnt/third_party/fast-reid/configs/MOT17/sbs_R50-ibn.yml +11 -0
  53. dnt/third_party/fast-reid/configs/MOT17/sbs_R50.yml +7 -0
  54. dnt/third_party/fast-reid/configs/MOT17/sbs_S50.yml +11 -0
  55. dnt/third_party/fast-reid/configs/MOT20/AGW_R101-ibn.yml +12 -0
  56. dnt/third_party/fast-reid/configs/MOT20/AGW_R50-ibn.yml +11 -0
  57. dnt/third_party/fast-reid/configs/MOT20/AGW_R50.yml +7 -0
  58. dnt/third_party/fast-reid/configs/MOT20/AGW_S50.yml +11 -0
  59. dnt/third_party/fast-reid/configs/MOT20/bagtricks_R101-ibn.yml +12 -0
  60. dnt/third_party/fast-reid/configs/MOT20/bagtricks_R50-ibn.yml +11 -0
  61. dnt/third_party/fast-reid/configs/MOT20/bagtricks_R50.yml +7 -0
  62. dnt/third_party/fast-reid/configs/MOT20/bagtricks_S50.yml +11 -0
  63. dnt/third_party/fast-reid/configs/MOT20/mgn_R50-ibn.yml +11 -0
  64. dnt/third_party/fast-reid/configs/MOT20/sbs_R101-ibn.yml +12 -0
  65. dnt/third_party/fast-reid/configs/MOT20/sbs_R50-ibn.yml +11 -0
  66. dnt/third_party/fast-reid/configs/MOT20/sbs_R50.yml +7 -0
  67. dnt/third_party/fast-reid/configs/MOT20/sbs_S50.yml +11 -0
  68. dnt/third_party/fast-reid/configs/MSMT17/AGW_R101-ibn.yml +12 -0
  69. dnt/third_party/fast-reid/configs/MSMT17/AGW_R50-ibn.yml +11 -0
  70. dnt/third_party/fast-reid/configs/MSMT17/AGW_R50.yml +7 -0
  71. dnt/third_party/fast-reid/configs/MSMT17/AGW_S50.yml +11 -0
  72. dnt/third_party/fast-reid/configs/MSMT17/bagtricks_R101-ibn.yml +13 -0
  73. dnt/third_party/fast-reid/configs/MSMT17/bagtricks_R50-ibn.yml +12 -0
  74. dnt/third_party/fast-reid/configs/MSMT17/bagtricks_R50.yml +7 -0
  75. dnt/third_party/fast-reid/configs/MSMT17/bagtricks_S50.yml +12 -0
  76. dnt/third_party/fast-reid/configs/MSMT17/mgn_R50-ibn.yml +11 -0
  77. dnt/third_party/fast-reid/configs/MSMT17/sbs_R101-ibn.yml +12 -0
  78. dnt/third_party/fast-reid/configs/MSMT17/sbs_R50-ibn.yml +11 -0
  79. dnt/third_party/fast-reid/configs/MSMT17/sbs_R50.yml +7 -0
  80. dnt/third_party/fast-reid/configs/MSMT17/sbs_S50.yml +11 -0
  81. dnt/third_party/fast-reid/configs/Market1501/AGW_R101-ibn.yml +12 -0
  82. dnt/third_party/fast-reid/configs/Market1501/AGW_R50-ibn.yml +11 -0
  83. dnt/third_party/fast-reid/configs/Market1501/AGW_R50.yml +7 -0
  84. dnt/third_party/fast-reid/configs/Market1501/AGW_S50.yml +11 -0
  85. dnt/third_party/fast-reid/configs/Market1501/bagtricks_R101-ibn.yml +12 -0
  86. dnt/third_party/fast-reid/configs/Market1501/bagtricks_R50-ibn.yml +11 -0
  87. dnt/third_party/fast-reid/configs/Market1501/bagtricks_R50.yml +7 -0
  88. dnt/third_party/fast-reid/configs/Market1501/bagtricks_S50.yml +11 -0
  89. dnt/third_party/fast-reid/configs/Market1501/bagtricks_vit.yml +88 -0
  90. dnt/third_party/fast-reid/configs/Market1501/mgn_R50-ibn.yml +11 -0
  91. dnt/third_party/fast-reid/configs/Market1501/sbs_R101-ibn.yml +12 -0
  92. dnt/third_party/fast-reid/configs/Market1501/sbs_R50-ibn.yml +11 -0
  93. dnt/third_party/fast-reid/configs/Market1501/sbs_R50.yml +7 -0
  94. dnt/third_party/fast-reid/configs/Market1501/sbs_S50.yml +11 -0
  95. dnt/third_party/fast-reid/configs/VERIWild/bagtricks_R50-ibn.yml +35 -0
  96. dnt/third_party/fast-reid/configs/VeRi/sbs_R50-ibn.yml +35 -0
  97. dnt/third_party/fast-reid/configs/VehicleID/bagtricks_R50-ibn.yml +36 -0
  98. dnt/third_party/fast-reid/configs/__init__.py +0 -0
  99. dnt/third_party/fast-reid/fast_reid_interfece.py +175 -0
  100. dnt/third_party/fast-reid/fastreid/__init__.py +6 -0
  101. dnt/third_party/fast-reid/fastreid/config/__init__.py +15 -0
  102. dnt/third_party/fast-reid/fastreid/config/config.py +319 -0
  103. dnt/third_party/fast-reid/fastreid/config/defaults.py +329 -0
  104. dnt/third_party/fast-reid/fastreid/data/__init__.py +17 -0
  105. dnt/third_party/fast-reid/fastreid/data/build.py +194 -0
  106. dnt/third_party/fast-reid/fastreid/data/common.py +58 -0
  107. dnt/third_party/fast-reid/fastreid/data/data_utils.py +202 -0
  108. dnt/third_party/fast-reid/fastreid/data/datasets/AirportALERT.py +50 -0
  109. dnt/third_party/fast-reid/fastreid/data/datasets/__init__.py +43 -0
  110. dnt/third_party/fast-reid/fastreid/data/datasets/bases.py +183 -0
  111. dnt/third_party/fast-reid/fastreid/data/datasets/caviara.py +44 -0
  112. dnt/third_party/fast-reid/fastreid/data/datasets/cuhk03.py +274 -0
  113. dnt/third_party/fast-reid/fastreid/data/datasets/cuhk_sysu.py +58 -0
  114. dnt/third_party/fast-reid/fastreid/data/datasets/dukemtmcreid.py +70 -0
  115. dnt/third_party/fast-reid/fastreid/data/datasets/grid.py +44 -0
  116. dnt/third_party/fast-reid/fastreid/data/datasets/iLIDS.py +45 -0
  117. dnt/third_party/fast-reid/fastreid/data/datasets/lpw.py +49 -0
  118. dnt/third_party/fast-reid/fastreid/data/datasets/market1501.py +89 -0
  119. dnt/third_party/fast-reid/fastreid/data/datasets/msmt17.py +114 -0
  120. dnt/third_party/fast-reid/fastreid/data/datasets/pes3d.py +44 -0
  121. dnt/third_party/fast-reid/fastreid/data/datasets/pku.py +44 -0
  122. dnt/third_party/fast-reid/fastreid/data/datasets/prai.py +43 -0
  123. dnt/third_party/fast-reid/fastreid/data/datasets/prid.py +41 -0
  124. dnt/third_party/fast-reid/fastreid/data/datasets/saivt.py +47 -0
  125. dnt/third_party/fast-reid/fastreid/data/datasets/sensereid.py +47 -0
  126. dnt/third_party/fast-reid/fastreid/data/datasets/shinpuhkan.py +48 -0
  127. dnt/third_party/fast-reid/fastreid/data/datasets/sysu_mm.py +47 -0
  128. dnt/third_party/fast-reid/fastreid/data/datasets/thermalworld.py +43 -0
  129. dnt/third_party/fast-reid/fastreid/data/datasets/vehicleid.py +126 -0
  130. dnt/third_party/fast-reid/fastreid/data/datasets/veri.py +69 -0
  131. dnt/third_party/fast-reid/fastreid/data/datasets/veriwild.py +140 -0
  132. dnt/third_party/fast-reid/fastreid/data/datasets/viper.py +45 -0
  133. dnt/third_party/fast-reid/fastreid/data/datasets/wildtracker.py +59 -0
  134. dnt/third_party/fast-reid/fastreid/data/samplers/__init__.py +18 -0
  135. dnt/third_party/fast-reid/fastreid/data/samplers/data_sampler.py +85 -0
  136. dnt/third_party/fast-reid/fastreid/data/samplers/imbalance_sampler.py +67 -0
  137. dnt/third_party/fast-reid/fastreid/data/samplers/triplet_sampler.py +260 -0
  138. dnt/third_party/fast-reid/fastreid/data/transforms/__init__.py +11 -0
  139. dnt/third_party/fast-reid/fastreid/data/transforms/autoaugment.py +806 -0
  140. dnt/third_party/fast-reid/fastreid/data/transforms/build.py +100 -0
  141. dnt/third_party/fast-reid/fastreid/data/transforms/functional.py +180 -0
  142. dnt/third_party/fast-reid/fastreid/data/transforms/transforms.py +161 -0
  143. dnt/third_party/fast-reid/fastreid/engine/__init__.py +15 -0
  144. dnt/third_party/fast-reid/fastreid/engine/defaults.py +490 -0
  145. dnt/third_party/fast-reid/fastreid/engine/hooks.py +534 -0
  146. dnt/third_party/fast-reid/fastreid/engine/launch.py +103 -0
  147. dnt/third_party/fast-reid/fastreid/engine/train_loop.py +357 -0
  148. dnt/third_party/fast-reid/fastreid/evaluation/__init__.py +6 -0
  149. dnt/third_party/fast-reid/fastreid/evaluation/clas_evaluator.py +81 -0
  150. dnt/third_party/fast-reid/fastreid/evaluation/evaluator.py +176 -0
  151. dnt/third_party/fast-reid/fastreid/evaluation/query_expansion.py +46 -0
  152. dnt/third_party/fast-reid/fastreid/evaluation/rank.py +200 -0
  153. dnt/third_party/fast-reid/fastreid/evaluation/rank_cylib/__init__.py +20 -0
  154. dnt/third_party/fast-reid/fastreid/evaluation/rank_cylib/setup.py +32 -0
  155. dnt/third_party/fast-reid/fastreid/evaluation/rank_cylib/test_cython.py +106 -0
  156. dnt/third_party/fast-reid/fastreid/evaluation/reid_evaluation.py +143 -0
  157. dnt/third_party/fast-reid/fastreid/evaluation/rerank.py +73 -0
  158. dnt/third_party/fast-reid/fastreid/evaluation/roc.py +90 -0
  159. dnt/third_party/fast-reid/fastreid/evaluation/testing.py +88 -0
  160. dnt/third_party/fast-reid/fastreid/layers/__init__.py +19 -0
  161. dnt/third_party/fast-reid/fastreid/layers/activation.py +59 -0
  162. dnt/third_party/fast-reid/fastreid/layers/any_softmax.py +80 -0
  163. dnt/third_party/fast-reid/fastreid/layers/batch_norm.py +205 -0
  164. dnt/third_party/fast-reid/fastreid/layers/context_block.py +113 -0
  165. dnt/third_party/fast-reid/fastreid/layers/drop.py +161 -0
  166. dnt/third_party/fast-reid/fastreid/layers/frn.py +199 -0
  167. dnt/third_party/fast-reid/fastreid/layers/gather_layer.py +30 -0
  168. dnt/third_party/fast-reid/fastreid/layers/helpers.py +31 -0
  169. dnt/third_party/fast-reid/fastreid/layers/non_local.py +54 -0
  170. dnt/third_party/fast-reid/fastreid/layers/pooling.py +124 -0
  171. dnt/third_party/fast-reid/fastreid/layers/se_layer.py +25 -0
  172. dnt/third_party/fast-reid/fastreid/layers/splat.py +109 -0
  173. dnt/third_party/fast-reid/fastreid/layers/weight_init.py +122 -0
  174. dnt/third_party/fast-reid/fastreid/modeling/__init__.py +23 -0
  175. dnt/third_party/fast-reid/fastreid/modeling/backbones/__init__.py +18 -0
  176. dnt/third_party/fast-reid/fastreid/modeling/backbones/build.py +27 -0
  177. dnt/third_party/fast-reid/fastreid/modeling/backbones/mobilenet.py +195 -0
  178. dnt/third_party/fast-reid/fastreid/modeling/backbones/mobilenetv3.py +283 -0
  179. dnt/third_party/fast-reid/fastreid/modeling/backbones/osnet.py +525 -0
  180. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/__init__.py +4 -0
  181. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/config.py +396 -0
  182. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet/EN-B0_dds_8gpu.yaml +27 -0
  183. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet/EN-B1_dds_8gpu.yaml +27 -0
  184. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet/EN-B2_dds_8gpu.yaml +27 -0
  185. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet/EN-B3_dds_8gpu.yaml +27 -0
  186. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet/EN-B4_dds_8gpu.yaml +27 -0
  187. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet/EN-B5_dds_8gpu.yaml +27 -0
  188. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet.py +281 -0
  189. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnet.py +596 -0
  190. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-1.6GF_dds_8gpu.yaml +26 -0
  191. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-12GF_dds_8gpu.yaml +26 -0
  192. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-16GF_dds_8gpu.yaml +26 -0
  193. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-200MF_dds_8gpu.yaml +26 -0
  194. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-3.2GF_dds_8gpu.yaml +26 -0
  195. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-32GF_dds_8gpu.yaml +26 -0
  196. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-4.0GF_dds_8gpu.yaml +26 -0
  197. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-400MF_dds_8gpu.yaml +26 -0
  198. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-6.4GF_dds_8gpu.yaml +26 -0
  199. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-600MF_dds_8gpu.yaml +26 -0
  200. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-8.0GF_dds_8gpu.yaml +26 -0
  201. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-800MF_dds_8gpu.yaml +26 -0
  202. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-1.6GF_dds_8gpu.yaml +27 -0
  203. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-12GF_dds_8gpu.yaml +27 -0
  204. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-16GF_dds_8gpu.yaml +27 -0
  205. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-200MF_dds_8gpu.yaml +26 -0
  206. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-3.2GF_dds_8gpu.yaml +27 -0
  207. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-32GF_dds_8gpu.yaml +27 -0
  208. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-4.0GF_dds_8gpu.yaml +27 -0
  209. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-400MF_dds_8gpu.yaml +27 -0
  210. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-6.4GF_dds_8gpu.yaml +27 -0
  211. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-600MF_dds_8gpu.yaml +27 -0
  212. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-8.0GF_dds_8gpu.yaml +27 -0
  213. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-800MF_dds_8gpu.yaml +27 -0
  214. dnt/third_party/fast-reid/fastreid/modeling/backbones/repvgg.py +309 -0
  215. dnt/third_party/fast-reid/fastreid/modeling/backbones/resnest.py +365 -0
  216. dnt/third_party/fast-reid/fastreid/modeling/backbones/resnet.py +364 -0
  217. dnt/third_party/fast-reid/fastreid/modeling/backbones/resnext.py +335 -0
  218. dnt/third_party/fast-reid/fastreid/modeling/backbones/shufflenet.py +203 -0
  219. dnt/third_party/fast-reid/fastreid/modeling/backbones/vision_transformer.py +399 -0
  220. dnt/third_party/fast-reid/fastreid/modeling/heads/__init__.py +11 -0
  221. dnt/third_party/fast-reid/fastreid/modeling/heads/build.py +25 -0
  222. dnt/third_party/fast-reid/fastreid/modeling/heads/clas_head.py +36 -0
  223. dnt/third_party/fast-reid/fastreid/modeling/heads/embedding_head.py +151 -0
  224. dnt/third_party/fast-reid/fastreid/modeling/losses/__init__.py +12 -0
  225. dnt/third_party/fast-reid/fastreid/modeling/losses/circle_loss.py +71 -0
  226. dnt/third_party/fast-reid/fastreid/modeling/losses/cross_entroy_loss.py +54 -0
  227. dnt/third_party/fast-reid/fastreid/modeling/losses/focal_loss.py +92 -0
  228. dnt/third_party/fast-reid/fastreid/modeling/losses/triplet_loss.py +113 -0
  229. dnt/third_party/fast-reid/fastreid/modeling/losses/utils.py +48 -0
  230. dnt/third_party/fast-reid/fastreid/modeling/meta_arch/__init__.py +14 -0
  231. dnt/third_party/fast-reid/fastreid/modeling/meta_arch/baseline.py +188 -0
  232. dnt/third_party/fast-reid/fastreid/modeling/meta_arch/build.py +26 -0
  233. dnt/third_party/fast-reid/fastreid/modeling/meta_arch/distiller.py +140 -0
  234. dnt/third_party/fast-reid/fastreid/modeling/meta_arch/mgn.py +394 -0
  235. dnt/third_party/fast-reid/fastreid/modeling/meta_arch/moco.py +126 -0
  236. dnt/third_party/fast-reid/fastreid/solver/__init__.py +8 -0
  237. dnt/third_party/fast-reid/fastreid/solver/build.py +348 -0
  238. dnt/third_party/fast-reid/fastreid/solver/lr_scheduler.py +66 -0
  239. dnt/third_party/fast-reid/fastreid/solver/optim/__init__.py +10 -0
  240. dnt/third_party/fast-reid/fastreid/solver/optim/lamb.py +123 -0
  241. dnt/third_party/fast-reid/fastreid/solver/optim/radam.py +149 -0
  242. dnt/third_party/fast-reid/fastreid/solver/optim/swa.py +246 -0
  243. dnt/third_party/fast-reid/fastreid/utils/__init__.py +6 -0
  244. dnt/third_party/fast-reid/fastreid/utils/checkpoint.py +503 -0
  245. dnt/third_party/fast-reid/fastreid/utils/collect_env.py +158 -0
  246. dnt/third_party/fast-reid/fastreid/utils/comm.py +255 -0
  247. dnt/third_party/fast-reid/fastreid/utils/compute_dist.py +200 -0
  248. dnt/third_party/fast-reid/fastreid/utils/env.py +119 -0
  249. dnt/third_party/fast-reid/fastreid/utils/events.py +461 -0
  250. dnt/third_party/fast-reid/fastreid/utils/faiss_utils.py +127 -0
  251. dnt/third_party/fast-reid/fastreid/utils/file_io.py +520 -0
  252. dnt/third_party/fast-reid/fastreid/utils/history_buffer.py +71 -0
  253. dnt/third_party/fast-reid/fastreid/utils/logger.py +211 -0
  254. dnt/third_party/fast-reid/fastreid/utils/params.py +103 -0
  255. dnt/third_party/fast-reid/fastreid/utils/precision_bn.py +94 -0
  256. dnt/third_party/fast-reid/fastreid/utils/registry.py +66 -0
  257. dnt/third_party/fast-reid/fastreid/utils/summary.py +120 -0
  258. dnt/third_party/fast-reid/fastreid/utils/timer.py +68 -0
  259. dnt/third_party/fast-reid/fastreid/utils/visualizer.py +278 -0
  260. dnt/track/__init__.py +2 -0
  261. dnt/track/botsort/__init__.py +4 -0
  262. dnt/track/botsort/bot_tracker/__init__.py +3 -0
  263. dnt/track/botsort/bot_tracker/basetrack.py +60 -0
  264. dnt/track/botsort/bot_tracker/bot_sort.py +473 -0
  265. dnt/track/botsort/bot_tracker/gmc.py +316 -0
  266. dnt/track/botsort/bot_tracker/kalman_filter.py +269 -0
  267. dnt/track/botsort/bot_tracker/matching.py +194 -0
  268. dnt/track/botsort/bot_tracker/mc_bot_sort.py +505 -0
  269. dnt/track/{dsort/utils → botsort/bot_tracker/tracking_utils}/evaluation.py +14 -4
  270. dnt/track/{dsort/utils → botsort/bot_tracker/tracking_utils}/io.py +19 -36
  271. dnt/track/botsort/bot_tracker/tracking_utils/timer.py +37 -0
  272. dnt/track/botsort/inference.py +96 -0
  273. dnt/track/config.py +120 -0
  274. dnt/track/dsort/configs/bagtricks_R50.yml +7 -0
  275. dnt/track/dsort/configs/deep_sort.yaml +0 -0
  276. dnt/track/dsort/configs/fastreid.yaml +1 -1
  277. dnt/track/dsort/deep_sort/deep/checkpoint/ckpt.t7 +0 -0
  278. dnt/track/dsort/deep_sort/deep/feature_extractor.py +87 -8
  279. dnt/track/dsort/deep_sort/deep_sort.py +28 -18
  280. dnt/track/dsort/deep_sort/sort/iou_matching.py +0 -2
  281. dnt/track/dsort/deep_sort/sort/linear_assignment.py +0 -3
  282. dnt/track/dsort/deep_sort/sort/nn_matching.py +5 -5
  283. dnt/track/dsort/deep_sort/sort/preprocessing.py +1 -2
  284. dnt/track/dsort/dsort.py +21 -28
  285. dnt/track/re_class.py +94 -0
  286. dnt/track/sort/sort.py +5 -1
  287. dnt/track/tracker.py +207 -30
  288. {dnt-0.2.4.dist-info → dnt-0.3.1.3.dist-info}/METADATA +30 -10
  289. dnt-0.3.1.3.dist-info/RECORD +314 -0
  290. {dnt-0.2.4.dist-info → dnt-0.3.1.3.dist-info}/WHEEL +1 -1
  291. dnt/analysis/yield.py +0 -9
  292. dnt/track/dsort/deep_sort/deep/evaluate.py +0 -15
  293. dnt/track/dsort/deep_sort/deep/original_model.py +0 -106
  294. dnt/track/dsort/deep_sort/deep/test.py +0 -77
  295. dnt/track/dsort/deep_sort/deep/train.py +0 -189
  296. dnt/track/dsort/utils/asserts.py +0 -13
  297. dnt/track/dsort/utils/draw.py +0 -36
  298. dnt/track/dsort/utils/json_logger.py +0 -383
  299. dnt/track/dsort/utils/log.py +0 -17
  300. dnt/track/dsort/utils/parser.py +0 -35
  301. dnt/track/dsort/utils/tools.py +0 -39
  302. dnt-0.2.4.dist-info/RECORD +0 -64
  303. /dnt/{track/dsort/utils → third_party/fast-reid/checkpoint}/__init__.py +0 -0
  304. {dnt-0.2.4.dist-info → dnt-0.3.1.3.dist-info}/LICENSE +0 -0
  305. {dnt-0.2.4.dist-info → dnt-0.3.1.3.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,6 @@
1
1
  # vim: expandtab:ts=4:sw=4
2
2
  import numpy as np
3
3
 
4
-
5
4
  def _pdist(a, b):
6
5
  """Compute pair-wise squared distance between points in `a` and `b`.
7
6
 
@@ -19,7 +18,7 @@ def _pdist(a, b):
19
18
  contains the squared distance between `a[i]` and `b[j]`.
20
19
 
21
20
  """
22
- a, b = np.asarray(a), np.asarray(b)
21
+ a, b = np.asarray(a), np.asarray(b)
23
22
  if len(a) == 0 or len(b) == 0:
24
23
  return np.zeros((len(a), len(b)))
25
24
  a2, b2 = np.square(a).sum(axis=1), np.square(b).sum(axis=1)
@@ -27,7 +26,6 @@ def _pdist(a, b):
27
26
  r2 = np.clip(r2, 0., float(np.inf))
28
27
  return r2
29
28
 
30
-
31
29
  def _cosine_distance(a, b, data_is_normalized=False):
32
30
  """Compute pair-wise cosine distance between points in `a` and `b`.
33
31
 
@@ -49,8 +47,10 @@ def _cosine_distance(a, b, data_is_normalized=False):
49
47
 
50
48
  """
51
49
  if not data_is_normalized:
52
- a = np.asarray(a) / np.linalg.norm(a, axis=1, keepdims=True)
53
- b = np.asarray(b) / np.linalg.norm(b, axis=1, keepdims=True)
50
+ #a = np.asarray(a) / np.linalg.norm(a, axis=1, keepdims=True)
51
+ #b = np.asarray(b) / np.linalg.norm(b, axis=1, keepdims=True)
52
+ a = np.array(a, dtype=np.longdouble) / np.linalg.norm(a, axis=1, keepdims=True)
53
+ b = np.array(b, dtype=np.longdouble) / np.linalg.norm(b, axis=1, keepdims=True)
54
54
  return 1. - np.dot(a, b.T)
55
55
 
56
56
 
@@ -2,7 +2,6 @@
2
2
  import numpy as np
3
3
  import cv2
4
4
 
5
-
6
5
  def non_max_suppression(boxes, max_bbox_overlap, scores=None):
7
6
  """Suppress overlapping detections.
8
7
 
@@ -37,7 +36,7 @@ def non_max_suppression(boxes, max_bbox_overlap, scores=None):
37
36
  if len(boxes) == 0:
38
37
  return []
39
38
 
40
- boxes = boxes.astype(float)
39
+ boxes = boxes.astype(np.float64)
41
40
  pick = []
42
41
 
43
42
  x1 = boxes[:, 0]
dnt/track/dsort/dsort.py CHANGED
@@ -1,37 +1,25 @@
1
- import os
1
+ import os, sys
2
2
  import cv2
3
3
  import torch
4
4
  import numpy as np
5
5
  import pandas as pd
6
6
  from tqdm import tqdm
7
7
 
8
- from deep_sort import DeepSort
9
- from utils.parser import get_config
10
-
11
- def track(video_file:str, det_file:str, out_file:str = None, gpu:bool = True,
12
- reid_ckpt:str = './deep_sort/deep/checkpoint/ckpt.t7',
13
- max_dist:float = 0.2, min_confidence:float = 0.3, nms_max_overlap: float = 1.0,
14
- max_iou_distance:float = 0.7, max_age:int = 70, n_init:int = 3, nn_budget:int = 100,
15
- video_index:int = None, total_videos:int = None):
16
-
17
- cwd = os.path.dirname(__file__)
18
- #deepsort_cfg = os.path.join(cwd, deepsort_cfg)
8
+ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
19
9
 
20
- #cfg = get_config()
21
- #cfg.merge_from_file(deepsort_cfg)
10
+ from deep_sort import DeepSort
11
+ from config import Config
22
12
 
23
- device = torch.device('cuda') if (torch.cuda.is_available() and gpu) else torch.device('cpu')
13
+ def track(video_file:str, det_file:str, out_file:str = None, device:str = 'auto', half:bool = False,
14
+ cfg:dict = Config.get_cfg_dsort('default'), video_index:int = None, total_videos:int = None):
15
+
16
+ #device = torch.device('cuda') if (torch.cuda.is_available() and gpu) else torch.device('cpu')
24
17
  cap = cv2.VideoCapture(video_file)
25
18
  if not cap.isOpened():
26
19
  raise IOError("Couldn't open webcam or video")
27
-
28
- #deepsort = build_tracker(cfg, use_cuda=gpu)
29
-
30
- deepsort = DeepSort(model_path=os.path.join(cwd,reid_ckpt),
31
- max_dist=max_dist, min_confidence=min_confidence,
32
- nms_max_overlap=nms_max_overlap, max_iou_distance=max_iou_distance,
33
- max_age=max_age, n_init=n_init, nn_budget=nn_budget, use_cuda=gpu)
34
-
20
+
21
+ deepsort = DeepSort(cfg, device, half)
22
+
35
23
  detections = pd.read_csv(det_file, header=None).to_numpy()
36
24
  start_frame = int(min(detections[:,0]))
37
25
  end_frame = int(max(detections[:,0]))
@@ -56,12 +44,12 @@ def track(video_file:str, det_file:str, out_file:str = None, gpu:bool = True,
56
44
  nrows, ncols = frame_dets.shape
57
45
 
58
46
  if nrows > 0:
59
- bbox_xywh=[]
47
+ bbox_xywh = []
60
48
  for det in frame_dets:
61
49
  bbox_xywh.append([det[2]+det[4]/2, det[3]+det[5]/2, det[4], det[5]])
62
50
  bbox_xywh = np.array(bbox_xywh)
63
51
  conf_score = np.array(frame_dets[:,6])
64
-
52
+ classes = np.array(frame_dets[:,7])
65
53
  outputs = deepsort.update(bbox_xywh, conf_score, im)
66
54
 
67
55
  if len(outputs) > 0:
@@ -78,9 +66,14 @@ def track(video_file:str, det_file:str, out_file:str = None, gpu:bool = True,
78
66
 
79
67
  if __name__ == "__main__":
80
68
 
81
- video_file = "/mnt/d/videos/ped2stage/1026_2/videos/gh011293.mp4"
82
- iou_file = "/mnt/d/videos/ped2stage/1026_2/dets/gh011293_iou_ped.txt"
83
- out_file = "/mnt/d/videos/ped2stage/1026_2/tracks/gh011293_ped_track_2.txt"
69
+ '''
70
+ video_file = "/mnt/d/videos/ped2stage/videos/gh1293.mp4"
71
+ iou_file = "/mnt/d/videos/ped2stage/dets/gh1293_iou_ped.txt"
72
+ out_file = "/mnt/d/videos/ped2stage/tracks/gh1293_ped_track_2.txt"
73
+ '''
74
+ video_file = "/mnt/d/videos/samples/ped_veh.mp4"
75
+ iou_file = "/mnt/d/videos/samples/dets/ped_veh_iou.txt"
76
+ out_file = "/mnt/d/videos/samples/tracks/ped_veh_track.txt"
84
77
 
85
78
  track(video_file, iou_file, out_file)
86
79
 
dnt/track/re_class.py ADDED
@@ -0,0 +1,94 @@
1
+ import numpy as np
2
+ import pandas as pd
3
+ from tqdm import tqdm
4
+ from ..detect import Detector
5
+ from ..engine.iob import iobs
6
+
7
+ class ReClass:
8
+ def __init__(self, num_frames:int=25, threshold:float=0.75, model:str='rtdetr', device:str='auto',
9
+ default_class:int=0, match_class:list=[1, 36]) -> None:
10
+ self.detector = Detector(model=model, device=device)
11
+ self.num_frames = num_frames
12
+ self.threshold = threshold
13
+ self.default_class = default_class
14
+ self.match_class = match_class
15
+
16
+ def match_mmv(self, track:pd.DataFrame, dets:pd.DataFrame)->tuple:
17
+
18
+ score = 0
19
+ cnt = 0
20
+ for idx, row in track.iterrows():
21
+ bboxes = row[['x', 'y', 'w', 'h']].values.reshape(1, -1)
22
+ det = dets[dets['frame'] == row['frame']]
23
+ if len(det) > 0:
24
+ match_bboxes = det[['x', 'y', 'w', 'h']].values
25
+ _, overlaps_mmv = iobs(bboxes, match_bboxes)
26
+ max_overlap = np.max(overlaps_mmv)
27
+ if max_overlap >= self.threshold:
28
+ score += max_overlap
29
+ cnt += 1
30
+
31
+ if cnt > 0:
32
+ avg_score = score/cnt
33
+ else:
34
+ avg_score = 0
35
+ hit = True if avg_score >= self.threshold else False
36
+
37
+ return hit, avg_score
38
+
39
+ def re_classify(self, tracks:pd.DataFrame, input_video:str, track_ids:list=None,
40
+ out_file:str=None, verbose:bool=True)->pd.DataFrame:
41
+ """
42
+ Re-classify tracks
43
+ Parameters:
44
+ tracks: DataFrame with target tracks
45
+ input_video: Path to video
46
+ track_ids: List of track IDs for re-classify, if None re-classify all tracks, default None
47
+ default_cls: Default class to assign if no match found, default 0 (pedestrian)
48
+ match_cls: List of classes to match, default [1, 36] (bicycle, skateboard/scooter)
49
+ out_file: Path to save re-classified tracks, default None
50
+ Returns:
51
+ DataFrame with re-classified tracks (track_id, cls, avg_score)
52
+ """
53
+
54
+ if track_ids is None:
55
+ track_ids = tracks['track'].unique().tolist()
56
+
57
+ results = []
58
+ pbar = tqdm(total=len(track_ids), unit='track', desc='Re-classifying tracks')
59
+ for track_id in track_ids:
60
+
61
+ target_track = tracks[tracks['track'] == track_id].copy()
62
+ target_track['area'] = target_track['w'] * target_track['h']
63
+ target_track.sort_values(by='area', inplace=True, ascending=False)
64
+
65
+ if len(target_track) >= self.num_frames:
66
+ top_frames = target_track.head(self.num_frames)
67
+ else:
68
+ top_frames = target_track
69
+
70
+ dets = self.detector.detect_frames(input_video, top_frames['frame'].values.tolist())
71
+
72
+ matched = []
73
+ for cls in self.match_class:
74
+ match_dets = dets[dets['class'] == cls]
75
+ hit, avg_score = self.match_mmv(top_frames, match_dets)
76
+ if hit:
77
+ matched.append((cls, avg_score))
78
+
79
+ if len(matched) > 0:
80
+ cls, avg_score = max(matched, key=lambda x: x[1])
81
+ else:
82
+ cls = self.default_class
83
+ avg_score = 0
84
+
85
+ results.append([track_id, cls, round(avg_score, 2)])
86
+ if verbose:
87
+ pbar.update()
88
+ pbar.close()
89
+
90
+ df = pd.DataFrame(results, columns=['track', 'cls', 'avg_score'])
91
+ if out_file:
92
+ df.to_csv(out_file, index=False)
93
+
94
+ return df
dnt/track/sort/sort.py CHANGED
@@ -283,8 +283,12 @@ def track(det_file, out_file, max_age=1, min_inits=3, iou_threshold=0.3, video_i
283
283
  df = pd.DataFrame(results)
284
284
  df[3] = df[3] - df[1]
285
285
  df[4] = df[4] - df[2]
286
+ df[6] = -1
287
+ df[7] = -1
288
+ df[8] = -1
289
+ df[9] = -1
286
290
  df = df.astype('int')
287
- df[[0,5,1,2,3,4]].to_csv(out_file, index=False, header=None)
291
+ df[[0,5,1,2,3,4,6,7,8,9]].to_csv(out_file, index=False, header=None)
288
292
 
289
293
  if __name__ == '__main__':
290
294
  pass
dnt/track/tracker.py CHANGED
@@ -1,37 +1,53 @@
1
1
  import os, sys
2
2
  sys.path.append(os.path.dirname(__file__))
3
3
 
4
+ import torch
4
5
  from dsort import track as track_dsort
5
6
  from sort import track as track_sort
7
+ from botsort import track as track_botsort
8
+ from config import Config
9
+ import pandas as pd
10
+ from tqdm import tqdm
11
+ import numpy as np
12
+ from ..engine import interpolate_bbox, interpolate_bboxes, cluster_by_gap
6
13
 
7
- class Tracker:
8
- def __init__(self, method:str='sort',
9
- sort_cfg: dict = {'max_age':1, 'min_inits':3, 'iou_threshold':0.3},
10
- deepsort_cfg: dict = {'reid_ckpt': './deep_sort/deep/checkpoint/ckpt.t7', 'max_dist': 0.2, 'min_confidence': 0.3,
11
- 'nms_max_overlap': 0.5, 'max_iou_distance': 0.7, 'max_age': 70, 'n_init': 3, 'nn_budget': 100},
12
- gpu:bool=True):
14
+ class Tracker(object):
15
+ def __init__(self, cfg: dict = None, device:str='auto', half:bool=False):
13
16
  '''
14
-
17
+ Parameters:
18
+ cfg: dict - Configuration for tracking method
19
+ device: str - Device to run the tracking method, default is 'auto', 'cuda','cpu', 'mps'
20
+ half: bool - If True, use half precision for tracking, default is False
15
21
  '''
16
- self.method = method
17
- self.sort_cfg = sort_cfg
18
- self.dsort_cfg = deepsort_cfg
19
- self.gpu = gpu
22
+ if cfg is None:
23
+ self.cfg = Config.get_cfg_dsort()
24
+ else:
25
+ self.cfg = cfg
26
+ self.device = device
27
+ self.half = half
20
28
 
21
-
22
29
  def track(self, det_file:str, out_file:str, video_file:str=None, video_index:int=None, total_videos:int=None):
23
- if self.method == 'sort':
24
- track_sort(det_file, out_file, self.sort_cfg['max_age'], self.sort_cfg['min_inits'],
25
- self.sort_cfg['iou_threshold'], video_index, total_videos)
26
- elif self.method == 'dsort':
30
+ '''
31
+ Parameters:
32
+ - det_file: Detection file path
33
+ - out_file: Output track file path
34
+ - video_file: Video file path
35
+ - video_index: Index of video in the batch
36
+ - total_videos: Total number of videos in the batch
37
+ '''
38
+
39
+ if self.cfg['method'] == 'sort':
40
+ track_sort(det_file, out_file, self.cfg['max_age'], self.cfg['min_inits'],
41
+ self.cfg['iou_threshold'], video_index, total_videos)
42
+ elif self.cfg['method'] == 'dsort':
27
43
  if video_file:
28
- track_dsort(video_file=video_file, det_file=det_file, out_file=out_file, gpu=self.gpu, reid_ckpt = self.dsort_cfg['reid_ckpt'],
29
- max_dist=self.dsort_cfg['max_dist'], min_confidence=self.dsort_cfg['min_confidence'],
30
- nms_max_overlap=self.dsort_cfg['nms_max_overlap'], max_iou_distance=self.dsort_cfg['max_iou_distance'],
31
- max_age=self.dsort_cfg['max_age'], n_init=self.dsort_cfg['max_age'], nn_budget=self.dsort_cfg['nn_budget'],
44
+ track_dsort(video_file=video_file, det_file=det_file, out_file=out_file, device=self.device, half=self.half, cfg=self.cfg,
32
45
  video_index=video_index, total_videos=total_videos)
33
46
  else:
34
- print('Invalid video file for deep sort tracking!')
47
+ print('No video file exists!')
48
+ elif self.cfg['method'] == 'botsort':
49
+ track_botsort(video_file=video_file, det_file=det_file, out_file=out_file, cfg=self.cfg,
50
+ video_index=video_index, total_videos=total_videos)
35
51
  else:
36
52
  print('Invalid tracking method!')
37
53
 
@@ -56,7 +72,7 @@ class Tracker:
56
72
  continue
57
73
 
58
74
  video_file = None
59
- if self.method=="dsort":
75
+ if self.cfg['method']=="dsort":
60
76
  video_file = video_files[count-1]
61
77
 
62
78
  self.track(det_file=det_file, out_file=track_file, video_file=video_file, video_index=count, total_videos=total_videos)
@@ -64,17 +80,178 @@ class Tracker:
64
80
  results.append(track_file)
65
81
 
66
82
  return results
83
+
84
+ @staticmethod
85
+ def export_track_header():
86
+ return ['frame', 'track', 'x', 'y', 'w', 'h', 'score', 'cls', 'infill', 'cluster']
67
87
 
68
88
  @staticmethod
69
- def export_default_cfg(method:str = 'dsort'):
89
+ def infill_frames(tracks:pd.DataFrame, ids:list[int] = None, method:str='cubic', inplace:bool=True, info:str='',
90
+ video_index:int=None, video_tot:int=None, verbose:bool=True) -> pd.DataFrame:
70
91
  '''
71
- Export default tracking model configuration
92
+ Paramters:
93
+ - tracks: the track dataframe need to be fill
94
+ - ids: track ids need to be fill, if None, all ids will be processed
95
+ - method: interpolation method, 'cubic' (default), 'linear', 'nearest'
96
+ - inplace: if combine filled and raw frames in the output, default is True.
97
+ Return:
98
+ - A dataframe contains infilled frames (inplace=False), or infilled+raw (inplace=True)
72
99
  '''
73
- if method == 'sort':
74
- return {'max_age':1, 'min_inits':3, 'iou_threshold':0.3}
75
- elif method == 'dsort':
76
- return {'reid_ckpt': './deep_sort/deep/checkpoint/ckpt.t7', 'max_dist': 0.2, 'min_confidence': 0.3,
77
- 'nms_max_overlap': 0.5, 'max_iou_distance': 0.7, 'max_age': 70, 'n_init': 3, 'nn_budget': 100}
100
+ results = []
101
+
102
+ tracks.columns = Tracker.export_track_header()
103
+ if ids is None:
104
+ ids = tracks['track'].unique()
105
+
106
+ pbar = tqdm(total=len(ids), unit=' tracks')
107
+ if video_index and video_tot:
108
+ pbar.set_description_str("Infliing frames for {} tracks, {} of {}".format(info, video_index, video_tot))
78
109
  else:
79
- return None
110
+ pbar.set_description_str("Inflling frames for {} tracks".format(info))
111
+ for id in ids:
112
+ frames = tracks[tracks['track']==id].copy().sort_values(by='frame')
113
+ f_min = frames['frame'].min()
114
+ f_max = frames['frame'].max()
115
+
116
+ if (f_max-f_min+1) > len(frames):
117
+ raw_fids = frames['frame'].values.tolist()
118
+ missed_fids = Tracker.__find_missing_number(raw_fids)
119
+
120
+ raw_bboxes = frames[['x', 'y', 'w', 'h']].to_numpy()
121
+ infilled_bboxes = interpolate_bboxes(boxes = raw_bboxes, frames = np.array(raw_fids), target_frames=np.array(missed_fids),
122
+ method=method)
123
+
124
+ d = {'frame':missed_fids, 'track':id, 'x': infilled_bboxes[:,0], 'y':infilled_bboxes[:,1],
125
+ 'w':infilled_bboxes[:,2], 'h':infilled_bboxes[:,3], 'score':frames['score'].iloc[0],
126
+ 'cls':frames['cls'].iloc[0], 'infill':1, 'cluster':frames['cluster'].iloc[0]}
127
+ df = pd.DataFrame(d)
128
+ df = pd.concat([frames, df], ignore_index=True).sort_values(by='frame')
129
+ results.append(df)
130
+
131
+ if verbose:
132
+ pbar.update()
133
+
134
+ pbar.close()
135
+
136
+ if len(results)>0:
137
+ df = pd.concat(results, ignore_index=True)
138
+ if inplace:
139
+ df = pd.concat([tracks, df], ignore_index=True).sort_values(by=['frame', 'track'])
140
+ return df
141
+ else:
142
+ if inplace:
143
+ return tracks
144
+ else:
145
+ return None
146
+
147
+ @staticmethod
148
+ def cluster_frames(tracks:pd.DataFrame, ids:list[int] = None, gap_thres:int=100, keep_thres:int=25, inplace:bool=True,
149
+ video_index:int=None, video_tot:int=None, verbose:bool=True) -> pd.DataFrame:
150
+ '''
151
+ Paramters:
152
+ - tracks: a dataframe of tracks need to be clustered by empty frames
153
+ - ids: track ids need to be clustered, if None, all track ids
154
+ - gap_thres: if empty frames > gap_thres, the track will be cut-off, default is 100
155
+ - keep_thres: if the frames of a clustered track is >= keep_thres, the track will be kept, default is 25
156
+ - inplace: if combine filled and raw frames in the output, default is True.
157
+ Return:
158
+ - A dataframe contains infilled frames (inplace=False), or infilled+raw (inplace=True)
159
+ '''
160
+ results = []
161
+ del_ids = []
162
+
163
+ tracks.columns = Tracker.export_track_header()
164
+ if ids is None:
165
+ ids = tracks['track'].unique()
166
+ tracks_grouped = tracks.groupby('track')
167
+
168
+ id_index = max(ids)
169
+
170
+ pbar = tqdm(total=len(ids), unit=' track')
171
+ if video_index and video_tot:
172
+ pbar.set_description_str("Clustering frames {} of {}".format(video_index, video_tot))
173
+ else:
174
+ pbar.set_description_str("Clustering frames")
175
+ for id in ids:
176
+ #frames = tracks[tracks['track']==id].copy().sort_values(by='frame')
177
+ frames = tracks_grouped.get_group(id)
178
+ fids = frames['frame'].values
179
+ clusters = cluster_by_gap(fids, gap_thres)
180
+
181
+ if len(clusters) > 1:
182
+ for cluster in clusters:
183
+ frame_length = max(cluster) - min(cluster) + 1
184
+ if frame_length >= keep_thres:
185
+ #d = tracks[(tracks['track']==id) & (tracks['frame'].isin(cluster))].copy()
186
+ d = frames[frames['frame'].isin(cluster)].copy()
187
+ id_index += 1
188
+ d['track'] = id_index
189
+ d['cluster'] = id
190
+ results.append(d)
191
+ del_ids.append(id)
192
+
193
+ if verbose:
194
+ pbar.update()
195
+
196
+ pbar.close()
197
+
198
+ df = pd.concat(results, ignore_index=True)
199
+ if inplace:
200
+ tracks_del = tracks[~tracks['track'].isin(del_ids)].copy()
201
+ df = pd.concat([tracks_del, df], ignore_index=True).sort_values(by=['frame', 'track'])
202
+
203
+ return df
204
+
205
+ @staticmethod
206
+ def del_short_tracks(tracks:pd.DataFrame, keep_thres:int=25,
207
+ video_index:int=None, video_tot:int=None, verbose:bool=True) -> pd.DataFrame:
208
+ '''
209
+ Paramters:
210
+ - tracks: a dataframe of tracks need to be clustered by empty frames
211
+ - ids: track ids need to be clustered, if None, all track ids
212
+ - gap_thres: if empty frames > gap_thres, the track will be cut-off, default is 100
213
+ - keep_thres: if the frames of a clustered track is >= keep_thres, the track will be kept, default is 25
214
+ - inplace: if combine filled and raw frames in the output, default is True.
215
+
216
+ Return:
217
+ - A dataframe contains infilled frames (inplace=False), or infilled+raw (inplace=True)
218
+ '''
219
+ del_ids = []
220
+
221
+ tracks.columns = Tracker.export_track_header()
222
+ ids = tracks['track'].unique()
223
+ tracks_grouped = tracks.groupby('track')
224
+
225
+ pbar = tqdm(total=len(ids), unit=' track')
226
+ if video_index and video_tot:
227
+ pbar.set_description_str("Scan short tracks {} of {}".format(video_index, video_tot))
228
+ else:
229
+ pbar.set_description_str("Scan short tracks")
230
+ for id in ids:
231
+ frames = tracks_grouped.get_group(id)
232
+ #frames = tracks[tracks['track']==id].copy().sort_values(by='frame')
233
+ frame_max = max(frames['frame'].values)
234
+ frame_min = min(frames['frame'].values)
235
+ frame_length = frame_max - frame_min + 1
236
+ if frame_length < keep_thres:
237
+ del_ids.append(id)
238
+
239
+ if verbose:
240
+ pbar.update()
241
+ pbar.close()
242
+
243
+ tracks_del = tracks[~tracks['track'].isin(del_ids)].copy()
244
+ return tracks_del
245
+
246
+ @staticmethod
247
+ def __find_missing_number(arr: list[int]) -> list[int]:
248
+ full_set = set(range(min(arr), max(arr) + 1))
249
+ arr_set = set(arr)
250
+ missing_numbers = list(full_set - arr_set)
251
+ return missing_numbers
252
+
253
+
254
+
255
+
256
+
80
257
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dnt
3
- Version: 0.2.4
3
+ Version: 0.3.1.3
4
4
  Summary: A Python tool for video-based traffic analytiscs
5
5
  Home-page: https://its.cutr.usf.edu/dnt/
6
6
  Author: Zhenyu Wang
@@ -13,23 +13,43 @@ Classifier: License :: OSI Approved :: MIT License
13
13
  Classifier: Programming Language :: Python :: 3
14
14
  Requires-Python: >=3.9
15
15
  License-File: LICENSE
16
- Requires-Dist: numpy
17
- Requires-Dist: pandas
18
- Requires-Dist: matplotlib
19
16
  Requires-Dist: torch
20
17
  Requires-Dist: torchvision
21
18
  Requires-Dist: torchaudio
22
- Requires-Dist: ultralytics
19
+ Requires-Dist: ultralytics >=8.2
20
+ Requires-Dist: cython
21
+ Requires-Dist: cython-bbox
23
22
  Requires-Dist: easydict
23
+ Requires-Dist: faiss-cpu
24
+ Requires-Dist: faiss-gpu
24
25
  Requires-Dist: filterpy
26
+ Requires-Dist: gdown
27
+ Requires-Dist: geopandas
28
+ Requires-Dist: h5py
29
+ Requires-Dist: lap
30
+ Requires-Dist: loguru
31
+ Requires-Dist: matplotlib
32
+ Requires-Dist: motmetrics
33
+ Requires-Dist: ninja
34
+ Requires-Dist: numpy
25
35
  Requires-Dist: numpy-indexed
26
- Requires-Dist: opencv-python
27
36
  Requires-Dist: opencv-contrib-python
28
- Requires-Dist: geopandas
29
- Requires-Dist: shapely
30
- Requires-Dist: scipy
31
- Requires-Dist: scikit-learn
37
+ Requires-Dist: opencv-python
38
+ Requires-Dist: pandas
39
+ Requires-Dist: Pillow
40
+ Requires-Dist: prettytable
41
+ Requires-Dist: pycocotools
42
+ Requires-Dist: pyyaml
32
43
  Requires-Dist: scikit-image
44
+ Requires-Dist: scikit-learn
45
+ Requires-Dist: scipy
46
+ Requires-Dist: shapely
47
+ Requires-Dist: sympy
48
+ Requires-Dist: tabulate
49
+ Requires-Dist: tensorboard
50
+ Requires-Dist: termcolor
51
+ Requires-Dist: thop
33
52
  Requires-Dist: tqdm
34
53
  Requires-Dist: vidgear
54
+ Requires-Dist: yacs
35
55