dnt 0.2.4__py3-none-any.whl → 0.3.1.7__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 (311) hide show
  1. dnt/__init__.py +3 -2
  2. dnt/analysis/__init__.py +3 -2
  3. dnt/analysis/count.py +54 -37
  4. dnt/analysis/interaction2.py +518 -0
  5. dnt/analysis/stop.py +22 -17
  6. dnt/analysis/stop2.py +289 -0
  7. dnt/analysis/stop3.py +758 -0
  8. dnt/detect/signal/detector.py +326 -0
  9. dnt/detect/timestamp.py +105 -0
  10. dnt/detect/yolov8/detector.py +179 -36
  11. dnt/detect/yolov8/segmentor.py +60 -2
  12. dnt/engine/__init__.py +8 -0
  13. dnt/engine/bbox_interp.py +83 -0
  14. dnt/engine/bbox_iou.py +20 -0
  15. dnt/engine/cluster.py +31 -0
  16. dnt/engine/iob.py +66 -0
  17. dnt/filter/filter.py +333 -2
  18. dnt/label/labeler.py +4 -4
  19. dnt/label/labeler2.py +605 -0
  20. dnt/shared/__init__.py +2 -1
  21. dnt/shared/data/coco.names +0 -0
  22. dnt/shared/data/openimages.names +0 -0
  23. dnt/shared/data/voc.names +0 -0
  24. dnt/shared/download.py +12 -0
  25. dnt/shared/synhcro.py +150 -0
  26. dnt/shared/util.py +17 -4
  27. dnt/third_party/fast-reid/__init__.py +1 -0
  28. dnt/third_party/fast-reid/configs/Base-AGW.yml +19 -0
  29. dnt/third_party/fast-reid/configs/Base-MGN.yml +12 -0
  30. dnt/third_party/fast-reid/configs/Base-SBS.yml +63 -0
  31. dnt/third_party/fast-reid/configs/Base-bagtricks.yml +76 -0
  32. dnt/third_party/fast-reid/configs/DukeMTMC/AGW_R101-ibn.yml +12 -0
  33. dnt/third_party/fast-reid/configs/DukeMTMC/AGW_R50-ibn.yml +11 -0
  34. dnt/third_party/fast-reid/configs/DukeMTMC/AGW_R50.yml +7 -0
  35. dnt/third_party/fast-reid/configs/DukeMTMC/AGW_S50.yml +11 -0
  36. dnt/third_party/fast-reid/configs/DukeMTMC/bagtricks_R101-ibn.yml +12 -0
  37. dnt/third_party/fast-reid/configs/DukeMTMC/bagtricks_R50-ibn.yml +11 -0
  38. dnt/third_party/fast-reid/configs/DukeMTMC/bagtricks_R50.yml +7 -0
  39. dnt/third_party/fast-reid/configs/DukeMTMC/bagtricks_S50.yml +11 -0
  40. dnt/third_party/fast-reid/configs/DukeMTMC/mgn_R50-ibn.yml +11 -0
  41. dnt/third_party/fast-reid/configs/DukeMTMC/sbs_R101-ibn.yml +12 -0
  42. dnt/third_party/fast-reid/configs/DukeMTMC/sbs_R50-ibn.yml +11 -0
  43. dnt/third_party/fast-reid/configs/DukeMTMC/sbs_R50.yml +7 -0
  44. dnt/third_party/fast-reid/configs/DukeMTMC/sbs_S50.yml +11 -0
  45. dnt/third_party/fast-reid/configs/MOT17/AGW_R101-ibn.yml +12 -0
  46. dnt/third_party/fast-reid/configs/MOT17/AGW_R50-ibn.yml +11 -0
  47. dnt/third_party/fast-reid/configs/MOT17/AGW_R50.yml +7 -0
  48. dnt/third_party/fast-reid/configs/MOT17/AGW_S50.yml +11 -0
  49. dnt/third_party/fast-reid/configs/MOT17/bagtricks_R101-ibn.yml +12 -0
  50. dnt/third_party/fast-reid/configs/MOT17/bagtricks_R50-ibn.yml +11 -0
  51. dnt/third_party/fast-reid/configs/MOT17/bagtricks_R50.yml +7 -0
  52. dnt/third_party/fast-reid/configs/MOT17/bagtricks_S50.yml +11 -0
  53. dnt/third_party/fast-reid/configs/MOT17/mgn_R50-ibn.yml +11 -0
  54. dnt/third_party/fast-reid/configs/MOT17/sbs_R101-ibn.yml +12 -0
  55. dnt/third_party/fast-reid/configs/MOT17/sbs_R50-ibn.yml +11 -0
  56. dnt/third_party/fast-reid/configs/MOT17/sbs_R50.yml +7 -0
  57. dnt/third_party/fast-reid/configs/MOT17/sbs_S50.yml +11 -0
  58. dnt/third_party/fast-reid/configs/MOT20/AGW_R101-ibn.yml +12 -0
  59. dnt/third_party/fast-reid/configs/MOT20/AGW_R50-ibn.yml +11 -0
  60. dnt/third_party/fast-reid/configs/MOT20/AGW_R50.yml +7 -0
  61. dnt/third_party/fast-reid/configs/MOT20/AGW_S50.yml +11 -0
  62. dnt/third_party/fast-reid/configs/MOT20/bagtricks_R101-ibn.yml +12 -0
  63. dnt/third_party/fast-reid/configs/MOT20/bagtricks_R50-ibn.yml +11 -0
  64. dnt/third_party/fast-reid/configs/MOT20/bagtricks_R50.yml +7 -0
  65. dnt/third_party/fast-reid/configs/MOT20/bagtricks_S50.yml +11 -0
  66. dnt/third_party/fast-reid/configs/MOT20/mgn_R50-ibn.yml +11 -0
  67. dnt/third_party/fast-reid/configs/MOT20/sbs_R101-ibn.yml +12 -0
  68. dnt/third_party/fast-reid/configs/MOT20/sbs_R50-ibn.yml +11 -0
  69. dnt/third_party/fast-reid/configs/MOT20/sbs_R50.yml +7 -0
  70. dnt/third_party/fast-reid/configs/MOT20/sbs_S50.yml +11 -0
  71. dnt/third_party/fast-reid/configs/MSMT17/AGW_R101-ibn.yml +12 -0
  72. dnt/third_party/fast-reid/configs/MSMT17/AGW_R50-ibn.yml +11 -0
  73. dnt/third_party/fast-reid/configs/MSMT17/AGW_R50.yml +7 -0
  74. dnt/third_party/fast-reid/configs/MSMT17/AGW_S50.yml +11 -0
  75. dnt/third_party/fast-reid/configs/MSMT17/bagtricks_R101-ibn.yml +13 -0
  76. dnt/third_party/fast-reid/configs/MSMT17/bagtricks_R50-ibn.yml +12 -0
  77. dnt/third_party/fast-reid/configs/MSMT17/bagtricks_R50.yml +7 -0
  78. dnt/third_party/fast-reid/configs/MSMT17/bagtricks_S50.yml +12 -0
  79. dnt/third_party/fast-reid/configs/MSMT17/mgn_R50-ibn.yml +11 -0
  80. dnt/third_party/fast-reid/configs/MSMT17/sbs_R101-ibn.yml +12 -0
  81. dnt/third_party/fast-reid/configs/MSMT17/sbs_R50-ibn.yml +11 -0
  82. dnt/third_party/fast-reid/configs/MSMT17/sbs_R50.yml +7 -0
  83. dnt/third_party/fast-reid/configs/MSMT17/sbs_S50.yml +11 -0
  84. dnt/third_party/fast-reid/configs/Market1501/AGW_R101-ibn.yml +12 -0
  85. dnt/third_party/fast-reid/configs/Market1501/AGW_R50-ibn.yml +11 -0
  86. dnt/third_party/fast-reid/configs/Market1501/AGW_R50.yml +7 -0
  87. dnt/third_party/fast-reid/configs/Market1501/AGW_S50.yml +11 -0
  88. dnt/third_party/fast-reid/configs/Market1501/bagtricks_R101-ibn.yml +12 -0
  89. dnt/third_party/fast-reid/configs/Market1501/bagtricks_R50-ibn.yml +11 -0
  90. dnt/third_party/fast-reid/configs/Market1501/bagtricks_R50.yml +7 -0
  91. dnt/third_party/fast-reid/configs/Market1501/bagtricks_S50.yml +11 -0
  92. dnt/third_party/fast-reid/configs/Market1501/bagtricks_vit.yml +88 -0
  93. dnt/third_party/fast-reid/configs/Market1501/mgn_R50-ibn.yml +11 -0
  94. dnt/third_party/fast-reid/configs/Market1501/sbs_R101-ibn.yml +12 -0
  95. dnt/third_party/fast-reid/configs/Market1501/sbs_R50-ibn.yml +11 -0
  96. dnt/third_party/fast-reid/configs/Market1501/sbs_R50.yml +7 -0
  97. dnt/third_party/fast-reid/configs/Market1501/sbs_S50.yml +11 -0
  98. dnt/third_party/fast-reid/configs/VERIWild/bagtricks_R50-ibn.yml +35 -0
  99. dnt/third_party/fast-reid/configs/VeRi/sbs_R50-ibn.yml +35 -0
  100. dnt/third_party/fast-reid/configs/VehicleID/bagtricks_R50-ibn.yml +36 -0
  101. dnt/third_party/fast-reid/configs/__init__.py +0 -0
  102. dnt/third_party/fast-reid/fast_reid_interfece.py +175 -0
  103. dnt/third_party/fast-reid/fastreid/__init__.py +6 -0
  104. dnt/third_party/fast-reid/fastreid/config/__init__.py +15 -0
  105. dnt/third_party/fast-reid/fastreid/config/config.py +319 -0
  106. dnt/third_party/fast-reid/fastreid/config/defaults.py +329 -0
  107. dnt/third_party/fast-reid/fastreid/data/__init__.py +17 -0
  108. dnt/third_party/fast-reid/fastreid/data/build.py +194 -0
  109. dnt/third_party/fast-reid/fastreid/data/common.py +58 -0
  110. dnt/third_party/fast-reid/fastreid/data/data_utils.py +202 -0
  111. dnt/third_party/fast-reid/fastreid/data/datasets/AirportALERT.py +50 -0
  112. dnt/third_party/fast-reid/fastreid/data/datasets/__init__.py +43 -0
  113. dnt/third_party/fast-reid/fastreid/data/datasets/bases.py +183 -0
  114. dnt/third_party/fast-reid/fastreid/data/datasets/caviara.py +44 -0
  115. dnt/third_party/fast-reid/fastreid/data/datasets/cuhk03.py +274 -0
  116. dnt/third_party/fast-reid/fastreid/data/datasets/cuhk_sysu.py +58 -0
  117. dnt/third_party/fast-reid/fastreid/data/datasets/dukemtmcreid.py +70 -0
  118. dnt/third_party/fast-reid/fastreid/data/datasets/grid.py +44 -0
  119. dnt/third_party/fast-reid/fastreid/data/datasets/iLIDS.py +45 -0
  120. dnt/third_party/fast-reid/fastreid/data/datasets/lpw.py +49 -0
  121. dnt/third_party/fast-reid/fastreid/data/datasets/market1501.py +89 -0
  122. dnt/third_party/fast-reid/fastreid/data/datasets/msmt17.py +114 -0
  123. dnt/third_party/fast-reid/fastreid/data/datasets/pes3d.py +44 -0
  124. dnt/third_party/fast-reid/fastreid/data/datasets/pku.py +44 -0
  125. dnt/third_party/fast-reid/fastreid/data/datasets/prai.py +43 -0
  126. dnt/third_party/fast-reid/fastreid/data/datasets/prid.py +41 -0
  127. dnt/third_party/fast-reid/fastreid/data/datasets/saivt.py +47 -0
  128. dnt/third_party/fast-reid/fastreid/data/datasets/sensereid.py +47 -0
  129. dnt/third_party/fast-reid/fastreid/data/datasets/shinpuhkan.py +48 -0
  130. dnt/third_party/fast-reid/fastreid/data/datasets/sysu_mm.py +47 -0
  131. dnt/third_party/fast-reid/fastreid/data/datasets/thermalworld.py +43 -0
  132. dnt/third_party/fast-reid/fastreid/data/datasets/vehicleid.py +126 -0
  133. dnt/third_party/fast-reid/fastreid/data/datasets/veri.py +69 -0
  134. dnt/third_party/fast-reid/fastreid/data/datasets/veriwild.py +140 -0
  135. dnt/third_party/fast-reid/fastreid/data/datasets/viper.py +45 -0
  136. dnt/third_party/fast-reid/fastreid/data/datasets/wildtracker.py +59 -0
  137. dnt/third_party/fast-reid/fastreid/data/samplers/__init__.py +18 -0
  138. dnt/third_party/fast-reid/fastreid/data/samplers/data_sampler.py +85 -0
  139. dnt/third_party/fast-reid/fastreid/data/samplers/imbalance_sampler.py +67 -0
  140. dnt/third_party/fast-reid/fastreid/data/samplers/triplet_sampler.py +260 -0
  141. dnt/third_party/fast-reid/fastreid/data/transforms/__init__.py +11 -0
  142. dnt/third_party/fast-reid/fastreid/data/transforms/autoaugment.py +806 -0
  143. dnt/third_party/fast-reid/fastreid/data/transforms/build.py +100 -0
  144. dnt/third_party/fast-reid/fastreid/data/transforms/functional.py +180 -0
  145. dnt/third_party/fast-reid/fastreid/data/transforms/transforms.py +161 -0
  146. dnt/third_party/fast-reid/fastreid/engine/__init__.py +15 -0
  147. dnt/third_party/fast-reid/fastreid/engine/defaults.py +490 -0
  148. dnt/third_party/fast-reid/fastreid/engine/hooks.py +534 -0
  149. dnt/third_party/fast-reid/fastreid/engine/launch.py +103 -0
  150. dnt/third_party/fast-reid/fastreid/engine/train_loop.py +357 -0
  151. dnt/third_party/fast-reid/fastreid/evaluation/__init__.py +6 -0
  152. dnt/third_party/fast-reid/fastreid/evaluation/clas_evaluator.py +81 -0
  153. dnt/third_party/fast-reid/fastreid/evaluation/evaluator.py +176 -0
  154. dnt/third_party/fast-reid/fastreid/evaluation/query_expansion.py +46 -0
  155. dnt/third_party/fast-reid/fastreid/evaluation/rank.py +200 -0
  156. dnt/third_party/fast-reid/fastreid/evaluation/rank_cylib/__init__.py +20 -0
  157. dnt/third_party/fast-reid/fastreid/evaluation/rank_cylib/setup.py +32 -0
  158. dnt/third_party/fast-reid/fastreid/evaluation/rank_cylib/test_cython.py +106 -0
  159. dnt/third_party/fast-reid/fastreid/evaluation/reid_evaluation.py +143 -0
  160. dnt/third_party/fast-reid/fastreid/evaluation/rerank.py +73 -0
  161. dnt/third_party/fast-reid/fastreid/evaluation/roc.py +90 -0
  162. dnt/third_party/fast-reid/fastreid/evaluation/testing.py +88 -0
  163. dnt/third_party/fast-reid/fastreid/layers/__init__.py +19 -0
  164. dnt/third_party/fast-reid/fastreid/layers/activation.py +59 -0
  165. dnt/third_party/fast-reid/fastreid/layers/any_softmax.py +80 -0
  166. dnt/third_party/fast-reid/fastreid/layers/batch_norm.py +205 -0
  167. dnt/third_party/fast-reid/fastreid/layers/context_block.py +113 -0
  168. dnt/third_party/fast-reid/fastreid/layers/drop.py +161 -0
  169. dnt/third_party/fast-reid/fastreid/layers/frn.py +199 -0
  170. dnt/third_party/fast-reid/fastreid/layers/gather_layer.py +30 -0
  171. dnt/third_party/fast-reid/fastreid/layers/helpers.py +31 -0
  172. dnt/third_party/fast-reid/fastreid/layers/non_local.py +54 -0
  173. dnt/third_party/fast-reid/fastreid/layers/pooling.py +124 -0
  174. dnt/third_party/fast-reid/fastreid/layers/se_layer.py +25 -0
  175. dnt/third_party/fast-reid/fastreid/layers/splat.py +109 -0
  176. dnt/third_party/fast-reid/fastreid/layers/weight_init.py +122 -0
  177. dnt/third_party/fast-reid/fastreid/modeling/__init__.py +23 -0
  178. dnt/third_party/fast-reid/fastreid/modeling/backbones/__init__.py +18 -0
  179. dnt/third_party/fast-reid/fastreid/modeling/backbones/build.py +27 -0
  180. dnt/third_party/fast-reid/fastreid/modeling/backbones/mobilenet.py +195 -0
  181. dnt/third_party/fast-reid/fastreid/modeling/backbones/mobilenetv3.py +283 -0
  182. dnt/third_party/fast-reid/fastreid/modeling/backbones/osnet.py +525 -0
  183. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/__init__.py +4 -0
  184. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/config.py +396 -0
  185. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet/EN-B0_dds_8gpu.yaml +27 -0
  186. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet/EN-B1_dds_8gpu.yaml +27 -0
  187. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet/EN-B2_dds_8gpu.yaml +27 -0
  188. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet/EN-B3_dds_8gpu.yaml +27 -0
  189. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet/EN-B4_dds_8gpu.yaml +27 -0
  190. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet/EN-B5_dds_8gpu.yaml +27 -0
  191. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet.py +281 -0
  192. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnet.py +596 -0
  193. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-1.6GF_dds_8gpu.yaml +26 -0
  194. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-12GF_dds_8gpu.yaml +26 -0
  195. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-16GF_dds_8gpu.yaml +26 -0
  196. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-200MF_dds_8gpu.yaml +26 -0
  197. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-3.2GF_dds_8gpu.yaml +26 -0
  198. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-32GF_dds_8gpu.yaml +26 -0
  199. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-4.0GF_dds_8gpu.yaml +26 -0
  200. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-400MF_dds_8gpu.yaml +26 -0
  201. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-6.4GF_dds_8gpu.yaml +26 -0
  202. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-600MF_dds_8gpu.yaml +26 -0
  203. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-8.0GF_dds_8gpu.yaml +26 -0
  204. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-800MF_dds_8gpu.yaml +26 -0
  205. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-1.6GF_dds_8gpu.yaml +27 -0
  206. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-12GF_dds_8gpu.yaml +27 -0
  207. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-16GF_dds_8gpu.yaml +27 -0
  208. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-200MF_dds_8gpu.yaml +26 -0
  209. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-3.2GF_dds_8gpu.yaml +27 -0
  210. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-32GF_dds_8gpu.yaml +27 -0
  211. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-4.0GF_dds_8gpu.yaml +27 -0
  212. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-400MF_dds_8gpu.yaml +27 -0
  213. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-6.4GF_dds_8gpu.yaml +27 -0
  214. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-600MF_dds_8gpu.yaml +27 -0
  215. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-8.0GF_dds_8gpu.yaml +27 -0
  216. dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-800MF_dds_8gpu.yaml +27 -0
  217. dnt/third_party/fast-reid/fastreid/modeling/backbones/repvgg.py +309 -0
  218. dnt/third_party/fast-reid/fastreid/modeling/backbones/resnest.py +365 -0
  219. dnt/third_party/fast-reid/fastreid/modeling/backbones/resnet.py +364 -0
  220. dnt/third_party/fast-reid/fastreid/modeling/backbones/resnext.py +335 -0
  221. dnt/third_party/fast-reid/fastreid/modeling/backbones/shufflenet.py +203 -0
  222. dnt/third_party/fast-reid/fastreid/modeling/backbones/vision_transformer.py +399 -0
  223. dnt/third_party/fast-reid/fastreid/modeling/heads/__init__.py +11 -0
  224. dnt/third_party/fast-reid/fastreid/modeling/heads/build.py +25 -0
  225. dnt/third_party/fast-reid/fastreid/modeling/heads/clas_head.py +36 -0
  226. dnt/third_party/fast-reid/fastreid/modeling/heads/embedding_head.py +151 -0
  227. dnt/third_party/fast-reid/fastreid/modeling/losses/__init__.py +12 -0
  228. dnt/third_party/fast-reid/fastreid/modeling/losses/circle_loss.py +71 -0
  229. dnt/third_party/fast-reid/fastreid/modeling/losses/cross_entroy_loss.py +54 -0
  230. dnt/third_party/fast-reid/fastreid/modeling/losses/focal_loss.py +92 -0
  231. dnt/third_party/fast-reid/fastreid/modeling/losses/triplet_loss.py +113 -0
  232. dnt/third_party/fast-reid/fastreid/modeling/losses/utils.py +48 -0
  233. dnt/third_party/fast-reid/fastreid/modeling/meta_arch/__init__.py +14 -0
  234. dnt/third_party/fast-reid/fastreid/modeling/meta_arch/baseline.py +188 -0
  235. dnt/third_party/fast-reid/fastreid/modeling/meta_arch/build.py +26 -0
  236. dnt/third_party/fast-reid/fastreid/modeling/meta_arch/distiller.py +140 -0
  237. dnt/third_party/fast-reid/fastreid/modeling/meta_arch/mgn.py +394 -0
  238. dnt/third_party/fast-reid/fastreid/modeling/meta_arch/moco.py +126 -0
  239. dnt/third_party/fast-reid/fastreid/solver/__init__.py +8 -0
  240. dnt/third_party/fast-reid/fastreid/solver/build.py +348 -0
  241. dnt/third_party/fast-reid/fastreid/solver/lr_scheduler.py +66 -0
  242. dnt/third_party/fast-reid/fastreid/solver/optim/__init__.py +10 -0
  243. dnt/third_party/fast-reid/fastreid/solver/optim/lamb.py +123 -0
  244. dnt/third_party/fast-reid/fastreid/solver/optim/radam.py +149 -0
  245. dnt/third_party/fast-reid/fastreid/solver/optim/swa.py +246 -0
  246. dnt/third_party/fast-reid/fastreid/utils/__init__.py +6 -0
  247. dnt/third_party/fast-reid/fastreid/utils/checkpoint.py +503 -0
  248. dnt/third_party/fast-reid/fastreid/utils/collect_env.py +158 -0
  249. dnt/third_party/fast-reid/fastreid/utils/comm.py +255 -0
  250. dnt/third_party/fast-reid/fastreid/utils/compute_dist.py +200 -0
  251. dnt/third_party/fast-reid/fastreid/utils/env.py +119 -0
  252. dnt/third_party/fast-reid/fastreid/utils/events.py +461 -0
  253. dnt/third_party/fast-reid/fastreid/utils/faiss_utils.py +127 -0
  254. dnt/third_party/fast-reid/fastreid/utils/file_io.py +520 -0
  255. dnt/third_party/fast-reid/fastreid/utils/history_buffer.py +71 -0
  256. dnt/third_party/fast-reid/fastreid/utils/logger.py +211 -0
  257. dnt/third_party/fast-reid/fastreid/utils/params.py +103 -0
  258. dnt/third_party/fast-reid/fastreid/utils/precision_bn.py +94 -0
  259. dnt/third_party/fast-reid/fastreid/utils/registry.py +66 -0
  260. dnt/third_party/fast-reid/fastreid/utils/summary.py +120 -0
  261. dnt/third_party/fast-reid/fastreid/utils/timer.py +68 -0
  262. dnt/third_party/fast-reid/fastreid/utils/visualizer.py +278 -0
  263. dnt/track/__init__.py +2 -0
  264. dnt/track/botsort/__init__.py +4 -0
  265. dnt/track/botsort/bot_tracker/__init__.py +3 -0
  266. dnt/track/botsort/bot_tracker/basetrack.py +60 -0
  267. dnt/track/botsort/bot_tracker/bot_sort.py +473 -0
  268. dnt/track/botsort/bot_tracker/gmc.py +316 -0
  269. dnt/track/botsort/bot_tracker/kalman_filter.py +269 -0
  270. dnt/track/botsort/bot_tracker/matching.py +194 -0
  271. dnt/track/botsort/bot_tracker/mc_bot_sort.py +505 -0
  272. dnt/track/{dsort/utils → botsort/bot_tracker/tracking_utils}/evaluation.py +14 -4
  273. dnt/track/{dsort/utils → botsort/bot_tracker/tracking_utils}/io.py +19 -36
  274. dnt/track/botsort/bot_tracker/tracking_utils/timer.py +37 -0
  275. dnt/track/botsort/inference.py +96 -0
  276. dnt/track/config.py +120 -0
  277. dnt/track/dsort/configs/bagtricks_R50.yml +7 -0
  278. dnt/track/dsort/configs/deep_sort.yaml +0 -0
  279. dnt/track/dsort/configs/fastreid.yaml +1 -1
  280. dnt/track/dsort/deep_sort/deep/checkpoint/ckpt.t7 +0 -0
  281. dnt/track/dsort/deep_sort/deep/feature_extractor.py +87 -8
  282. dnt/track/dsort/deep_sort/deep_sort.py +31 -20
  283. dnt/track/dsort/deep_sort/sort/detection.py +2 -1
  284. dnt/track/dsort/deep_sort/sort/iou_matching.py +0 -2
  285. dnt/track/dsort/deep_sort/sort/linear_assignment.py +0 -3
  286. dnt/track/dsort/deep_sort/sort/nn_matching.py +5 -5
  287. dnt/track/dsort/deep_sort/sort/preprocessing.py +1 -2
  288. dnt/track/dsort/deep_sort/sort/track.py +2 -1
  289. dnt/track/dsort/deep_sort/sort/tracker.py +1 -1
  290. dnt/track/dsort/dsort.py +43 -33
  291. dnt/track/re_class.py +117 -0
  292. dnt/track/sort/sort.py +9 -6
  293. dnt/track/tracker.py +213 -32
  294. {dnt-0.2.4.dist-info → dnt-0.3.1.7.dist-info}/METADATA +41 -13
  295. dnt-0.3.1.7.dist-info/RECORD +315 -0
  296. {dnt-0.2.4.dist-info → dnt-0.3.1.7.dist-info}/WHEEL +1 -1
  297. dnt/analysis/yield.py +0 -9
  298. dnt/track/dsort/deep_sort/deep/evaluate.py +0 -15
  299. dnt/track/dsort/deep_sort/deep/original_model.py +0 -106
  300. dnt/track/dsort/deep_sort/deep/test.py +0 -77
  301. dnt/track/dsort/deep_sort/deep/train.py +0 -189
  302. dnt/track/dsort/utils/asserts.py +0 -13
  303. dnt/track/dsort/utils/draw.py +0 -36
  304. dnt/track/dsort/utils/json_logger.py +0 -383
  305. dnt/track/dsort/utils/log.py +0 -17
  306. dnt/track/dsort/utils/parser.py +0 -35
  307. dnt/track/dsort/utils/tools.py +0 -39
  308. dnt-0.2.4.dist-info/RECORD +0 -64
  309. /dnt/{track/dsort/utils → third_party/fast-reid/checkpoint}/__init__.py +0 -0
  310. {dnt-0.2.4.dist-info → dnt-0.3.1.7.dist-info/licenses}/LICENSE +0 -0
  311. {dnt-0.2.4.dist-info → dnt-0.3.1.7.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,274 @@
1
+ # encoding: utf-8
2
+ """
3
+ @author: liaoxingyu
4
+ @contact: liaoxingyu2@jd.com
5
+ """
6
+
7
+ import json
8
+ import os.path as osp
9
+
10
+ from fastreid.data.datasets import DATASET_REGISTRY
11
+ from fastreid.utils.file_io import PathManager
12
+ from .bases import ImageDataset
13
+
14
+
15
+ @DATASET_REGISTRY.register()
16
+ class CUHK03(ImageDataset):
17
+ """CUHK03.
18
+
19
+ Reference:
20
+ Li et al. DeepReID: Deep Filter Pairing Neural Network for Person Re-identification. CVPR 2014.
21
+
22
+ URL: `<http://www.ee.cuhk.edu.hk/~xgwang/CUHK_identification.html#!>`_
23
+
24
+ Dataset statistics:
25
+ - identities: 1360.
26
+ - images: 13164.
27
+ - cameras: 6.
28
+ - splits: 20 (classic).
29
+ """
30
+ dataset_dir = 'cuhk03'
31
+ dataset_url = None
32
+ dataset_name = "cuhk03"
33
+
34
+ def __init__(self, root='datasets', split_id=0, cuhk03_labeled=True, cuhk03_classic_split=False, **kwargs):
35
+ self.root = root
36
+ self.dataset_dir = osp.join(self.root, self.dataset_dir)
37
+
38
+ self.data_dir = osp.join(self.dataset_dir, 'cuhk03_release')
39
+ self.raw_mat_path = osp.join(self.data_dir, 'cuhk-03.mat')
40
+
41
+ self.imgs_detected_dir = osp.join(self.dataset_dir, 'images_detected')
42
+ self.imgs_labeled_dir = osp.join(self.dataset_dir, 'images_labeled')
43
+
44
+ self.split_classic_det_json_path = osp.join(self.dataset_dir, 'splits_classic_detected.json')
45
+ self.split_classic_lab_json_path = osp.join(self.dataset_dir, 'splits_classic_labeled.json')
46
+
47
+ self.split_new_det_json_path = osp.join(self.dataset_dir, 'splits_new_detected.json')
48
+ self.split_new_lab_json_path = osp.join(self.dataset_dir, 'splits_new_labeled.json')
49
+
50
+ self.split_new_det_mat_path = osp.join(self.dataset_dir, 'cuhk03_new_protocol_config_detected.mat')
51
+ self.split_new_lab_mat_path = osp.join(self.dataset_dir, 'cuhk03_new_protocol_config_labeled.mat')
52
+
53
+ required_files = [
54
+ self.dataset_dir,
55
+ self.data_dir,
56
+ self.raw_mat_path,
57
+ self.split_new_det_mat_path,
58
+ self.split_new_lab_mat_path
59
+ ]
60
+ self.check_before_run(required_files)
61
+
62
+ self.preprocess_split()
63
+
64
+ if cuhk03_labeled:
65
+ split_path = self.split_classic_lab_json_path if cuhk03_classic_split else self.split_new_lab_json_path
66
+ else:
67
+ split_path = self.split_classic_det_json_path if cuhk03_classic_split else self.split_new_det_json_path
68
+
69
+ with PathManager.open(split_path) as f:
70
+ splits = json.load(f)
71
+ assert split_id < len(splits), 'Condition split_id ({}) < len(splits) ({}) is false'.format(split_id,
72
+ len(splits))
73
+ split = splits[split_id]
74
+
75
+ train = split['train']
76
+ tmp_train = []
77
+ for img_path, pid, camid in train:
78
+ new_pid = self.dataset_name + "_" + str(pid)
79
+ new_camid = self.dataset_name + "_" + str(camid)
80
+ tmp_train.append((img_path, new_pid, new_camid))
81
+ train = tmp_train
82
+ del tmp_train
83
+ query = split['query']
84
+ gallery = split['gallery']
85
+
86
+ super(CUHK03, self).__init__(train, query, gallery, **kwargs)
87
+
88
+ def preprocess_split(self):
89
+ # This function is a bit complex and ugly, what it does is
90
+ # 1. extract data from cuhk-03.mat and save as png images
91
+ # 2. create 20 classic splits (Li et al. CVPR'14)
92
+ # 3. create new split (Zhong et al. CVPR'17)
93
+ if osp.exists(self.imgs_labeled_dir) \
94
+ and osp.exists(self.imgs_detected_dir) \
95
+ and osp.exists(self.split_classic_det_json_path) \
96
+ and osp.exists(self.split_classic_lab_json_path) \
97
+ and osp.exists(self.split_new_det_json_path) \
98
+ and osp.exists(self.split_new_lab_json_path):
99
+ return
100
+
101
+ import h5py
102
+ from imageio import imwrite
103
+ from scipy import io
104
+
105
+ PathManager.mkdirs(self.imgs_detected_dir)
106
+ PathManager.mkdirs(self.imgs_labeled_dir)
107
+
108
+ print('Extract image data from "{}" and save as png'.format(self.raw_mat_path))
109
+ mat = h5py.File(self.raw_mat_path, 'r')
110
+
111
+ def _deref(ref):
112
+ return mat[ref][:].T
113
+
114
+ def _process_images(img_refs, campid, pid, save_dir):
115
+ img_paths = [] # Note: some persons only have images for one view
116
+ for imgid, img_ref in enumerate(img_refs):
117
+ img = _deref(img_ref)
118
+ if img.size == 0 or img.ndim < 3:
119
+ continue # skip empty cell
120
+ # images are saved with the following format, index-1 (ensure uniqueness)
121
+ # campid: index of camera pair (1-5)
122
+ # pid: index of person in 'campid'-th camera pair
123
+ # viewid: index of view, {1, 2}
124
+ # imgid: index of image, (1-10)
125
+ viewid = 1 if imgid < 5 else 2
126
+ img_name = '{:01d}_{:03d}_{:01d}_{:02d}.png'.format(campid + 1, pid + 1, viewid, imgid + 1)
127
+ img_path = osp.join(save_dir, img_name)
128
+ if not osp.isfile(img_path):
129
+ imwrite(img_path, img)
130
+ img_paths.append(img_path)
131
+ return img_paths
132
+
133
+ def _extract_img(image_type):
134
+ print('Processing {} images ...'.format(image_type))
135
+ meta_data = []
136
+ imgs_dir = self.imgs_detected_dir if image_type == 'detected' else self.imgs_labeled_dir
137
+ for campid, camp_ref in enumerate(mat[image_type][0]):
138
+ camp = _deref(camp_ref)
139
+ num_pids = camp.shape[0]
140
+ for pid in range(num_pids):
141
+ img_paths = _process_images(camp[pid, :], campid, pid, imgs_dir)
142
+ assert len(img_paths) > 0, 'campid{}-pid{} has no images'.format(campid, pid)
143
+ meta_data.append((campid + 1, pid + 1, img_paths))
144
+ print('- done camera pair {} with {} identities'.format(campid + 1, num_pids))
145
+ return meta_data
146
+
147
+ meta_detected = _extract_img('detected')
148
+ meta_labeled = _extract_img('labeled')
149
+
150
+ def _extract_classic_split(meta_data, test_split):
151
+ train, test = [], []
152
+ num_train_pids, num_test_pids = 0, 0
153
+ num_train_imgs, num_test_imgs = 0, 0
154
+ for i, (campid, pid, img_paths) in enumerate(meta_data):
155
+
156
+ if [campid, pid] in test_split:
157
+ for img_path in img_paths:
158
+ camid = int(osp.basename(img_path).split('_')[2]) - 1 # make it 0-based
159
+ test.append((img_path, num_test_pids, camid))
160
+ num_test_pids += 1
161
+ num_test_imgs += len(img_paths)
162
+ else:
163
+ for img_path in img_paths:
164
+ camid = int(osp.basename(img_path).split('_')[2]) - 1 # make it 0-based
165
+ train.append((img_path, num_train_pids, camid))
166
+ num_train_pids += 1
167
+ num_train_imgs += len(img_paths)
168
+ return train, num_train_pids, num_train_imgs, test, num_test_pids, num_test_imgs
169
+
170
+ print('Creating classic splits (# = 20) ...')
171
+ splits_classic_det, splits_classic_lab = [], []
172
+ for split_ref in mat['testsets'][0]:
173
+ test_split = _deref(split_ref).tolist()
174
+
175
+ # create split for detected images
176
+ train, num_train_pids, num_train_imgs, test, num_test_pids, num_test_imgs = \
177
+ _extract_classic_split(meta_detected, test_split)
178
+ splits_classic_det.append({
179
+ 'train': train,
180
+ 'query': test,
181
+ 'gallery': test,
182
+ 'num_train_pids': num_train_pids,
183
+ 'num_train_imgs': num_train_imgs,
184
+ 'num_query_pids': num_test_pids,
185
+ 'num_query_imgs': num_test_imgs,
186
+ 'num_gallery_pids': num_test_pids,
187
+ 'num_gallery_imgs': num_test_imgs
188
+ })
189
+
190
+ # create split for labeled images
191
+ train, num_train_pids, num_train_imgs, test, num_test_pids, num_test_imgs = \
192
+ _extract_classic_split(meta_labeled, test_split)
193
+ splits_classic_lab.append({
194
+ 'train': train,
195
+ 'query': test,
196
+ 'gallery': test,
197
+ 'num_train_pids': num_train_pids,
198
+ 'num_train_imgs': num_train_imgs,
199
+ 'num_query_pids': num_test_pids,
200
+ 'num_query_imgs': num_test_imgs,
201
+ 'num_gallery_pids': num_test_pids,
202
+ 'num_gallery_imgs': num_test_imgs
203
+ })
204
+
205
+ with PathManager.open(self.split_classic_det_json_path, 'w') as f:
206
+ json.dump(splits_classic_det, f, indent=4, separators=(',', ': '))
207
+ with PathManager.open(self.split_classic_lab_json_path, 'w') as f:
208
+ json.dump(splits_classic_lab, f, indent=4, separators=(',', ': '))
209
+
210
+ def _extract_set(filelist, pids, pid2label, idxs, img_dir, relabel):
211
+ tmp_set = []
212
+ unique_pids = set()
213
+ for idx in idxs:
214
+ img_name = filelist[idx][0]
215
+ camid = int(img_name.split('_')[2]) - 1 # make it 0-based
216
+ pid = pids[idx]
217
+ if relabel:
218
+ pid = pid2label[pid]
219
+ img_path = osp.join(img_dir, img_name)
220
+ tmp_set.append((img_path, int(pid), camid))
221
+ unique_pids.add(pid)
222
+ return tmp_set, len(unique_pids), len(idxs)
223
+
224
+ def _extract_new_split(split_dict, img_dir):
225
+ train_idxs = split_dict['train_idx'].flatten() - 1 # index-0
226
+ pids = split_dict['labels'].flatten()
227
+ train_pids = set(pids[train_idxs])
228
+ pid2label = {pid: label for label, pid in enumerate(train_pids)}
229
+ query_idxs = split_dict['query_idx'].flatten() - 1
230
+ gallery_idxs = split_dict['gallery_idx'].flatten() - 1
231
+ filelist = split_dict['filelist'].flatten()
232
+ train_info = _extract_set(filelist, pids, pid2label, train_idxs, img_dir, relabel=True)
233
+ query_info = _extract_set(filelist, pids, pid2label, query_idxs, img_dir, relabel=False)
234
+ gallery_info = _extract_set(filelist, pids, pid2label, gallery_idxs, img_dir, relabel=False)
235
+ return train_info, query_info, gallery_info
236
+
237
+ print('Creating new split for detected images (767/700) ...')
238
+ train_info, query_info, gallery_info = _extract_new_split(
239
+ io.loadmat(self.split_new_det_mat_path),
240
+ self.imgs_detected_dir
241
+ )
242
+ split = [{
243
+ 'train': train_info[0],
244
+ 'query': query_info[0],
245
+ 'gallery': gallery_info[0],
246
+ 'num_train_pids': train_info[1],
247
+ 'num_train_imgs': train_info[2],
248
+ 'num_query_pids': query_info[1],
249
+ 'num_query_imgs': query_info[2],
250
+ 'num_gallery_pids': gallery_info[1],
251
+ 'num_gallery_imgs': gallery_info[2]
252
+ }]
253
+
254
+ with PathManager.open(self.split_new_det_json_path, 'w') as f:
255
+ json.dump(split, f, indent=4, separators=(',', ': '))
256
+
257
+ print('Creating new split for labeled images (767/700) ...')
258
+ train_info, query_info, gallery_info = _extract_new_split(
259
+ io.loadmat(self.split_new_lab_mat_path),
260
+ self.imgs_labeled_dir
261
+ )
262
+ split = [{
263
+ 'train': train_info[0],
264
+ 'query': query_info[0],
265
+ 'gallery': gallery_info[0],
266
+ 'num_train_pids': train_info[1],
267
+ 'num_train_imgs': train_info[2],
268
+ 'num_query_pids': query_info[1],
269
+ 'num_query_imgs': query_info[2],
270
+ 'num_gallery_pids': gallery_info[1],
271
+ 'num_gallery_imgs': gallery_info[2]
272
+ }]
273
+ with PathManager.open(self.split_new_lab_json_path, 'w') as f:
274
+ json.dump(split, f, indent=4, separators=(',', ': '))
@@ -0,0 +1,58 @@
1
+ # encoding: utf-8
2
+ """
3
+ @author: xingyu liao
4
+ @contact: sherlockliao01@gmail.com
5
+ """
6
+
7
+ import glob
8
+ import os.path as osp
9
+ import re
10
+ import warnings
11
+
12
+ from .bases import ImageDataset
13
+ from ..datasets import DATASET_REGISTRY
14
+
15
+
16
+ @DATASET_REGISTRY.register()
17
+ class cuhkSYSU(ImageDataset):
18
+ """CUHK SYSU datasets.
19
+
20
+ The dataset is collected from two sources: street snap and movie.
21
+ In street snap, 12,490 images and 6,057 query persons were collected
22
+ with movable cameras across hundreds of scenes while 5,694 images and
23
+ 2,375 query persons were selected from movies and TV dramas.
24
+
25
+ Dataset statistics:
26
+ - identities: xxx.
27
+ - images: 12936 (train).
28
+ """
29
+ dataset_dir = 'cuhk_sysu'
30
+ dataset_name = "cuhksysu"
31
+
32
+ def __init__(self, root='datasets', **kwargs):
33
+ self.root = root
34
+ self.dataset_dir = osp.join(self.root, self.dataset_dir)
35
+
36
+ self.data_dir = osp.join(self.dataset_dir, "cropped_images")
37
+
38
+ required_files = [self.data_dir]
39
+ self.check_before_run(required_files)
40
+
41
+ train = self.process_dir(self.data_dir)
42
+ query = []
43
+ gallery = []
44
+
45
+ super(cuhkSYSU, self).__init__(train, query, gallery, **kwargs)
46
+
47
+ def process_dir(self, dir_path):
48
+ img_paths = glob.glob(osp.join(dir_path, '*.jpg'))
49
+ pattern = re.compile(r'p([-\d]+)_s(\d)')
50
+
51
+ data = []
52
+ for img_path in img_paths:
53
+ pid, _ = map(int, pattern.search(img_path).groups())
54
+ pid = self.dataset_name + "_" + str(pid)
55
+ camid = self.dataset_name + "_0"
56
+ data.append((img_path, pid, camid))
57
+
58
+ return data
@@ -0,0 +1,70 @@
1
+ # encoding: utf-8
2
+ """
3
+ @author: liaoxingyu
4
+ @contact: liaoxingyu2@jd.com
5
+ """
6
+
7
+ import glob
8
+ import os.path as osp
9
+ import re
10
+
11
+ from .bases import ImageDataset
12
+ from ..datasets import DATASET_REGISTRY
13
+
14
+
15
+ @DATASET_REGISTRY.register()
16
+ class DukeMTMC(ImageDataset):
17
+ """DukeMTMC-reID.
18
+
19
+ Reference:
20
+ - Ristani et al. Performance Measures and a Data Set for Multi-Target, Multi-Camera Tracking. ECCVW 2016.
21
+ - Zheng et al. Unlabeled Samples Generated by GAN Improve the Person Re-identification Baseline in vitro. ICCV 2017.
22
+
23
+ URL: `<https://github.com/layumi/DukeMTMC-reID_evaluation>`_
24
+
25
+ Dataset statistics:
26
+ - identities: 1404 (train + query).
27
+ - images:16522 (train) + 2228 (query) + 17661 (gallery).
28
+ - cameras: 8.
29
+ """
30
+ dataset_dir = 'DukeMTMC-reID'
31
+ dataset_url = 'http://vision.cs.duke.edu/DukeMTMC/data/misc/DukeMTMC-reID.zip'
32
+ dataset_name = "dukemtmc"
33
+
34
+ def __init__(self, root='datasets', **kwargs):
35
+ # self.root = osp.abspath(osp.expanduser(root))
36
+ self.root = root
37
+ self.dataset_dir = osp.join(self.root, self.dataset_dir)
38
+ self.train_dir = osp.join(self.dataset_dir, 'bounding_box_train')
39
+ self.query_dir = osp.join(self.dataset_dir, 'query')
40
+ self.gallery_dir = osp.join(self.dataset_dir, 'bounding_box_test')
41
+
42
+ required_files = [
43
+ self.dataset_dir,
44
+ self.train_dir,
45
+ self.query_dir,
46
+ self.gallery_dir,
47
+ ]
48
+ self.check_before_run(required_files)
49
+
50
+ train = self.process_dir(self.train_dir)
51
+ query = self.process_dir(self.query_dir, is_train=False)
52
+ gallery = self.process_dir(self.gallery_dir, is_train=False)
53
+
54
+ super(DukeMTMC, self).__init__(train, query, gallery, **kwargs)
55
+
56
+ def process_dir(self, dir_path, is_train=True):
57
+ img_paths = glob.glob(osp.join(dir_path, '*.jpg'))
58
+ pattern = re.compile(r'([-\d]+)_c(\d)')
59
+
60
+ data = []
61
+ for img_path in img_paths:
62
+ pid, camid = map(int, pattern.search(img_path).groups())
63
+ assert 1 <= camid <= 8
64
+ camid -= 1 # index starts from 0
65
+ if is_train:
66
+ pid = self.dataset_name + "_" + str(pid)
67
+ camid = self.dataset_name + "_" + str(camid)
68
+ data.append((img_path, pid, camid))
69
+
70
+ return data
@@ -0,0 +1,44 @@
1
+ # encoding: utf-8
2
+ """
3
+ @author: xingyu liao
4
+ @contact: sherlockliao01@gmail.com
5
+ """
6
+
7
+ import os
8
+ from glob import glob
9
+
10
+ from fastreid.data.datasets import DATASET_REGISTRY
11
+ from fastreid.data.datasets.bases import ImageDataset
12
+
13
+ __all__ = ['GRID', ]
14
+
15
+
16
+ @DATASET_REGISTRY.register()
17
+ class GRID(ImageDataset):
18
+ """GRID
19
+ """
20
+ dataset_dir = "underground_reid"
21
+ dataset_name = 'grid'
22
+
23
+ def __init__(self, root='datasets', **kwargs):
24
+ self.root = root
25
+ self.train_path = os.path.join(self.root, self.dataset_dir, 'images')
26
+
27
+ required_files = [self.train_path]
28
+ self.check_before_run(required_files)
29
+
30
+ train = self.process_train(self.train_path)
31
+
32
+ super().__init__(train, [], [], **kwargs)
33
+
34
+ def process_train(self, train_path):
35
+ data = []
36
+ img_paths = glob(os.path.join(train_path, "*.jpeg"))
37
+
38
+ for img_path in img_paths:
39
+ img_name = os.path.basename(img_path)
40
+ img_info = img_name.split('_')
41
+ pid = self.dataset_name + "_" + img_info[0]
42
+ camid = self.dataset_name + "_" + img_info[1]
43
+ data.append([img_path, pid, camid])
44
+ return data
@@ -0,0 +1,45 @@
1
+ # encoding: utf-8
2
+ """
3
+ @author: xingyu liao
4
+ @contact: sherlockliao01@gmail.com
5
+ """
6
+
7
+ import os
8
+ from glob import glob
9
+
10
+ from fastreid.data.datasets import DATASET_REGISTRY
11
+ from fastreid.data.datasets.bases import ImageDataset
12
+
13
+ __all__ = ['iLIDS', ]
14
+
15
+
16
+ @DATASET_REGISTRY.register()
17
+ class iLIDS(ImageDataset):
18
+ """iLIDS
19
+ """
20
+ dataset_dir = "iLIDS"
21
+ dataset_name = "ilids"
22
+
23
+ def __init__(self, root='datasets', **kwargs):
24
+ self.root = root
25
+ self.train_path = os.path.join(self.root, self.dataset_dir)
26
+
27
+ required_files = [self.train_path]
28
+ self.check_before_run(required_files)
29
+
30
+ train = self.process_train(self.train_path)
31
+
32
+ super().__init__(train, [], [], **kwargs)
33
+
34
+ def process_train(self, train_path):
35
+ data = []
36
+ file_path = os.listdir(train_path)
37
+ for pid_dir in file_path:
38
+ img_file = os.path.join(train_path, pid_dir)
39
+ img_paths = glob(os.path.join(img_file, "*.png"))
40
+ for img_path in img_paths:
41
+ split_path = img_path.split('/')
42
+ pid = self.dataset_name + "_" + split_path[-2]
43
+ camid = self.dataset_name + "_" + split_path[-1].split('_')[0]
44
+ data.append([img_path, pid, camid])
45
+ return data
@@ -0,0 +1,49 @@
1
+ # encoding: utf-8
2
+ """
3
+ @author: xingyu liao
4
+ @contact: sherlockliao01@gmail.com
5
+ """
6
+
7
+ import os
8
+ from glob import glob
9
+
10
+ from fastreid.data.datasets import DATASET_REGISTRY
11
+ from fastreid.data.datasets.bases import ImageDataset
12
+
13
+ __all__ = ['LPW', ]
14
+
15
+
16
+ @DATASET_REGISTRY.register()
17
+ class LPW(ImageDataset):
18
+ """LPW
19
+ """
20
+ dataset_dir = "pep_256x128/data_slim"
21
+ dataset_name = "lpw"
22
+
23
+ def __init__(self, root='datasets', **kwargs):
24
+ self.root = root
25
+ self.train_path = os.path.join(self.root, self.dataset_dir)
26
+
27
+ required_files = [self.train_path]
28
+ self.check_before_run(required_files)
29
+
30
+ train = self.process_train(self.train_path)
31
+
32
+ super().__init__(train, [], [], **kwargs)
33
+
34
+ def process_train(self, train_path):
35
+ data = []
36
+
37
+ file_path_list = ['scen1', 'scen2', 'scen3']
38
+
39
+ for scene in file_path_list:
40
+ cam_list = os.listdir(os.path.join(train_path, scene))
41
+ for cam in cam_list:
42
+ camid = self.dataset_name + "_" + cam
43
+ pid_list = os.listdir(os.path.join(train_path, scene, cam))
44
+ for pid_dir in pid_list:
45
+ img_paths = glob(os.path.join(train_path, scene, cam, pid_dir, "*.jpg"))
46
+ for img_path in img_paths:
47
+ pid = self.dataset_name + "_" + scene + "-" + pid_dir
48
+ data.append([img_path, pid, camid])
49
+ return data
@@ -0,0 +1,89 @@
1
+ # encoding: utf-8
2
+ """
3
+ @author: sherlock
4
+ @contact: sherlockliao01@gmail.com
5
+ """
6
+
7
+ import glob
8
+ import os.path as osp
9
+ import re
10
+ import warnings
11
+
12
+ from .bases import ImageDataset
13
+ from ..datasets import DATASET_REGISTRY
14
+
15
+
16
+ @DATASET_REGISTRY.register()
17
+ class Market1501(ImageDataset):
18
+ """Market1501.
19
+
20
+ Reference:
21
+ Zheng et al. Scalable Person Re-identification: A Benchmark. ICCV 2015.
22
+
23
+ URL: `<http://www.liangzheng.org/Project/project_reid.html>`_
24
+
25
+ Dataset statistics:
26
+ - identities: 1501 (+1 for background).
27
+ - images: 12936 (train) + 3368 (query) + 15913 (gallery).
28
+ """
29
+ _junk_pids = [0, -1]
30
+ dataset_dir = ''
31
+ dataset_url = 'http://188.138.127.15:81/Datasets/Market-1501-v15.09.15.zip'
32
+ dataset_name = "market1501"
33
+
34
+ def __init__(self, root='datasets', market1501_500k=False, **kwargs):
35
+ # self.root = osp.abspath(osp.expanduser(root))
36
+ self.root = root
37
+ self.dataset_dir = osp.join(self.root, self.dataset_dir)
38
+
39
+ # allow alternative directory structure
40
+ self.data_dir = self.dataset_dir
41
+ data_dir = osp.join(self.data_dir, 'Market-1501-v15.09.15')
42
+ if osp.isdir(data_dir):
43
+ self.data_dir = data_dir
44
+ else:
45
+ warnings.warn('The current data structure is deprecated. Please '
46
+ 'put data folders such as "bounding_box_train" under '
47
+ '"Market-1501-v15.09.15".')
48
+
49
+ self.train_dir = osp.join(self.data_dir, 'bounding_box_train')
50
+ self.query_dir = osp.join(self.data_dir, 'query')
51
+ self.gallery_dir = osp.join(self.data_dir, 'bounding_box_test')
52
+ self.extra_gallery_dir = osp.join(self.data_dir, 'images')
53
+ self.market1501_500k = market1501_500k
54
+
55
+ required_files = [
56
+ self.data_dir,
57
+ self.train_dir,
58
+ self.query_dir,
59
+ self.gallery_dir,
60
+ ]
61
+ if self.market1501_500k:
62
+ required_files.append(self.extra_gallery_dir)
63
+ self.check_before_run(required_files)
64
+
65
+ train = lambda: self.process_dir(self.train_dir)
66
+ query = lambda: self.process_dir(self.query_dir, is_train=False)
67
+ gallery = lambda: self.process_dir(self.gallery_dir, is_train=False) + \
68
+ (self.process_dir(self.extra_gallery_dir, is_train=False) if self.market1501_500k else [])
69
+
70
+ super(Market1501, self).__init__(train, query, gallery, **kwargs)
71
+
72
+ def process_dir(self, dir_path, is_train=True):
73
+ img_paths = glob.glob(osp.join(dir_path, '*.jpg'))
74
+ pattern = re.compile(r'([-\d]+)_c(\d)')
75
+
76
+ data = []
77
+ for img_path in img_paths:
78
+ pid, camid = map(int, pattern.search(img_path).groups())
79
+ if pid == -1:
80
+ continue # junk images are just ignored
81
+ assert 0 <= pid <= 1501 # pid == 0 means background
82
+ assert 1 <= camid <= 6
83
+ camid -= 1 # index starts from 0
84
+ if is_train:
85
+ pid = self.dataset_name + "_" + str(pid)
86
+ camid = self.dataset_name + "_" + str(camid)
87
+ data.append((img_path, pid, camid))
88
+
89
+ return data