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
dnt/engine/iob.py ADDED
@@ -0,0 +1,66 @@
1
+ import numpy as np
2
+
3
+ def iob(box_a:np.ndarray, box_b:np.ndarray)->tuple:
4
+ """
5
+ Calculate the Intersection over Box (IoB) between two bounding boxes.
6
+
7
+ Parameters:
8
+ box_a -- numpy arrays of shape (4,) containing [l, t, w, h]
9
+ box_b -- numpy arrays of shape (4,) containing [l, t, w, h], target bounding box
10
+
11
+ Returns:
12
+ iob, iob -- float, the IoB values for box_a and box_b
13
+ """
14
+ # Determine the (x, y)-coordinates of the intersection rectangle
15
+ x_l = max(box_a[0], box_b[0])
16
+ y_t = max(box_a[1], box_b[1])
17
+ x_r = min(box_a[0]+box_a[2], box_b[0]+box_b[2])
18
+ y_b = min(box_a[1]+box_a[3], box_b[1]+box_b[3])
19
+
20
+ # Compute the area of intersection rectangle
21
+ inter_width = max(0, x_r - x_l)
22
+ inter_height = max(0, y_b - y_t)
23
+ inter_area = inter_width * inter_height
24
+
25
+ # Compute the area of both the prediction and ground-truth rectangles
26
+ box_a_area = box_a[2] * box_a[3]
27
+ box_b_area = box_b[2] * box_b[3]
28
+
29
+ # Compute the intersection over union by taking the intersection area and dividing it by the sum of prediction + ground-truth areas - the intersection area
30
+ iob_a = inter_area / box_a_area if box_a_area != 0 else 0.0
31
+ iob_b = inter_area / box_b_area if box_b_area != 0 else 0.0
32
+
33
+ return iob_a, iob_b
34
+
35
+ def iobs(alrbs:np.ndarray, blrbs:np.ndarray)->np.ndarray:
36
+ """
37
+ Calculate the IoU matrix for multiple bounding boxes.
38
+
39
+ Parameters:
40
+ boxes -- numpy array of shape (N, 4), where N is the number of boxes, and each row is [x1, y1, x2, y2]
41
+
42
+ Returns:
43
+ iou_matrix -- numpy array of shape (N, N), where iou_matrix[i, j] is the IoU between boxes[i] and boxes[j]
44
+ """
45
+ num_a = alrbs.shape[0]
46
+ num_b = blrbs.shape[0]
47
+ iobs_a = np.zeros((num_a, num_b))
48
+ iobs_b = np.zeros((num_a, num_b))
49
+
50
+ for i in range(num_a):
51
+ for j in range(num_b):
52
+ iobs_a[i, j], iobs_b[i, j] = iob(alrbs[i,:], blrbs[j,:])
53
+
54
+ return iobs_a, iobs_b
55
+
56
+ if __name__ == '__main__':
57
+ # Example usage
58
+ boxes = np.array([
59
+ [0, 0, 1, 1],
60
+ [0.5, 0.5, 1.5, 1.5],
61
+ [1, 1, 2, 2]
62
+ ])
63
+
64
+ matrix_a, matrix_b = iobs(boxes, boxes)
65
+ print(matrix_a)
66
+ print(matrix_b)
dnt/filter/filter.py CHANGED
@@ -1,5 +1,5 @@
1
1
  import pandas as pd
2
- from shapely import geometry, LineString, Polygon
2
+ from shapely import geometry, LineString, Polygon, Point
3
3
  import geopandas as gpd
4
4
  from tqdm import tqdm
5
5
 
@@ -78,6 +78,245 @@ class Filter:
78
78
 
79
79
  return results
80
80
 
81
+ @staticmethod
82
+ def filter_tracks_by_zones_agg(tracks:pd.DataFrame,
83
+ zones: geometry.MultiPolygon = None,
84
+ method: str = 'include',
85
+ ref_point: str = 'bc',
86
+ offset: tuple = (0, 0),
87
+ col_names = ['frame', 'track', 'x', 'y', 'w', 'h', 'score', 'cls', 'r3', 'r4'],
88
+ video_index:int = None, video_tot:int = None)->pd.DataFrame:
89
+ '''
90
+ Filter tracks by zones.
91
+ Inputs:
92
+ tracks: tracks
93
+ zones: a list of polygons
94
+ method - 'include' (default), 'exclude'
95
+ ref_point - the reference point of a track bbox,
96
+ defalt is br, others - bl, bc, tl, tc, tr, cl, cc, cr
97
+ offset - the offset to ref_point, default is (0, 0)
98
+ video_index - video index
99
+ video_tot - total videos
100
+ Return:
101
+ Filtered tracks
102
+ '''
103
+
104
+ try:
105
+ tracks.columns = col_names
106
+ except:
107
+ print('Tracks is invalid!')
108
+
109
+ if ref_point == 'cc':
110
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + tracks['h']/2 + offset[1]))]
111
+ elif ref_point == 'tc':
112
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + offset[1]))]
113
+ elif ref_point == 'bc':
114
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
115
+ elif ref_point == 'cl':
116
+ g = [Point(xy) for xy in zip((tracks['x'] + offset[0]), (tracks['y'] + tracks['h']/2 + offset[1]))]
117
+ elif ref_point == 'cr':
118
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w'] + offset[0]), (tracks['y'] + tracks['h']/2 + offset[1]))]
119
+ elif ref_point == 'tl':
120
+ g = [Point(xy) for xy in zip((tracks['x'] + offset[0]), (tracks['y'] + offset[1]))]
121
+ elif ref_point == 'tr':
122
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w'] + offset[0]), (tracks['y'] + offset[1]))]
123
+ elif ref_point == 'bl':
124
+ g = [Point(xy) for xy in zip((tracks['x'] + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
125
+ elif ref_point == 'br':
126
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w'] + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
127
+ else:
128
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
129
+
130
+ geo_tracks = gpd.GeoDataFrame(tracks, geometry=g)
131
+
132
+ matched_ids = []
133
+ pbar = tqdm(total=len(zones), unit=' zones')
134
+ if video_index and video_tot:
135
+ pbar.set_description_str("Filtering zones {} of {}".format(video_index, video_tot))
136
+ else:
137
+ pbar.set_description_str("Filtering zones ")
138
+
139
+ for zone in zones:
140
+ matched = geo_tracks[geo_tracks.geometry.within(zone)]
141
+ if len(matched)>0:
142
+ matched_ids.extend(matched['track'].unique().tolist())
143
+ pbar.update()
144
+
145
+ pbar.close()
146
+
147
+ if len(matched_ids)>0:
148
+ if method == 'include':
149
+ results = tracks.loc[tracks['track'].isin(matched_ids)].copy()
150
+ else:
151
+ results = tracks.loc[~tracks['track'].isin(matched_ids)].copy()
152
+ else:
153
+ results = tracks.copy()
154
+
155
+ return results
156
+
157
+ @staticmethod
158
+ def filter_frames_by_zones_agg(tracks:pd.DataFrame,
159
+ zones: geometry.MultiPolygon = None,
160
+ method: str = 'include',
161
+ ref_point:str = 'bc',
162
+ offset: tuple = (0, 0),
163
+ col_names = ['frame', 'track', 'x', 'y', 'w', 'h', 'score', 'cls', 'r3', 'r4'],
164
+ video_index:int = None, video_tot:int = None)->pd.DataFrame:
165
+ '''
166
+ Filter tracks by zones.
167
+ Inputs:
168
+ tracks - tracks
169
+ zones - zones (polygon)
170
+ method - 'include' (default) include the tracks if they are within the zones; 'exclude' exclude the tracks if they are within the zones
171
+ ref_point - the reference point of a track bbox, defalt is bottom_point, center_point, left_up, right_up, left_buttom, right_buttom
172
+ offset - the offset to ref_point, default is (0, 0)
173
+ video_index - video index
174
+ video_tot - total videos
175
+ Return:
176
+ Filtered tracks
177
+ '''
178
+
179
+ try:
180
+ tracks.columns = col_names
181
+ except:
182
+ print('Tracks is invalid!')
183
+
184
+ if ref_point == 'cc':
185
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + tracks['h']/2 + offset[1]))]
186
+ elif ref_point == 'tc':
187
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + offset[1]))]
188
+ elif ref_point == 'bc':
189
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
190
+ elif ref_point == 'cl':
191
+ g = [Point(xy) for xy in zip((tracks['x'] + offset[0]), (tracks['y'] + tracks['h']/2 + offset[1]))]
192
+ elif ref_point == 'cr':
193
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w'] + offset[0]), (tracks['y'] + tracks['h']/2 + offset[1]))]
194
+ elif ref_point == 'tl':
195
+ g = [Point(xy) for xy in zip((tracks['x'] + offset[0]), (tracks['y'] + offset[1]))]
196
+ elif ref_point == 'tr':
197
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w'] + offset[0]), (tracks['y'] + offset[1]))]
198
+ elif ref_point == 'bl':
199
+ g = [Point(xy) for xy in zip((tracks['x'] + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
200
+ elif ref_point == 'br':
201
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w'] + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
202
+ else:
203
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
204
+
205
+
206
+ geo_tracks = gpd.GeoDataFrame(tracks, geometry=g)
207
+
208
+ matched_frames = []
209
+ pbar = tqdm(total=len(zones), unit=' zones')
210
+ if video_index and video_tot:
211
+ pbar.set_description_str("Filtering zones {} of {}".format(video_index, video_tot))
212
+ else:
213
+ pbar.set_description_str("Filtering zones ")
214
+
215
+ for zone in zones:
216
+ matched = geo_tracks[geo_tracks.geometry.within(zone)]
217
+ if len(matched)>0:
218
+ matched_frames.extend(matched.index.values.tolist())
219
+ pbar.update()
220
+
221
+ pbar.close()
222
+
223
+ if len(matched_frames)>0:
224
+ if method == 'include':
225
+ results = tracks.iloc[matched_frames].copy()
226
+ else:
227
+ results = tracks.drop(matched_frames, axis=0).copy()
228
+ else:
229
+ results = tracks.copy()
230
+
231
+ return results
232
+
233
+ @staticmethod
234
+ def filter_tracks_by_zones(tracks:pd.DataFrame,
235
+ zones: geometry.MultiPolygon = None,
236
+ method: str = 'list',
237
+ ref_point: str = 'bc',
238
+ offset: tuple = (0, 0),
239
+ col_names = ['frame', 'track', 'x', 'y', 'w', 'h', 'score', 'cls', 'r3', 'r4'],
240
+ zone_name: str = 'zone',
241
+ video_index:int = None, video_tot:int = None)->pd.DataFrame:
242
+ '''
243
+ Filter tracks by zones.
244
+ Inputs:
245
+ tracks - tracks
246
+ zones - zones (polygon)
247
+ method - 'list' (default), 'filter', 'label'
248
+ ref_point - the reference point of a track bbox,
249
+ br - buttom_right, center_point,
250
+ left_up, right_up, left_buttom, right_buttom
251
+ offset - the offset to ref_point, default is (0, 0)
252
+ aggregate - combine outputs to one dataframe, add zone column
253
+ zone_name - if aggregate, the field name of zone variable, default is 'zone'
254
+ video_index - video index
255
+ video_tot - total videos
256
+ Return:
257
+ Filtered tracks
258
+ '''
259
+
260
+ try:
261
+ tracks.columns = col_names
262
+ except:
263
+ print('Tracks is invalid!')
264
+
265
+ if ref_point == 'cc':
266
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + tracks['h']/2 + offset[1]))]
267
+ elif ref_point == 'tc':
268
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + offset[1]))]
269
+ elif ref_point == 'bc':
270
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
271
+ elif ref_point == 'cl':
272
+ g = [Point(xy) for xy in zip((tracks['x'] + offset[0]), (tracks['y'] + tracks['h']/2 + offset[1]))]
273
+ elif ref_point == 'cr':
274
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w'] + offset[0]), (tracks['y'] + tracks['h']/2 + offset[1]))]
275
+ elif ref_point == 'tl':
276
+ g = [Point(xy) for xy in zip((tracks['x'] + offset[0]), (tracks['y'] + offset[1]))]
277
+ elif ref_point == 'tr':
278
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w'] + offset[0]), (tracks['y'] + offset[1]))]
279
+ elif ref_point == 'bl':
280
+ g = [Point(xy) for xy in zip((tracks['x'] + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
281
+ elif ref_point == 'br':
282
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w'] + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
283
+ else:
284
+ g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
285
+
286
+ geo_tracks = gpd.GeoDataFrame(tracks, geometry=g)
287
+
288
+ matched_ids = []
289
+ pbar = tqdm(total=len(zones), unit=' zones')
290
+ if video_index and video_tot:
291
+ pbar.set_description_str("Filtering zones {} of {}".format(video_index, video_tot))
292
+ else:
293
+ pbar.set_description_str("Filtering zones ")
294
+
295
+ for zone in zones:
296
+ matched = geo_tracks[geo_tracks.geometry.within(zone)]
297
+ if len(matched)>0:
298
+ matched_ids.append(matched['track'].unique().tolist())
299
+ pbar.update()
300
+
301
+ pbar.close()
302
+
303
+ if (method == 'filter') or (method == 'label'):
304
+ tracks[zone_name] = -1
305
+ for i in range(len(matched_ids)):
306
+ tracks.loc[tracks['track'].isin(matched_ids[i]), zone_name] = i
307
+ if method == 'filter':
308
+ results = tracks[tracks['zone']!=-1].copy()
309
+ else:
310
+ results = tracks
311
+ else:
312
+ results = []
313
+ if len(matched_ids)>0:
314
+ for i in range(len(matched_ids)):
315
+ result = tracks.loc[tracks['track'].isin(matched_ids[i])].copy()
316
+ results.append(result)
317
+
318
+ return results
319
+
81
320
  @staticmethod
82
321
  def filter_tracks_by_lines(tracks:pd.DataFrame,
83
322
  lines: list[LineString]= None,
@@ -129,6 +368,87 @@ class Filter:
129
368
  results.sort_values(by=[0, 1], inplace=True)
130
369
  return results
131
370
 
371
+ @staticmethod
372
+ def filter_tracks_by_lines_v2(tracks:pd.DataFrame,
373
+ lines: list[LineString]= None,
374
+ method: str = 'include',
375
+ tolerance: int = 0,
376
+ bbox_size: int = 0,
377
+ force_line_indexes: list[int] = None,
378
+ video_index:int = None, video_tot:int = None) -> pd.DataFrame:
379
+ '''
380
+ Filter tracks by lines
381
+ Inputs:
382
+ tracks - a DataFrame of tracks, [FRAME, TRACK_ID, TOPX, TOPY, WIDTH, LENGTH, RESERVED, RESERVED, RESERVED]
383
+ lines - a list of LineString
384
+ method - filtering method, include (default) - including tracks crossing the lines, exclude - exclude tracks crossing the lines
385
+ tolerance - if a bbox intesect the reference lines of (number of lanes - tolerance), it is hit. default is 0.
386
+ force_line_indexes: the line indexes that a bbox must intersect for matching
387
+ bbox_size - the size of detection bbox, default is 0 - the orginal bbox
388
+ video_index - the index of video for processing
389
+ video_tot - the total number of videos
390
+ Return:
391
+ a DataFrame of [FRAME, TRACK_ID, TOPX, TOPY, WIDTH, LENGTH, RESERVED, RESERVED, RESERVED]
392
+ '''
393
+ tracks.columns = ['frame', 'track', 'x', 'y', 'w', 'h', 'score', 'cls', 'r3', 'r4']
394
+ track_ids = tracks['track'].unique()
395
+ ids = []
396
+
397
+ # set hit criterion
398
+ hit_criterion = len(lines) - tolerance
399
+ if (hit_criterion < 1) or (hit_criterion > len(lines)):
400
+ hit_criterion = len(lines)
401
+
402
+ pbar = tqdm(total=len(track_ids), unit=' tracks')
403
+ if video_index and video_tot:
404
+ pbar.set_description_str("Filtering tracks {} of {}".format(video_index, video_tot))
405
+ else:
406
+ pbar.set_description_str("Filtering tracks ")
407
+
408
+ for track_id in track_ids:
409
+ selected = tracks.loc[(tracks['track']==track_id)].copy()
410
+ hit_cnt = 0
411
+ hit_force = True
412
+ if len(selected)>0:
413
+ if bbox_size == 0:
414
+ g = selected.apply(lambda track: Polygon([(track['x'], track['y']), (track['x'] + track['w'], track['y']),
415
+ (track['x'] + track['w'], track['y'] + track['h']), (track['x'], track['y'] + track['h'])]), axis =1)
416
+ else:
417
+ g = selected.apply(lambda track: Polygon([
418
+ (track['x'] + track['w']/2 - bbox_size, track['y'] + track['h'] - bbox_size),
419
+ (track['x'] + track['w']/2 + bbox_size, track['y'] + track['h'] - bbox_size),
420
+ (track['x'] + track['w']/2 + bbox_size, track['y'] + track['h']),
421
+ (track['x'] + track['w']/2 - bbox_size, track['y'] + track['h'])
422
+ ]), axis =1)
423
+
424
+ for line in lines:
425
+ if any(line.intersects(g).values.tolist()):
426
+ hit_cnt+=1
427
+
428
+ if force_line_indexes is not None:
429
+ force_lines = [lines[i] for i in force_line_indexes]
430
+ for line in force_lines:
431
+ if any(line.intersects(g).values.tolist()):
432
+ hit_force = True
433
+ else:
434
+ hit_force = False
435
+
436
+ if (hit_cnt >= hit_criterion) and (hit_force == True):
437
+ ids.append(track_id)
438
+
439
+ pbar.update()
440
+
441
+ pbar.close()
442
+
443
+ results = []
444
+ if method=='include':
445
+ results = tracks.loc[tracks['track'].isin(ids)].copy()
446
+ elif method=='exclude':
447
+ results = tracks.loc[~tracks['track'].isin(ids)].copy()
448
+
449
+ results.sort_values(by=['frame', 'track'], inplace=True)
450
+ return results
451
+
132
452
  if __name__=='__main__':
133
453
  pass
134
454
 
dnt/label/labeler.py CHANGED
@@ -84,19 +84,19 @@ class Labeler:
84
84
  color = element['color']
85
85
  size = element['size']
86
86
  thick = element['thick']
87
- cv2.putText(frame, label_txt, element['coords'][0], 0, size, color, thick)
87
+ cv2.putText(frame, label_txt, tuple(map(int, element['coords'][0])), 0, size, color, thick)
88
88
 
89
89
  elif element['type'] == 'line':
90
90
  coords = element['coords']
91
91
  color = element['color']
92
92
  thick = element['thick']
93
- cv2.line(frame, coords[0], coords[1], color, thick)
93
+ cv2.line(frame, tuple(map(int, coords[0])), tuple(map(int, coords[1])), color, thick)
94
94
 
95
95
  elif element['type'] == 'box':
96
96
  coords = element['coords']
97
97
  color = element['color']
98
98
  thick = element['thick']
99
- cv2.rectangle(frame, coords[0], coords[1], color, thick)
99
+ cv2.rectangle(frame, tuple(map(int, coords[0])), tuple(map(int, coords[1])), color, thick)
100
100
 
101
101
  elif element['type'] == 'bbox':
102
102
  coords = element['coords']
@@ -105,7 +105,7 @@ class Labeler:
105
105
  label_txt = element['desc']
106
106
  size = element['size']
107
107
 
108
- cv2.rectangle(frame, coords[0], coords[1], color, thick)
108
+ cv2.rectangle(frame, tuple(map(int, coords[0])), tuple(map(int, coords[1])), color, thick)
109
109
  cv2.putText(frame, str(label_txt), (int(coords[0][0]), int(coords[0][1]-int(10*size))),
110
110
  cv2.FONT_HERSHEY_SIMPLEX, size, color, thick)
111
111