dnt 0.2.1__py3-none-any.whl → 0.3.1.8__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.
- dnt/__init__.py +4 -1
- dnt/analysis/__init__.py +3 -1
- dnt/analysis/count.py +107 -0
- dnt/analysis/interaction2.py +518 -0
- dnt/analysis/position.py +12 -0
- dnt/analysis/stop.py +92 -33
- dnt/analysis/stop2.py +289 -0
- dnt/analysis/stop3.py +758 -0
- dnt/detect/__init__.py +1 -1
- dnt/detect/signal/detector.py +326 -0
- dnt/detect/timestamp.py +105 -0
- dnt/detect/yolov8/detector.py +182 -35
- dnt/detect/yolov8/segmentor.py +171 -0
- dnt/engine/__init__.py +8 -0
- dnt/engine/bbox_interp.py +83 -0
- dnt/engine/bbox_iou.py +20 -0
- dnt/engine/cluster.py +31 -0
- dnt/engine/iob.py +66 -0
- dnt/filter/__init__.py +4 -0
- dnt/filter/filter.py +450 -21
- dnt/label/__init__.py +1 -1
- dnt/label/labeler.py +215 -14
- dnt/label/labeler2.py +631 -0
- dnt/shared/__init__.py +2 -1
- dnt/shared/data/coco.names +0 -0
- dnt/shared/data/openimages.names +0 -0
- dnt/shared/data/voc.names +0 -0
- dnt/shared/download.py +12 -0
- dnt/shared/synhcro.py +150 -0
- dnt/shared/util.py +17 -4
- dnt/third_party/fast-reid/__init__.py +1 -0
- dnt/third_party/fast-reid/configs/Base-AGW.yml +19 -0
- dnt/third_party/fast-reid/configs/Base-MGN.yml +12 -0
- dnt/third_party/fast-reid/configs/Base-SBS.yml +63 -0
- dnt/third_party/fast-reid/configs/Base-bagtricks.yml +76 -0
- dnt/third_party/fast-reid/configs/DukeMTMC/AGW_R101-ibn.yml +12 -0
- dnt/third_party/fast-reid/configs/DukeMTMC/AGW_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/DukeMTMC/AGW_R50.yml +7 -0
- dnt/third_party/fast-reid/configs/DukeMTMC/AGW_S50.yml +11 -0
- dnt/third_party/fast-reid/configs/DukeMTMC/bagtricks_R101-ibn.yml +12 -0
- dnt/third_party/fast-reid/configs/DukeMTMC/bagtricks_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/DukeMTMC/bagtricks_R50.yml +7 -0
- dnt/third_party/fast-reid/configs/DukeMTMC/bagtricks_S50.yml +11 -0
- dnt/third_party/fast-reid/configs/DukeMTMC/mgn_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/DukeMTMC/sbs_R101-ibn.yml +12 -0
- dnt/third_party/fast-reid/configs/DukeMTMC/sbs_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/DukeMTMC/sbs_R50.yml +7 -0
- dnt/third_party/fast-reid/configs/DukeMTMC/sbs_S50.yml +11 -0
- dnt/third_party/fast-reid/configs/MOT17/AGW_R101-ibn.yml +12 -0
- dnt/third_party/fast-reid/configs/MOT17/AGW_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/MOT17/AGW_R50.yml +7 -0
- dnt/third_party/fast-reid/configs/MOT17/AGW_S50.yml +11 -0
- dnt/third_party/fast-reid/configs/MOT17/bagtricks_R101-ibn.yml +12 -0
- dnt/third_party/fast-reid/configs/MOT17/bagtricks_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/MOT17/bagtricks_R50.yml +7 -0
- dnt/third_party/fast-reid/configs/MOT17/bagtricks_S50.yml +11 -0
- dnt/third_party/fast-reid/configs/MOT17/mgn_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/MOT17/sbs_R101-ibn.yml +12 -0
- dnt/third_party/fast-reid/configs/MOT17/sbs_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/MOT17/sbs_R50.yml +7 -0
- dnt/third_party/fast-reid/configs/MOT17/sbs_S50.yml +11 -0
- dnt/third_party/fast-reid/configs/MOT20/AGW_R101-ibn.yml +12 -0
- dnt/third_party/fast-reid/configs/MOT20/AGW_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/MOT20/AGW_R50.yml +7 -0
- dnt/third_party/fast-reid/configs/MOT20/AGW_S50.yml +11 -0
- dnt/third_party/fast-reid/configs/MOT20/bagtricks_R101-ibn.yml +12 -0
- dnt/third_party/fast-reid/configs/MOT20/bagtricks_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/MOT20/bagtricks_R50.yml +7 -0
- dnt/third_party/fast-reid/configs/MOT20/bagtricks_S50.yml +11 -0
- dnt/third_party/fast-reid/configs/MOT20/mgn_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/MOT20/sbs_R101-ibn.yml +12 -0
- dnt/third_party/fast-reid/configs/MOT20/sbs_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/MOT20/sbs_R50.yml +7 -0
- dnt/third_party/fast-reid/configs/MOT20/sbs_S50.yml +11 -0
- dnt/third_party/fast-reid/configs/MSMT17/AGW_R101-ibn.yml +12 -0
- dnt/third_party/fast-reid/configs/MSMT17/AGW_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/MSMT17/AGW_R50.yml +7 -0
- dnt/third_party/fast-reid/configs/MSMT17/AGW_S50.yml +11 -0
- dnt/third_party/fast-reid/configs/MSMT17/bagtricks_R101-ibn.yml +13 -0
- dnt/third_party/fast-reid/configs/MSMT17/bagtricks_R50-ibn.yml +12 -0
- dnt/third_party/fast-reid/configs/MSMT17/bagtricks_R50.yml +7 -0
- dnt/third_party/fast-reid/configs/MSMT17/bagtricks_S50.yml +12 -0
- dnt/third_party/fast-reid/configs/MSMT17/mgn_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/MSMT17/sbs_R101-ibn.yml +12 -0
- dnt/third_party/fast-reid/configs/MSMT17/sbs_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/MSMT17/sbs_R50.yml +7 -0
- dnt/third_party/fast-reid/configs/MSMT17/sbs_S50.yml +11 -0
- dnt/third_party/fast-reid/configs/Market1501/AGW_R101-ibn.yml +12 -0
- dnt/third_party/fast-reid/configs/Market1501/AGW_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/Market1501/AGW_R50.yml +7 -0
- dnt/third_party/fast-reid/configs/Market1501/AGW_S50.yml +11 -0
- dnt/third_party/fast-reid/configs/Market1501/bagtricks_R101-ibn.yml +12 -0
- dnt/third_party/fast-reid/configs/Market1501/bagtricks_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/Market1501/bagtricks_R50.yml +7 -0
- dnt/third_party/fast-reid/configs/Market1501/bagtricks_S50.yml +11 -0
- dnt/third_party/fast-reid/configs/Market1501/bagtricks_vit.yml +88 -0
- dnt/third_party/fast-reid/configs/Market1501/mgn_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/Market1501/sbs_R101-ibn.yml +12 -0
- dnt/third_party/fast-reid/configs/Market1501/sbs_R50-ibn.yml +11 -0
- dnt/third_party/fast-reid/configs/Market1501/sbs_R50.yml +7 -0
- dnt/third_party/fast-reid/configs/Market1501/sbs_S50.yml +11 -0
- dnt/third_party/fast-reid/configs/VERIWild/bagtricks_R50-ibn.yml +35 -0
- dnt/third_party/fast-reid/configs/VeRi/sbs_R50-ibn.yml +35 -0
- dnt/third_party/fast-reid/configs/VehicleID/bagtricks_R50-ibn.yml +36 -0
- dnt/third_party/fast-reid/configs/__init__.py +0 -0
- dnt/third_party/fast-reid/fast_reid_interfece.py +175 -0
- dnt/third_party/fast-reid/fastreid/__init__.py +6 -0
- dnt/third_party/fast-reid/fastreid/config/__init__.py +15 -0
- dnt/third_party/fast-reid/fastreid/config/config.py +319 -0
- dnt/third_party/fast-reid/fastreid/config/defaults.py +329 -0
- dnt/third_party/fast-reid/fastreid/data/__init__.py +17 -0
- dnt/third_party/fast-reid/fastreid/data/build.py +194 -0
- dnt/third_party/fast-reid/fastreid/data/common.py +58 -0
- dnt/third_party/fast-reid/fastreid/data/data_utils.py +202 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/AirportALERT.py +50 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/__init__.py +43 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/bases.py +183 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/caviara.py +44 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/cuhk03.py +274 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/cuhk_sysu.py +58 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/dukemtmcreid.py +70 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/grid.py +44 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/iLIDS.py +45 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/lpw.py +49 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/market1501.py +89 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/msmt17.py +114 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/pes3d.py +44 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/pku.py +44 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/prai.py +43 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/prid.py +41 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/saivt.py +47 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/sensereid.py +47 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/shinpuhkan.py +48 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/sysu_mm.py +47 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/thermalworld.py +43 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/vehicleid.py +126 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/veri.py +69 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/veriwild.py +140 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/viper.py +45 -0
- dnt/third_party/fast-reid/fastreid/data/datasets/wildtracker.py +59 -0
- dnt/third_party/fast-reid/fastreid/data/samplers/__init__.py +18 -0
- dnt/third_party/fast-reid/fastreid/data/samplers/data_sampler.py +85 -0
- dnt/third_party/fast-reid/fastreid/data/samplers/imbalance_sampler.py +67 -0
- dnt/third_party/fast-reid/fastreid/data/samplers/triplet_sampler.py +260 -0
- dnt/third_party/fast-reid/fastreid/data/transforms/__init__.py +11 -0
- dnt/third_party/fast-reid/fastreid/data/transforms/autoaugment.py +806 -0
- dnt/third_party/fast-reid/fastreid/data/transforms/build.py +100 -0
- dnt/third_party/fast-reid/fastreid/data/transforms/functional.py +180 -0
- dnt/third_party/fast-reid/fastreid/data/transforms/transforms.py +161 -0
- dnt/third_party/fast-reid/fastreid/engine/__init__.py +15 -0
- dnt/third_party/fast-reid/fastreid/engine/defaults.py +490 -0
- dnt/third_party/fast-reid/fastreid/engine/hooks.py +534 -0
- dnt/third_party/fast-reid/fastreid/engine/launch.py +103 -0
- dnt/third_party/fast-reid/fastreid/engine/train_loop.py +357 -0
- dnt/third_party/fast-reid/fastreid/evaluation/__init__.py +6 -0
- dnt/third_party/fast-reid/fastreid/evaluation/clas_evaluator.py +81 -0
- dnt/third_party/fast-reid/fastreid/evaluation/evaluator.py +176 -0
- dnt/third_party/fast-reid/fastreid/evaluation/query_expansion.py +46 -0
- dnt/third_party/fast-reid/fastreid/evaluation/rank.py +200 -0
- dnt/third_party/fast-reid/fastreid/evaluation/rank_cylib/__init__.py +20 -0
- dnt/third_party/fast-reid/fastreid/evaluation/rank_cylib/setup.py +32 -0
- dnt/third_party/fast-reid/fastreid/evaluation/rank_cylib/test_cython.py +106 -0
- dnt/third_party/fast-reid/fastreid/evaluation/reid_evaluation.py +143 -0
- dnt/third_party/fast-reid/fastreid/evaluation/rerank.py +73 -0
- dnt/third_party/fast-reid/fastreid/evaluation/roc.py +90 -0
- dnt/third_party/fast-reid/fastreid/evaluation/testing.py +88 -0
- dnt/third_party/fast-reid/fastreid/layers/__init__.py +19 -0
- dnt/third_party/fast-reid/fastreid/layers/activation.py +59 -0
- dnt/third_party/fast-reid/fastreid/layers/any_softmax.py +80 -0
- dnt/third_party/fast-reid/fastreid/layers/batch_norm.py +205 -0
- dnt/third_party/fast-reid/fastreid/layers/context_block.py +113 -0
- dnt/third_party/fast-reid/fastreid/layers/drop.py +161 -0
- dnt/third_party/fast-reid/fastreid/layers/frn.py +199 -0
- dnt/third_party/fast-reid/fastreid/layers/gather_layer.py +30 -0
- dnt/third_party/fast-reid/fastreid/layers/helpers.py +31 -0
- dnt/third_party/fast-reid/fastreid/layers/non_local.py +54 -0
- dnt/third_party/fast-reid/fastreid/layers/pooling.py +124 -0
- dnt/third_party/fast-reid/fastreid/layers/se_layer.py +25 -0
- dnt/third_party/fast-reid/fastreid/layers/splat.py +109 -0
- dnt/third_party/fast-reid/fastreid/layers/weight_init.py +122 -0
- dnt/third_party/fast-reid/fastreid/modeling/__init__.py +23 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/__init__.py +18 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/build.py +27 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/mobilenet.py +195 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/mobilenetv3.py +283 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/osnet.py +525 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/__init__.py +4 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/config.py +396 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet/EN-B0_dds_8gpu.yaml +27 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet/EN-B1_dds_8gpu.yaml +27 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet/EN-B2_dds_8gpu.yaml +27 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet/EN-B3_dds_8gpu.yaml +27 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet/EN-B4_dds_8gpu.yaml +27 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet/EN-B5_dds_8gpu.yaml +27 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/effnet.py +281 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnet.py +596 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-1.6GF_dds_8gpu.yaml +26 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-12GF_dds_8gpu.yaml +26 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-16GF_dds_8gpu.yaml +26 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-200MF_dds_8gpu.yaml +26 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-3.2GF_dds_8gpu.yaml +26 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-32GF_dds_8gpu.yaml +26 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-4.0GF_dds_8gpu.yaml +26 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-400MF_dds_8gpu.yaml +26 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-6.4GF_dds_8gpu.yaml +26 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-600MF_dds_8gpu.yaml +26 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-8.0GF_dds_8gpu.yaml +26 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnetx/RegNetX-800MF_dds_8gpu.yaml +26 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-1.6GF_dds_8gpu.yaml +27 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-12GF_dds_8gpu.yaml +27 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-16GF_dds_8gpu.yaml +27 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-200MF_dds_8gpu.yaml +26 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-3.2GF_dds_8gpu.yaml +27 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-32GF_dds_8gpu.yaml +27 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-4.0GF_dds_8gpu.yaml +27 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-400MF_dds_8gpu.yaml +27 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-6.4GF_dds_8gpu.yaml +27 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-600MF_dds_8gpu.yaml +27 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-8.0GF_dds_8gpu.yaml +27 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/regnet/regnety/RegNetY-800MF_dds_8gpu.yaml +27 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/repvgg.py +309 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/resnest.py +365 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/resnet.py +364 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/resnext.py +335 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/shufflenet.py +203 -0
- dnt/third_party/fast-reid/fastreid/modeling/backbones/vision_transformer.py +399 -0
- dnt/third_party/fast-reid/fastreid/modeling/heads/__init__.py +11 -0
- dnt/third_party/fast-reid/fastreid/modeling/heads/build.py +25 -0
- dnt/third_party/fast-reid/fastreid/modeling/heads/clas_head.py +36 -0
- dnt/third_party/fast-reid/fastreid/modeling/heads/embedding_head.py +151 -0
- dnt/third_party/fast-reid/fastreid/modeling/losses/__init__.py +12 -0
- dnt/third_party/fast-reid/fastreid/modeling/losses/circle_loss.py +71 -0
- dnt/third_party/fast-reid/fastreid/modeling/losses/cross_entroy_loss.py +54 -0
- dnt/third_party/fast-reid/fastreid/modeling/losses/focal_loss.py +92 -0
- dnt/third_party/fast-reid/fastreid/modeling/losses/triplet_loss.py +113 -0
- dnt/third_party/fast-reid/fastreid/modeling/losses/utils.py +48 -0
- dnt/third_party/fast-reid/fastreid/modeling/meta_arch/__init__.py +14 -0
- dnt/third_party/fast-reid/fastreid/modeling/meta_arch/baseline.py +188 -0
- dnt/third_party/fast-reid/fastreid/modeling/meta_arch/build.py +26 -0
- dnt/third_party/fast-reid/fastreid/modeling/meta_arch/distiller.py +140 -0
- dnt/third_party/fast-reid/fastreid/modeling/meta_arch/mgn.py +394 -0
- dnt/third_party/fast-reid/fastreid/modeling/meta_arch/moco.py +126 -0
- dnt/third_party/fast-reid/fastreid/solver/__init__.py +8 -0
- dnt/third_party/fast-reid/fastreid/solver/build.py +348 -0
- dnt/third_party/fast-reid/fastreid/solver/lr_scheduler.py +66 -0
- dnt/third_party/fast-reid/fastreid/solver/optim/__init__.py +10 -0
- dnt/third_party/fast-reid/fastreid/solver/optim/lamb.py +123 -0
- dnt/third_party/fast-reid/fastreid/solver/optim/radam.py +149 -0
- dnt/third_party/fast-reid/fastreid/solver/optim/swa.py +246 -0
- dnt/third_party/fast-reid/fastreid/utils/__init__.py +6 -0
- dnt/third_party/fast-reid/fastreid/utils/checkpoint.py +503 -0
- dnt/third_party/fast-reid/fastreid/utils/collect_env.py +158 -0
- dnt/third_party/fast-reid/fastreid/utils/comm.py +255 -0
- dnt/third_party/fast-reid/fastreid/utils/compute_dist.py +200 -0
- dnt/third_party/fast-reid/fastreid/utils/env.py +119 -0
- dnt/third_party/fast-reid/fastreid/utils/events.py +461 -0
- dnt/third_party/fast-reid/fastreid/utils/faiss_utils.py +127 -0
- dnt/third_party/fast-reid/fastreid/utils/file_io.py +520 -0
- dnt/third_party/fast-reid/fastreid/utils/history_buffer.py +71 -0
- dnt/third_party/fast-reid/fastreid/utils/logger.py +211 -0
- dnt/third_party/fast-reid/fastreid/utils/params.py +103 -0
- dnt/third_party/fast-reid/fastreid/utils/precision_bn.py +94 -0
- dnt/third_party/fast-reid/fastreid/utils/registry.py +66 -0
- dnt/third_party/fast-reid/fastreid/utils/summary.py +120 -0
- dnt/third_party/fast-reid/fastreid/utils/timer.py +68 -0
- dnt/third_party/fast-reid/fastreid/utils/visualizer.py +278 -0
- dnt/track/__init__.py +3 -1
- dnt/track/botsort/__init__.py +4 -0
- dnt/track/botsort/bot_tracker/__init__.py +3 -0
- dnt/track/botsort/bot_tracker/basetrack.py +60 -0
- dnt/track/botsort/bot_tracker/bot_sort.py +473 -0
- dnt/track/botsort/bot_tracker/gmc.py +316 -0
- dnt/track/botsort/bot_tracker/kalman_filter.py +269 -0
- dnt/track/botsort/bot_tracker/matching.py +194 -0
- dnt/track/botsort/bot_tracker/mc_bot_sort.py +505 -0
- dnt/track/{dsort/utils → botsort/bot_tracker/tracking_utils}/evaluation.py +14 -4
- dnt/track/{dsort/utils → botsort/bot_tracker/tracking_utils}/io.py +19 -36
- dnt/track/botsort/bot_tracker/tracking_utils/timer.py +37 -0
- dnt/track/botsort/inference.py +96 -0
- dnt/track/config.py +120 -0
- dnt/track/dsort/configs/bagtricks_R50.yml +7 -0
- dnt/track/dsort/configs/deep_sort.yaml +0 -0
- dnt/track/dsort/configs/fastreid.yaml +1 -1
- dnt/track/dsort/deep_sort/deep/checkpoint/ckpt.t7 +0 -0
- dnt/track/dsort/deep_sort/deep/feature_extractor.py +87 -8
- dnt/track/dsort/deep_sort/deep_sort.py +31 -21
- dnt/track/dsort/deep_sort/sort/detection.py +2 -1
- dnt/track/dsort/deep_sort/sort/iou_matching.py +0 -2
- dnt/track/dsort/deep_sort/sort/linear_assignment.py +0 -3
- dnt/track/dsort/deep_sort/sort/nn_matching.py +5 -5
- dnt/track/dsort/deep_sort/sort/preprocessing.py +1 -2
- dnt/track/dsort/deep_sort/sort/track.py +2 -1
- dnt/track/dsort/deep_sort/sort/tracker.py +1 -1
- dnt/track/dsort/dsort.py +44 -27
- dnt/track/re_class.py +117 -0
- dnt/track/sort/sort.py +9 -7
- dnt/track/tracker.py +225 -20
- dnt-0.3.1.8.dist-info/METADATA +117 -0
- dnt-0.3.1.8.dist-info/RECORD +315 -0
- {dnt-0.2.1.dist-info → dnt-0.3.1.8.dist-info}/WHEEL +1 -1
- dnt/track/dsort/deep_sort/deep/evaluate.py +0 -15
- dnt/track/dsort/deep_sort/deep/original_model.py +0 -106
- dnt/track/dsort/deep_sort/deep/test.py +0 -77
- dnt/track/dsort/deep_sort/deep/train.py +0 -189
- dnt/track/dsort/utils/asserts.py +0 -13
- dnt/track/dsort/utils/draw.py +0 -36
- dnt/track/dsort/utils/json_logger.py +0 -383
- dnt/track/dsort/utils/log.py +0 -17
- dnt/track/dsort/utils/parser.py +0 -35
- dnt/track/dsort/utils/tools.py +0 -39
- dnt-0.2.1.dist-info/METADATA +0 -35
- dnt-0.2.1.dist-info/RECORD +0 -60
- /dnt/{track/dsort/utils → third_party/fast-reid/checkpoint}/__init__.py +0 -0
- {dnt-0.2.1.dist-info → dnt-0.3.1.8.dist-info/licenses}/LICENSE +0 -0
- {dnt-0.2.1.dist-info → dnt-0.3.1.8.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
"""
|
|
3
|
+
@author: liaoxingyu
|
|
4
|
+
@contact: sherlockliao01@gmail.com
|
|
5
|
+
"""
|
|
6
|
+
import torch
|
|
7
|
+
import numpy as np
|
|
8
|
+
from PIL import Image, ImageOps
|
|
9
|
+
import threading
|
|
10
|
+
|
|
11
|
+
import queue
|
|
12
|
+
from torch.utils.data import DataLoader
|
|
13
|
+
|
|
14
|
+
from fastreid.utils.file_io import PathManager
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def read_image(file_name, format=None):
|
|
18
|
+
"""
|
|
19
|
+
Read an image into the given format.
|
|
20
|
+
Will apply rotation and flipping if the image has such exif information.
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
file_name (str): image file path
|
|
24
|
+
format (str): one of the supported image modes in PIL, or "BGR"
|
|
25
|
+
Returns:
|
|
26
|
+
image (np.ndarray): an HWC image
|
|
27
|
+
"""
|
|
28
|
+
with PathManager.open(file_name, "rb") as f:
|
|
29
|
+
image = Image.open(f)
|
|
30
|
+
|
|
31
|
+
# work around this bug: https://github.com/python-pillow/Pillow/issues/3973
|
|
32
|
+
try:
|
|
33
|
+
image = ImageOps.exif_transpose(image)
|
|
34
|
+
except Exception:
|
|
35
|
+
pass
|
|
36
|
+
|
|
37
|
+
if format is not None:
|
|
38
|
+
# PIL only supports RGB, so convert to RGB and flip channels over below
|
|
39
|
+
conversion_format = format
|
|
40
|
+
if format == "BGR":
|
|
41
|
+
conversion_format = "RGB"
|
|
42
|
+
image = image.convert(conversion_format)
|
|
43
|
+
image = np.asarray(image)
|
|
44
|
+
|
|
45
|
+
# PIL squeezes out the channel dimension for "L", so make it HWC
|
|
46
|
+
if format == "L":
|
|
47
|
+
image = np.expand_dims(image, -1)
|
|
48
|
+
|
|
49
|
+
# handle formats not supported by PIL
|
|
50
|
+
elif format == "BGR":
|
|
51
|
+
# flip channels if needed
|
|
52
|
+
image = image[:, :, ::-1]
|
|
53
|
+
|
|
54
|
+
# handle grayscale mixed in RGB images
|
|
55
|
+
elif len(image.shape) == 2:
|
|
56
|
+
image = np.repeat(image[..., np.newaxis], 3, axis=-1)
|
|
57
|
+
|
|
58
|
+
image = Image.fromarray(image)
|
|
59
|
+
|
|
60
|
+
return image
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
"""
|
|
64
|
+
#based on http://stackoverflow.com/questions/7323664/python-generator-pre-fetch
|
|
65
|
+
This is a single-function package that transforms arbitrary generator into a background-thead generator that
|
|
66
|
+
prefetches several batches of data in a parallel background thead.
|
|
67
|
+
|
|
68
|
+
This is useful if you have a computationally heavy process (CPU or GPU) that
|
|
69
|
+
iteratively processes minibatches from the generator while the generator
|
|
70
|
+
consumes some other resource (disk IO / loading from database / more CPU if you have unused cores).
|
|
71
|
+
|
|
72
|
+
By default these two processes will constantly wait for one another to finish. If you make generator work in
|
|
73
|
+
prefetch mode (see examples below), they will work in parallel, potentially saving you your GPU time.
|
|
74
|
+
We personally use the prefetch generator when iterating minibatches of data for deep learning with PyTorch etc.
|
|
75
|
+
|
|
76
|
+
Quick usage example (ipython notebook) - https://github.com/justheuristic/prefetch_generator/blob/master/example.ipynb
|
|
77
|
+
This package contains this object
|
|
78
|
+
- BackgroundGenerator(any_other_generator[,max_prefetch = something])
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class BackgroundGenerator(threading.Thread):
|
|
83
|
+
"""
|
|
84
|
+
the usage is below
|
|
85
|
+
>> for batch in BackgroundGenerator(my_minibatch_iterator):
|
|
86
|
+
>> doit()
|
|
87
|
+
More details are written in the BackgroundGenerator doc
|
|
88
|
+
>> help(BackgroundGenerator)
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
def __init__(self, generator, local_rank, max_prefetch=10):
|
|
92
|
+
"""
|
|
93
|
+
This function transforms generator into a background-thead generator.
|
|
94
|
+
:param generator: generator or genexp or any
|
|
95
|
+
It can be used with any minibatch generator.
|
|
96
|
+
|
|
97
|
+
It is quite lightweight, but not entirely weightless.
|
|
98
|
+
Using global variables inside generator is not recommended (may raise GIL and zero-out the
|
|
99
|
+
benefit of having a background thread.)
|
|
100
|
+
The ideal use case is when everything it requires is store inside it and everything it
|
|
101
|
+
outputs is passed through queue.
|
|
102
|
+
|
|
103
|
+
There's no restriction on doing weird stuff, reading/writing files, retrieving
|
|
104
|
+
URLs [or whatever] wlilst iterating.
|
|
105
|
+
|
|
106
|
+
:param max_prefetch: defines, how many iterations (at most) can background generator keep
|
|
107
|
+
stored at any moment of time.
|
|
108
|
+
Whenever there's already max_prefetch batches stored in queue, the background process will halt until
|
|
109
|
+
one of these batches is dequeued.
|
|
110
|
+
|
|
111
|
+
!Default max_prefetch=1 is okay unless you deal with some weird file IO in your generator!
|
|
112
|
+
|
|
113
|
+
Setting max_prefetch to -1 lets it store as many batches as it can, which will work
|
|
114
|
+
slightly (if any) faster, but will require storing
|
|
115
|
+
all batches in memory. If you use infinite generator with max_prefetch=-1, it will exceed the RAM size
|
|
116
|
+
unless dequeued quickly enough.
|
|
117
|
+
"""
|
|
118
|
+
super().__init__()
|
|
119
|
+
self.queue = queue.Queue(max_prefetch)
|
|
120
|
+
self.generator = generator
|
|
121
|
+
self.local_rank = local_rank
|
|
122
|
+
self.daemon = True
|
|
123
|
+
self.exit_event = threading.Event()
|
|
124
|
+
self.start()
|
|
125
|
+
|
|
126
|
+
def run(self):
|
|
127
|
+
torch.cuda.set_device(self.local_rank)
|
|
128
|
+
for item in self.generator:
|
|
129
|
+
if self.exit_event.is_set():
|
|
130
|
+
break
|
|
131
|
+
self.queue.put(item)
|
|
132
|
+
self.queue.put(None)
|
|
133
|
+
|
|
134
|
+
def next(self):
|
|
135
|
+
next_item = self.queue.get()
|
|
136
|
+
if next_item is None:
|
|
137
|
+
raise StopIteration
|
|
138
|
+
return next_item
|
|
139
|
+
|
|
140
|
+
# Python 3 compatibility
|
|
141
|
+
def __next__(self):
|
|
142
|
+
return self.next()
|
|
143
|
+
|
|
144
|
+
def __iter__(self):
|
|
145
|
+
return self
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
class DataLoaderX(DataLoader):
|
|
149
|
+
def __init__(self, local_rank, **kwargs):
|
|
150
|
+
super().__init__(**kwargs)
|
|
151
|
+
self.stream = torch.cuda.Stream(
|
|
152
|
+
local_rank
|
|
153
|
+
) # create a new cuda stream in each process
|
|
154
|
+
self.local_rank = local_rank
|
|
155
|
+
|
|
156
|
+
def __iter__(self):
|
|
157
|
+
self.iter = super().__iter__()
|
|
158
|
+
self.iter = BackgroundGenerator(self.iter, self.local_rank)
|
|
159
|
+
self.preload()
|
|
160
|
+
return self
|
|
161
|
+
|
|
162
|
+
def _shutdown_background_thread(self):
|
|
163
|
+
if not self.iter.is_alive():
|
|
164
|
+
# avoid re-entrance or ill-conditioned thread state
|
|
165
|
+
return
|
|
166
|
+
|
|
167
|
+
# Set exit event to True for background threading stopping
|
|
168
|
+
self.iter.exit_event.set()
|
|
169
|
+
|
|
170
|
+
# Exhaust all remaining elements, so that the queue becomes empty,
|
|
171
|
+
# and the thread should quit
|
|
172
|
+
for _ in self.iter:
|
|
173
|
+
pass
|
|
174
|
+
|
|
175
|
+
# Waiting for background thread to quit
|
|
176
|
+
self.iter.join()
|
|
177
|
+
|
|
178
|
+
def preload(self):
|
|
179
|
+
self.batch = next(self.iter, None)
|
|
180
|
+
if self.batch is None:
|
|
181
|
+
return None
|
|
182
|
+
with torch.cuda.stream(self.stream):
|
|
183
|
+
for k in self.batch:
|
|
184
|
+
if isinstance(self.batch[k], torch.Tensor):
|
|
185
|
+
self.batch[k] = self.batch[k].to(
|
|
186
|
+
device=self.local_rank, non_blocking=True
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
def __next__(self):
|
|
190
|
+
torch.cuda.current_stream().wait_stream(
|
|
191
|
+
self.stream
|
|
192
|
+
) # wait tensor to put on GPU
|
|
193
|
+
batch = self.batch
|
|
194
|
+
if batch is None:
|
|
195
|
+
raise StopIteration
|
|
196
|
+
self.preload()
|
|
197
|
+
return batch
|
|
198
|
+
|
|
199
|
+
# Signal for shutting down background thread
|
|
200
|
+
def shutdown(self):
|
|
201
|
+
# If the dataloader is to be freed, shutdown its BackgroundGenerator
|
|
202
|
+
self._shutdown_background_thread()
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
"""
|
|
3
|
+
@author: xingyu liao
|
|
4
|
+
@contact: sherlockliao01@gmail.com
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
|
|
9
|
+
from fastreid.data.datasets import DATASET_REGISTRY
|
|
10
|
+
from fastreid.data.datasets.bases import ImageDataset
|
|
11
|
+
|
|
12
|
+
__all__ = ['AirportALERT', ]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@DATASET_REGISTRY.register()
|
|
16
|
+
class AirportALERT(ImageDataset):
|
|
17
|
+
"""Airport
|
|
18
|
+
|
|
19
|
+
"""
|
|
20
|
+
dataset_dir = "AirportALERT"
|
|
21
|
+
dataset_name = "airport"
|
|
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
|
+
self.train_file = os.path.join(self.root, self.dataset_dir, 'filepath.txt')
|
|
27
|
+
|
|
28
|
+
required_files = [self.train_file, self.train_path]
|
|
29
|
+
self.check_before_run(required_files)
|
|
30
|
+
|
|
31
|
+
train = self.process_train(self.train_path, self.train_file)
|
|
32
|
+
|
|
33
|
+
super().__init__(train, [], [], **kwargs)
|
|
34
|
+
|
|
35
|
+
def process_train(self, dir_path, train_file):
|
|
36
|
+
data = []
|
|
37
|
+
with open(train_file, "r") as f:
|
|
38
|
+
img_paths = [line.strip('\n') for line in f.readlines()]
|
|
39
|
+
|
|
40
|
+
for path in img_paths:
|
|
41
|
+
split_path = path.split('\\')
|
|
42
|
+
img_path = '/'.join(split_path)
|
|
43
|
+
camid = self.dataset_name + "_" + split_path[0]
|
|
44
|
+
pid = self.dataset_name + "_" + split_path[1]
|
|
45
|
+
img_path = os.path.join(dir_path, img_path)
|
|
46
|
+
# if 11001 <= int(split_path[1]) <= 401999:
|
|
47
|
+
if 11001 <= int(split_path[1]):
|
|
48
|
+
data.append([img_path, pid, camid])
|
|
49
|
+
|
|
50
|
+
return data
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
"""
|
|
3
|
+
@author: liaoxingyu
|
|
4
|
+
@contact: sherlockliao01@gmail.com
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from ...utils.registry import Registry
|
|
8
|
+
|
|
9
|
+
DATASET_REGISTRY = Registry("DATASET")
|
|
10
|
+
DATASET_REGISTRY.__doc__ = """
|
|
11
|
+
Registry for datasets
|
|
12
|
+
It must returns an instance of :class:`Backbone`.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
# Person re-id datasets
|
|
16
|
+
from .cuhk03 import CUHK03
|
|
17
|
+
from .dukemtmcreid import DukeMTMC
|
|
18
|
+
from .market1501 import Market1501
|
|
19
|
+
from .msmt17 import MSMT17
|
|
20
|
+
from .AirportALERT import AirportALERT
|
|
21
|
+
from .iLIDS import iLIDS
|
|
22
|
+
from .pku import PKU
|
|
23
|
+
from .prai import PRAI
|
|
24
|
+
from .prid import PRID
|
|
25
|
+
from .grid import GRID
|
|
26
|
+
from .saivt import SAIVT
|
|
27
|
+
from .sensereid import SenseReID
|
|
28
|
+
from .sysu_mm import SYSU_mm
|
|
29
|
+
from .thermalworld import Thermalworld
|
|
30
|
+
from .pes3d import PeS3D
|
|
31
|
+
from .caviara import CAVIARa
|
|
32
|
+
from .viper import VIPeR
|
|
33
|
+
from .lpw import LPW
|
|
34
|
+
from .shinpuhkan import Shinpuhkan
|
|
35
|
+
from .wildtracker import WildTrackCrop
|
|
36
|
+
from .cuhk_sysu import cuhkSYSU
|
|
37
|
+
|
|
38
|
+
# Vehicle re-id datasets
|
|
39
|
+
from .veri import VeRi
|
|
40
|
+
from .vehicleid import VehicleID, SmallVehicleID, MediumVehicleID, LargeVehicleID
|
|
41
|
+
from .veriwild import VeRiWild, SmallVeRiWild, MediumVeRiWild, LargeVeRiWild
|
|
42
|
+
|
|
43
|
+
__all__ = [k for k in globals().keys() if "builtin" not in k and not k.startswith("_")]
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
"""
|
|
3
|
+
@author: sherlock
|
|
4
|
+
@contact: sherlockliao01@gmail.com
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import copy
|
|
8
|
+
import logging
|
|
9
|
+
import os
|
|
10
|
+
|
|
11
|
+
from tabulate import tabulate
|
|
12
|
+
from termcolor import colored
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger(__name__)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class Dataset(object):
|
|
18
|
+
"""An abstract class representing a Dataset.
|
|
19
|
+
This is the base class for ``ImageDataset`` and ``VideoDataset``.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
train (list or Callable): contains tuples of (img_path(s), pid, camid).
|
|
23
|
+
query (list or Callable): contains tuples of (img_path(s), pid, camid).
|
|
24
|
+
gallery (list or Callable): contains tuples of (img_path(s), pid, camid).
|
|
25
|
+
transform: transform function.
|
|
26
|
+
mode (str): 'train', 'query' or 'gallery'.
|
|
27
|
+
combineall (bool): combines train, query and gallery in a
|
|
28
|
+
dataset for training.
|
|
29
|
+
verbose (bool): show information.
|
|
30
|
+
"""
|
|
31
|
+
_junk_pids = [] # contains useless person IDs, e.g. background, false detections
|
|
32
|
+
|
|
33
|
+
def __init__(self, train, query, gallery, transform=None, mode='train',
|
|
34
|
+
combineall=False, verbose=True, **kwargs):
|
|
35
|
+
self._train = train
|
|
36
|
+
self._query = query
|
|
37
|
+
self._gallery = gallery
|
|
38
|
+
self.transform = transform
|
|
39
|
+
self.mode = mode
|
|
40
|
+
self.combineall = combineall
|
|
41
|
+
self.verbose = verbose
|
|
42
|
+
|
|
43
|
+
if self.combineall:
|
|
44
|
+
self.combine_all()
|
|
45
|
+
|
|
46
|
+
if self.mode == 'train':
|
|
47
|
+
self.data = self.train
|
|
48
|
+
elif self.mode == 'query':
|
|
49
|
+
self.data = self.query
|
|
50
|
+
elif self.mode == 'gallery':
|
|
51
|
+
self.data = self.gallery
|
|
52
|
+
else:
|
|
53
|
+
raise ValueError('Invalid mode. Got {}, but expected to be '
|
|
54
|
+
'one of [train | query | gallery]'.format(self.mode))
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def train(self):
|
|
58
|
+
if callable(self._train):
|
|
59
|
+
self._train = self._train()
|
|
60
|
+
return self._train
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def query(self):
|
|
64
|
+
if callable(self._query):
|
|
65
|
+
self._query = self._query()
|
|
66
|
+
return self._query
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def gallery(self):
|
|
70
|
+
if callable(self._gallery):
|
|
71
|
+
self._gallery = self._gallery()
|
|
72
|
+
return self._gallery
|
|
73
|
+
|
|
74
|
+
def __getitem__(self, index):
|
|
75
|
+
raise NotImplementedError
|
|
76
|
+
|
|
77
|
+
def __len__(self):
|
|
78
|
+
return len(self.data)
|
|
79
|
+
|
|
80
|
+
def __radd__(self, other):
|
|
81
|
+
"""Supports sum([dataset1, dataset2, dataset3])."""
|
|
82
|
+
if other == 0:
|
|
83
|
+
return self
|
|
84
|
+
else:
|
|
85
|
+
return self.__add__(other)
|
|
86
|
+
|
|
87
|
+
def parse_data(self, data):
|
|
88
|
+
"""Parses data list and returns the number of person IDs
|
|
89
|
+
and the number of camera views.
|
|
90
|
+
Args:
|
|
91
|
+
data (list): contains tuples of (img_path(s), pid, camid)
|
|
92
|
+
"""
|
|
93
|
+
pids = set()
|
|
94
|
+
cams = set()
|
|
95
|
+
for info in data:
|
|
96
|
+
pids.add(info[1])
|
|
97
|
+
cams.add(info[2])
|
|
98
|
+
return len(pids), len(cams)
|
|
99
|
+
|
|
100
|
+
def get_num_pids(self, data):
|
|
101
|
+
"""Returns the number of training person identities."""
|
|
102
|
+
return self.parse_data(data)[0]
|
|
103
|
+
|
|
104
|
+
def get_num_cams(self, data):
|
|
105
|
+
"""Returns the number of training cameras."""
|
|
106
|
+
return self.parse_data(data)[1]
|
|
107
|
+
|
|
108
|
+
def show_summary(self):
|
|
109
|
+
"""Shows dataset statistics."""
|
|
110
|
+
pass
|
|
111
|
+
|
|
112
|
+
def combine_all(self):
|
|
113
|
+
"""Combines train, query and gallery in a dataset for training."""
|
|
114
|
+
combined = copy.deepcopy(self.train)
|
|
115
|
+
|
|
116
|
+
def _combine_data(data):
|
|
117
|
+
for img_path, pid, camid in data:
|
|
118
|
+
if pid in self._junk_pids:
|
|
119
|
+
continue
|
|
120
|
+
pid = getattr(self, "dataset_name", "Unknown") + "_test_" + str(pid)
|
|
121
|
+
camid = getattr(self, "dataset_name", "Unknown") + "_test_" + str(camid)
|
|
122
|
+
combined.append((img_path, pid, camid))
|
|
123
|
+
|
|
124
|
+
_combine_data(self.query)
|
|
125
|
+
_combine_data(self.gallery)
|
|
126
|
+
|
|
127
|
+
self._train = combined
|
|
128
|
+
|
|
129
|
+
def check_before_run(self, required_files):
|
|
130
|
+
"""Checks if required files exist before going deeper.
|
|
131
|
+
Args:
|
|
132
|
+
required_files (str or list): string file name(s).
|
|
133
|
+
"""
|
|
134
|
+
if isinstance(required_files, str):
|
|
135
|
+
required_files = [required_files]
|
|
136
|
+
|
|
137
|
+
for fpath in required_files:
|
|
138
|
+
if not os.path.exists(fpath):
|
|
139
|
+
raise RuntimeError('"{}" is not found'.format(fpath))
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
class ImageDataset(Dataset):
|
|
143
|
+
"""A base class representing ImageDataset.
|
|
144
|
+
All other image datasets should subclass it.
|
|
145
|
+
``__getitem__`` returns an image given index.
|
|
146
|
+
It will return ``img``, ``pid``, ``camid`` and ``img_path``
|
|
147
|
+
where ``img`` has shape (channel, height, width). As a result,
|
|
148
|
+
data in each batch has shape (batch_size, channel, height, width).
|
|
149
|
+
"""
|
|
150
|
+
|
|
151
|
+
def show_train(self):
|
|
152
|
+
num_train_pids, num_train_cams = self.parse_data(self.train)
|
|
153
|
+
|
|
154
|
+
headers = ['subset', '# ids', '# images', '# cameras']
|
|
155
|
+
csv_results = [['train', num_train_pids, len(self.train), num_train_cams]]
|
|
156
|
+
|
|
157
|
+
# tabulate it
|
|
158
|
+
table = tabulate(
|
|
159
|
+
csv_results,
|
|
160
|
+
tablefmt="pipe",
|
|
161
|
+
headers=headers,
|
|
162
|
+
numalign="left",
|
|
163
|
+
)
|
|
164
|
+
logger.info(f"=> Loaded {self.__class__.__name__} in csv format: \n" + colored(table, "cyan"))
|
|
165
|
+
|
|
166
|
+
def show_test(self):
|
|
167
|
+
num_query_pids, num_query_cams = self.parse_data(self.query)
|
|
168
|
+
num_gallery_pids, num_gallery_cams = self.parse_data(self.gallery)
|
|
169
|
+
|
|
170
|
+
headers = ['subset', '# ids', '# images', '# cameras']
|
|
171
|
+
csv_results = [
|
|
172
|
+
['query', num_query_pids, len(self.query), num_query_cams],
|
|
173
|
+
['gallery', num_gallery_pids, len(self.gallery), num_gallery_cams],
|
|
174
|
+
]
|
|
175
|
+
|
|
176
|
+
# tabulate it
|
|
177
|
+
table = tabulate(
|
|
178
|
+
csv_results,
|
|
179
|
+
tablefmt="pipe",
|
|
180
|
+
headers=headers,
|
|
181
|
+
numalign="left",
|
|
182
|
+
)
|
|
183
|
+
logger.info(f"=> Loaded {self.__class__.__name__} in csv format: \n" + colored(table, "cyan"))
|
|
@@ -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__ = ['CAVIARa', ]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@DATASET_REGISTRY.register()
|
|
17
|
+
class CAVIARa(ImageDataset):
|
|
18
|
+
"""CAVIARa
|
|
19
|
+
"""
|
|
20
|
+
dataset_dir = "CAVIARa"
|
|
21
|
+
dataset_name = "caviara"
|
|
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
|
+
img_list = glob(os.path.join(train_path, "*.jpg"))
|
|
38
|
+
for img_path in img_list:
|
|
39
|
+
img_name = img_path.split('/')[-1]
|
|
40
|
+
pid = self.dataset_name + "_" + img_name[:4]
|
|
41
|
+
camid = self.dataset_name + "_cam0"
|
|
42
|
+
data.append([img_path, pid, camid])
|
|
43
|
+
|
|
44
|
+
return data
|