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.
- dnt/__init__.py +3 -2
- dnt/analysis/__init__.py +3 -2
- dnt/analysis/count.py +54 -37
- dnt/analysis/interaction2.py +518 -0
- dnt/analysis/stop.py +22 -17
- dnt/analysis/stop2.py +289 -0
- dnt/analysis/stop3.py +758 -0
- dnt/detect/signal/detector.py +326 -0
- dnt/detect/timestamp.py +105 -0
- dnt/detect/yolov8/detector.py +179 -36
- dnt/detect/yolov8/segmentor.py +60 -2
- 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/filter.py +333 -2
- dnt/label/labeler.py +4 -4
- dnt/label/labeler2.py +605 -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 +2 -0
- 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 -20
- 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 +43 -33
- dnt/track/re_class.py +117 -0
- dnt/track/sort/sort.py +9 -6
- dnt/track/tracker.py +213 -32
- {dnt-0.2.4.dist-info → dnt-0.3.1.7.dist-info}/METADATA +41 -13
- dnt-0.3.1.7.dist-info/RECORD +315 -0
- {dnt-0.2.4.dist-info → dnt-0.3.1.7.dist-info}/WHEEL +1 -1
- dnt/analysis/yield.py +0 -9
- 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.4.dist-info/RECORD +0 -64
- /dnt/{track/dsort/utils → third_party/fast-reid/checkpoint}/__init__.py +0 -0
- {dnt-0.2.4.dist-info → dnt-0.3.1.7.dist-info/licenses}/LICENSE +0 -0
- {dnt-0.2.4.dist-info → dnt-0.3.1.7.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
from .config import CfgNode as CN
|
|
2
|
+
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
# Convention about Training / Test specific parameters
|
|
5
|
+
# -----------------------------------------------------------------------------
|
|
6
|
+
# Whenever an argument can be either used for training or for testing, the
|
|
7
|
+
# corresponding name will be post-fixed by a _TRAIN for a training parameter,
|
|
8
|
+
# or _TEST for a test-specific parameter.
|
|
9
|
+
# For example, the number of images during training will be
|
|
10
|
+
# IMAGES_PER_BATCH_TRAIN, while the number of images for testing will be
|
|
11
|
+
# IMAGES_PER_BATCH_TEST
|
|
12
|
+
|
|
13
|
+
# -----------------------------------------------------------------------------
|
|
14
|
+
# Config definition
|
|
15
|
+
# -----------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
_C = CN()
|
|
18
|
+
|
|
19
|
+
# -----------------------------------------------------------------------------
|
|
20
|
+
# MODEL
|
|
21
|
+
# -----------------------------------------------------------------------------
|
|
22
|
+
_C.MODEL = CN()
|
|
23
|
+
_C.MODEL.DEVICE = "cuda"
|
|
24
|
+
_C.MODEL.META_ARCHITECTURE = "Baseline"
|
|
25
|
+
|
|
26
|
+
_C.MODEL.FREEZE_LAYERS = []
|
|
27
|
+
|
|
28
|
+
# MoCo memory size
|
|
29
|
+
_C.MODEL.QUEUE_SIZE = 8192
|
|
30
|
+
|
|
31
|
+
# ---------------------------------------------------------------------------- #
|
|
32
|
+
# Backbone options
|
|
33
|
+
# ---------------------------------------------------------------------------- #
|
|
34
|
+
_C.MODEL.BACKBONE = CN()
|
|
35
|
+
|
|
36
|
+
_C.MODEL.BACKBONE.NAME = "build_resnet_backbone"
|
|
37
|
+
_C.MODEL.BACKBONE.DEPTH = "50x"
|
|
38
|
+
_C.MODEL.BACKBONE.LAST_STRIDE = 1
|
|
39
|
+
# Backbone feature dimension
|
|
40
|
+
_C.MODEL.BACKBONE.FEAT_DIM = 2048
|
|
41
|
+
# Normalization method for the convolution layers.
|
|
42
|
+
_C.MODEL.BACKBONE.NORM = "BN"
|
|
43
|
+
# If use IBN block in backbone
|
|
44
|
+
_C.MODEL.BACKBONE.WITH_IBN = False
|
|
45
|
+
# If use SE block in backbone
|
|
46
|
+
_C.MODEL.BACKBONE.WITH_SE = False
|
|
47
|
+
# If use Non-local block in backbone
|
|
48
|
+
_C.MODEL.BACKBONE.WITH_NL = False
|
|
49
|
+
# Vision Transformer options
|
|
50
|
+
_C.MODEL.BACKBONE.SIE_COE = 3.0
|
|
51
|
+
_C.MODEL.BACKBONE.STRIDE_SIZE = (16, 16)
|
|
52
|
+
_C.MODEL.BACKBONE.DROP_PATH_RATIO = 0.1
|
|
53
|
+
_C.MODEL.BACKBONE.DROP_RATIO = 0.0
|
|
54
|
+
_C.MODEL.BACKBONE.ATT_DROP_RATE = 0.0
|
|
55
|
+
# If use ImageNet pretrain model
|
|
56
|
+
_C.MODEL.BACKBONE.PRETRAIN = False
|
|
57
|
+
# Pretrain model path
|
|
58
|
+
_C.MODEL.BACKBONE.PRETRAIN_PATH = ''
|
|
59
|
+
|
|
60
|
+
# ---------------------------------------------------------------------------- #
|
|
61
|
+
# REID HEADS options
|
|
62
|
+
# ---------------------------------------------------------------------------- #
|
|
63
|
+
_C.MODEL.HEADS = CN()
|
|
64
|
+
_C.MODEL.HEADS.NAME = "EmbeddingHead"
|
|
65
|
+
# Normalization method for the convolution layers.
|
|
66
|
+
_C.MODEL.HEADS.NORM = "BN"
|
|
67
|
+
# Number of identity
|
|
68
|
+
_C.MODEL.HEADS.NUM_CLASSES = 0
|
|
69
|
+
# Embedding dimension in head
|
|
70
|
+
_C.MODEL.HEADS.EMBEDDING_DIM = 0
|
|
71
|
+
# If use BNneck in embedding
|
|
72
|
+
_C.MODEL.HEADS.WITH_BNNECK = False
|
|
73
|
+
# Triplet feature using feature before(after) bnneck
|
|
74
|
+
_C.MODEL.HEADS.NECK_FEAT = "before" # options: before, after
|
|
75
|
+
# Pooling layer type
|
|
76
|
+
_C.MODEL.HEADS.POOL_LAYER = "GlobalAvgPool"
|
|
77
|
+
|
|
78
|
+
# Classification layer type
|
|
79
|
+
_C.MODEL.HEADS.CLS_LAYER = "Linear" # ArcSoftmax" or "CircleSoftmax"
|
|
80
|
+
|
|
81
|
+
# Margin and Scale for margin-based classification layer
|
|
82
|
+
_C.MODEL.HEADS.MARGIN = 0.
|
|
83
|
+
_C.MODEL.HEADS.SCALE = 1
|
|
84
|
+
|
|
85
|
+
# ---------------------------------------------------------------------------- #
|
|
86
|
+
# REID LOSSES options
|
|
87
|
+
# ---------------------------------------------------------------------------- #
|
|
88
|
+
_C.MODEL.LOSSES = CN()
|
|
89
|
+
_C.MODEL.LOSSES.NAME = ("CrossEntropyLoss",)
|
|
90
|
+
|
|
91
|
+
# Cross Entropy Loss options
|
|
92
|
+
_C.MODEL.LOSSES.CE = CN()
|
|
93
|
+
# if epsilon == 0, it means no label smooth regularization,
|
|
94
|
+
# if epsilon == -1, it means adaptive label smooth regularization
|
|
95
|
+
_C.MODEL.LOSSES.CE.EPSILON = 0.0
|
|
96
|
+
_C.MODEL.LOSSES.CE.ALPHA = 0.2
|
|
97
|
+
_C.MODEL.LOSSES.CE.SCALE = 1.0
|
|
98
|
+
|
|
99
|
+
# Focal Loss options
|
|
100
|
+
_C.MODEL.LOSSES.FL = CN()
|
|
101
|
+
_C.MODEL.LOSSES.FL.ALPHA = 0.25
|
|
102
|
+
_C.MODEL.LOSSES.FL.GAMMA = 2
|
|
103
|
+
_C.MODEL.LOSSES.FL.SCALE = 1.0
|
|
104
|
+
|
|
105
|
+
# Triplet Loss options
|
|
106
|
+
_C.MODEL.LOSSES.TRI = CN()
|
|
107
|
+
_C.MODEL.LOSSES.TRI.MARGIN = 0.3
|
|
108
|
+
_C.MODEL.LOSSES.TRI.NORM_FEAT = False
|
|
109
|
+
_C.MODEL.LOSSES.TRI.HARD_MINING = False
|
|
110
|
+
_C.MODEL.LOSSES.TRI.SCALE = 1.0
|
|
111
|
+
|
|
112
|
+
# Circle Loss options
|
|
113
|
+
_C.MODEL.LOSSES.CIRCLE = CN()
|
|
114
|
+
_C.MODEL.LOSSES.CIRCLE.MARGIN = 0.25
|
|
115
|
+
_C.MODEL.LOSSES.CIRCLE.GAMMA = 128
|
|
116
|
+
_C.MODEL.LOSSES.CIRCLE.SCALE = 1.0
|
|
117
|
+
|
|
118
|
+
# Cosface Loss options
|
|
119
|
+
_C.MODEL.LOSSES.COSFACE = CN()
|
|
120
|
+
_C.MODEL.LOSSES.COSFACE.MARGIN = 0.25
|
|
121
|
+
_C.MODEL.LOSSES.COSFACE.GAMMA = 128
|
|
122
|
+
_C.MODEL.LOSSES.COSFACE.SCALE = 1.0
|
|
123
|
+
|
|
124
|
+
# Path to a checkpoint file to be loaded to the model. You can find available models in the model zoo.
|
|
125
|
+
_C.MODEL.WEIGHTS = ""
|
|
126
|
+
|
|
127
|
+
# Values to be used for image normalization
|
|
128
|
+
_C.MODEL.PIXEL_MEAN = [0.485*255, 0.456*255, 0.406*255]
|
|
129
|
+
# Values to be used for image normalization
|
|
130
|
+
_C.MODEL.PIXEL_STD = [0.229*255, 0.224*255, 0.225*255]
|
|
131
|
+
|
|
132
|
+
# -----------------------------------------------------------------------------
|
|
133
|
+
# KNOWLEDGE DISTILLATION
|
|
134
|
+
# -----------------------------------------------------------------------------
|
|
135
|
+
|
|
136
|
+
_C.KD = CN()
|
|
137
|
+
_C.KD.MODEL_CONFIG = []
|
|
138
|
+
_C.KD.MODEL_WEIGHTS = []
|
|
139
|
+
_C.KD.EMA = CN({"ENABLED": False})
|
|
140
|
+
_C.KD.EMA.MOMENTUM = 0.999
|
|
141
|
+
|
|
142
|
+
# -----------------------------------------------------------------------------
|
|
143
|
+
# INPUT
|
|
144
|
+
# -----------------------------------------------------------------------------
|
|
145
|
+
_C.INPUT = CN()
|
|
146
|
+
# Size of the image during training
|
|
147
|
+
_C.INPUT.SIZE_TRAIN = [256, 128]
|
|
148
|
+
# Size of the image during test
|
|
149
|
+
_C.INPUT.SIZE_TEST = [256, 128]
|
|
150
|
+
|
|
151
|
+
# `True` if cropping is used for data augmentation during training
|
|
152
|
+
_C.INPUT.CROP = CN({"ENABLED": False})
|
|
153
|
+
# Size of the image cropped
|
|
154
|
+
_C.INPUT.CROP.SIZE = [224, 224]
|
|
155
|
+
# Size of the origin size cropped
|
|
156
|
+
_C.INPUT.CROP.SCALE = [0.16, 1]
|
|
157
|
+
# Aspect ratio of the origin aspect ratio cropped
|
|
158
|
+
_C.INPUT.CROP.RATIO = [3./4., 4./3.]
|
|
159
|
+
|
|
160
|
+
# Random probability for image horizontal flip
|
|
161
|
+
_C.INPUT.FLIP = CN({"ENABLED": False})
|
|
162
|
+
_C.INPUT.FLIP.PROB = 0.5
|
|
163
|
+
|
|
164
|
+
# Value of padding size
|
|
165
|
+
_C.INPUT.PADDING = CN({"ENABLED": False})
|
|
166
|
+
_C.INPUT.PADDING.MODE = 'constant'
|
|
167
|
+
_C.INPUT.PADDING.SIZE = 10
|
|
168
|
+
|
|
169
|
+
# Random color jitter
|
|
170
|
+
_C.INPUT.CJ = CN({"ENABLED": False})
|
|
171
|
+
_C.INPUT.CJ.PROB = 0.5
|
|
172
|
+
_C.INPUT.CJ.BRIGHTNESS = 0.15
|
|
173
|
+
_C.INPUT.CJ.CONTRAST = 0.15
|
|
174
|
+
_C.INPUT.CJ.SATURATION = 0.1
|
|
175
|
+
_C.INPUT.CJ.HUE = 0.1
|
|
176
|
+
|
|
177
|
+
# Random Affine
|
|
178
|
+
_C.INPUT.AFFINE = CN({"ENABLED": False})
|
|
179
|
+
|
|
180
|
+
# Auto augmentation
|
|
181
|
+
_C.INPUT.AUTOAUG = CN({"ENABLED": False})
|
|
182
|
+
_C.INPUT.AUTOAUG.PROB = 0.0
|
|
183
|
+
|
|
184
|
+
# Augmix augmentation
|
|
185
|
+
_C.INPUT.AUGMIX = CN({"ENABLED": False})
|
|
186
|
+
_C.INPUT.AUGMIX.PROB = 0.0
|
|
187
|
+
|
|
188
|
+
# Random Erasing
|
|
189
|
+
_C.INPUT.REA = CN({"ENABLED": False})
|
|
190
|
+
_C.INPUT.REA.PROB = 0.5
|
|
191
|
+
_C.INPUT.REA.VALUE = [0.485*255, 0.456*255, 0.406*255]
|
|
192
|
+
# Random Patch
|
|
193
|
+
_C.INPUT.RPT = CN({"ENABLED": False})
|
|
194
|
+
_C.INPUT.RPT.PROB = 0.5
|
|
195
|
+
|
|
196
|
+
# -----------------------------------------------------------------------------
|
|
197
|
+
# Dataset
|
|
198
|
+
# -----------------------------------------------------------------------------
|
|
199
|
+
_C.DATASETS = CN()
|
|
200
|
+
# List of the dataset names for training
|
|
201
|
+
_C.DATASETS.NAMES = ("Market1501",)
|
|
202
|
+
# List of the dataset names for testing
|
|
203
|
+
_C.DATASETS.TESTS = ("Market1501",)
|
|
204
|
+
# Combine trainset and testset joint training
|
|
205
|
+
_C.DATASETS.COMBINEALL = False
|
|
206
|
+
|
|
207
|
+
# -----------------------------------------------------------------------------
|
|
208
|
+
# DataLoader
|
|
209
|
+
# -----------------------------------------------------------------------------
|
|
210
|
+
_C.DATALOADER = CN()
|
|
211
|
+
# Options: TrainingSampler, NaiveIdentitySampler, BalancedIdentitySampler
|
|
212
|
+
_C.DATALOADER.SAMPLER_TRAIN = "TrainingSampler"
|
|
213
|
+
# Number of instance for each person
|
|
214
|
+
_C.DATALOADER.NUM_INSTANCE = 4
|
|
215
|
+
_C.DATALOADER.NUM_WORKERS = 8
|
|
216
|
+
|
|
217
|
+
# For set re-weight
|
|
218
|
+
_C.DATALOADER.SET_WEIGHT = []
|
|
219
|
+
|
|
220
|
+
# ---------------------------------------------------------------------------- #
|
|
221
|
+
# Solver
|
|
222
|
+
# ---------------------------------------------------------------------------- #
|
|
223
|
+
_C.SOLVER = CN()
|
|
224
|
+
|
|
225
|
+
# AUTOMATIC MIXED PRECISION
|
|
226
|
+
_C.SOLVER.AMP = CN({"ENABLED": False})
|
|
227
|
+
|
|
228
|
+
# Optimizer
|
|
229
|
+
_C.SOLVER.OPT = "Adam"
|
|
230
|
+
|
|
231
|
+
_C.SOLVER.MAX_EPOCH = 120
|
|
232
|
+
|
|
233
|
+
_C.SOLVER.BASE_LR = 3e-4
|
|
234
|
+
|
|
235
|
+
# This LR is applied to the last classification layer if
|
|
236
|
+
# you want to 10x higher than BASE_LR.
|
|
237
|
+
_C.SOLVER.HEADS_LR_FACTOR = 1.
|
|
238
|
+
|
|
239
|
+
_C.SOLVER.MOMENTUM = 0.9
|
|
240
|
+
_C.SOLVER.NESTEROV = False
|
|
241
|
+
|
|
242
|
+
_C.SOLVER.WEIGHT_DECAY = 0.0005
|
|
243
|
+
# The weight decay that's applied to parameters of normalization layers
|
|
244
|
+
# (typically the affine transformation)
|
|
245
|
+
_C.SOLVER.WEIGHT_DECAY_NORM = 0.0005
|
|
246
|
+
|
|
247
|
+
# The previous detection code used a 2x higher LR and 0 WD for bias.
|
|
248
|
+
# This is not useful (at least for recent models). You should avoid
|
|
249
|
+
# changing these and they exists only to reproduce previous model
|
|
250
|
+
# training if desired.
|
|
251
|
+
_C.SOLVER.BIAS_LR_FACTOR = 1.0
|
|
252
|
+
_C.SOLVER.WEIGHT_DECAY_BIAS = _C.SOLVER.WEIGHT_DECAY
|
|
253
|
+
|
|
254
|
+
# Multi-step learning rate options
|
|
255
|
+
_C.SOLVER.SCHED = "MultiStepLR"
|
|
256
|
+
|
|
257
|
+
_C.SOLVER.DELAY_EPOCHS = 0
|
|
258
|
+
|
|
259
|
+
_C.SOLVER.GAMMA = 0.1
|
|
260
|
+
_C.SOLVER.STEPS = [30, 55]
|
|
261
|
+
|
|
262
|
+
# Cosine annealing learning rate options
|
|
263
|
+
_C.SOLVER.ETA_MIN_LR = 1e-7
|
|
264
|
+
|
|
265
|
+
# Warmup options
|
|
266
|
+
_C.SOLVER.WARMUP_FACTOR = 0.1
|
|
267
|
+
_C.SOLVER.WARMUP_ITERS = 1000
|
|
268
|
+
_C.SOLVER.WARMUP_METHOD = "linear"
|
|
269
|
+
|
|
270
|
+
# Backbone freeze iters
|
|
271
|
+
_C.SOLVER.FREEZE_ITERS = 0
|
|
272
|
+
|
|
273
|
+
_C.SOLVER.CHECKPOINT_PERIOD = 20
|
|
274
|
+
|
|
275
|
+
# Number of images per batch across all machines.
|
|
276
|
+
# This is global, so if we have 8 GPUs and IMS_PER_BATCH = 256, each GPU will
|
|
277
|
+
# see 32 images per batch
|
|
278
|
+
_C.SOLVER.IMS_PER_BATCH = 64
|
|
279
|
+
|
|
280
|
+
# Gradient clipping
|
|
281
|
+
_C.SOLVER.CLIP_GRADIENTS = CN({"ENABLED": False})
|
|
282
|
+
# Type of gradient clipping, currently 2 values are supported:
|
|
283
|
+
# - "value": the absolute values of elements of each gradients are clipped
|
|
284
|
+
# - "norm": the norm of the gradient for each parameter is clipped thus
|
|
285
|
+
# affecting all elements in the parameter
|
|
286
|
+
_C.SOLVER.CLIP_GRADIENTS.CLIP_TYPE = "norm"
|
|
287
|
+
# Maximum absolute value used for clipping gradients
|
|
288
|
+
_C.SOLVER.CLIP_GRADIENTS.CLIP_VALUE = 5.0
|
|
289
|
+
# Floating point number p for L-p norm to be used with the "norm"
|
|
290
|
+
# gradient clipping type; for L-inf, please specify .inf
|
|
291
|
+
_C.SOLVER.CLIP_GRADIENTS.NORM_TYPE = 2.0
|
|
292
|
+
|
|
293
|
+
_C.TEST = CN()
|
|
294
|
+
|
|
295
|
+
_C.TEST.EVAL_PERIOD = 20
|
|
296
|
+
|
|
297
|
+
# Number of images per batch across all machines.
|
|
298
|
+
_C.TEST.IMS_PER_BATCH = 64
|
|
299
|
+
_C.TEST.METRIC = "cosine"
|
|
300
|
+
_C.TEST.ROC = CN({"ENABLED": False})
|
|
301
|
+
_C.TEST.FLIP = CN({"ENABLED": False})
|
|
302
|
+
|
|
303
|
+
# Average query expansion
|
|
304
|
+
_C.TEST.AQE = CN({"ENABLED": False})
|
|
305
|
+
_C.TEST.AQE.ALPHA = 3.0
|
|
306
|
+
_C.TEST.AQE.QE_TIME = 1
|
|
307
|
+
_C.TEST.AQE.QE_K = 5
|
|
308
|
+
|
|
309
|
+
# Re-rank
|
|
310
|
+
_C.TEST.RERANK = CN({"ENABLED": False})
|
|
311
|
+
_C.TEST.RERANK.K1 = 20
|
|
312
|
+
_C.TEST.RERANK.K2 = 6
|
|
313
|
+
_C.TEST.RERANK.LAMBDA = 0.3
|
|
314
|
+
|
|
315
|
+
# Precise batchnorm
|
|
316
|
+
_C.TEST.PRECISE_BN = CN({"ENABLED": False})
|
|
317
|
+
_C.TEST.PRECISE_BN.DATASET = 'Market1501'
|
|
318
|
+
_C.TEST.PRECISE_BN.NUM_ITER = 300
|
|
319
|
+
|
|
320
|
+
# ---------------------------------------------------------------------------- #
|
|
321
|
+
# Misc options
|
|
322
|
+
# ---------------------------------------------------------------------------- #
|
|
323
|
+
_C.OUTPUT_DIR = "logs/"
|
|
324
|
+
|
|
325
|
+
# Benchmark different cudnn algorithms.
|
|
326
|
+
# If input images have very different sizes, this option will have large overhead
|
|
327
|
+
# for about 10k iterations. It usually hurts total time, but can benefit for certain models.
|
|
328
|
+
# If input images have the same or similar sizes, benchmark is often helpful.
|
|
329
|
+
_C.CUDNN_BENCHMARK = False
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
"""
|
|
3
|
+
@author: sherlock
|
|
4
|
+
@contact: sherlockliao01@gmail.com
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from . import transforms # isort:skip
|
|
8
|
+
from .build import (
|
|
9
|
+
build_reid_train_loader,
|
|
10
|
+
build_reid_test_loader
|
|
11
|
+
)
|
|
12
|
+
from .common import CommDataset
|
|
13
|
+
|
|
14
|
+
# ensure the builtin datasets are registered
|
|
15
|
+
from . import datasets, samplers # isort:skip
|
|
16
|
+
|
|
17
|
+
__all__ = [k for k in globals().keys() if not k.startswith("_")]
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
"""
|
|
3
|
+
@author: l1aoxingyu
|
|
4
|
+
@contact: sherlockliao01@gmail.com
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import logging
|
|
8
|
+
import os
|
|
9
|
+
|
|
10
|
+
import torch
|
|
11
|
+
TORCH_MAJOR = int(torch.__version__.split('.')[0])
|
|
12
|
+
TORCH_MINOR = int(torch.__version__.split('.')[1])
|
|
13
|
+
|
|
14
|
+
if TORCH_MAJOR == 1 and TORCH_MINOR < 8:
|
|
15
|
+
from torch._six import string_classes # type: ignore
|
|
16
|
+
else:
|
|
17
|
+
string_classes = str
|
|
18
|
+
|
|
19
|
+
from collections.abc import Mapping
|
|
20
|
+
|
|
21
|
+
from fastreid.config import configurable
|
|
22
|
+
from fastreid.utils import comm
|
|
23
|
+
from . import samplers
|
|
24
|
+
from .common import CommDataset
|
|
25
|
+
from .data_utils import DataLoaderX
|
|
26
|
+
from .datasets import DATASET_REGISTRY
|
|
27
|
+
from .transforms import build_transforms
|
|
28
|
+
|
|
29
|
+
__all__ = [
|
|
30
|
+
"build_reid_train_loader",
|
|
31
|
+
"build_reid_test_loader"
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
_root = os.getenv("FASTREID_DATASETS", "datasets")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _train_loader_from_config(cfg, *, train_set=None, transforms=None, sampler=None, **kwargs):
|
|
38
|
+
if transforms is None:
|
|
39
|
+
transforms = build_transforms(cfg, is_train=True)
|
|
40
|
+
|
|
41
|
+
if train_set is None:
|
|
42
|
+
train_items = list()
|
|
43
|
+
for d in cfg.DATASETS.NAMES:
|
|
44
|
+
data = DATASET_REGISTRY.get(d)(root=_root, **kwargs)
|
|
45
|
+
if comm.is_main_process():
|
|
46
|
+
data.show_train()
|
|
47
|
+
train_items.extend(data.train)
|
|
48
|
+
|
|
49
|
+
train_set = CommDataset(train_items, transforms, relabel=True)
|
|
50
|
+
|
|
51
|
+
if sampler is None:
|
|
52
|
+
sampler_name = cfg.DATALOADER.SAMPLER_TRAIN
|
|
53
|
+
num_instance = cfg.DATALOADER.NUM_INSTANCE
|
|
54
|
+
mini_batch_size = cfg.SOLVER.IMS_PER_BATCH // comm.get_world_size()
|
|
55
|
+
|
|
56
|
+
logger = logging.getLogger(__name__)
|
|
57
|
+
logger.info("Using training sampler {}".format(sampler_name))
|
|
58
|
+
if sampler_name == "TrainingSampler":
|
|
59
|
+
sampler = samplers.TrainingSampler(len(train_set))
|
|
60
|
+
elif sampler_name == "NaiveIdentitySampler":
|
|
61
|
+
sampler = samplers.NaiveIdentitySampler(train_set.img_items, mini_batch_size, num_instance)
|
|
62
|
+
elif sampler_name == "BalancedIdentitySampler":
|
|
63
|
+
sampler = samplers.BalancedIdentitySampler(train_set.img_items, mini_batch_size, num_instance)
|
|
64
|
+
elif sampler_name == "SetReWeightSampler":
|
|
65
|
+
set_weight = cfg.DATALOADER.SET_WEIGHT
|
|
66
|
+
sampler = samplers.SetReWeightSampler(train_set.img_items, mini_batch_size, num_instance, set_weight)
|
|
67
|
+
elif sampler_name == "ImbalancedDatasetSampler":
|
|
68
|
+
sampler = samplers.ImbalancedDatasetSampler(train_set.img_items)
|
|
69
|
+
else:
|
|
70
|
+
raise ValueError("Unknown training sampler: {}".format(sampler_name))
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
"train_set": train_set,
|
|
74
|
+
"sampler": sampler,
|
|
75
|
+
"total_batch_size": cfg.SOLVER.IMS_PER_BATCH,
|
|
76
|
+
"num_workers": cfg.DATALOADER.NUM_WORKERS,
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@configurable(from_config=_train_loader_from_config)
|
|
81
|
+
def build_reid_train_loader(
|
|
82
|
+
train_set, *, sampler=None, total_batch_size, num_workers=0,
|
|
83
|
+
):
|
|
84
|
+
"""
|
|
85
|
+
Build a dataloader for object re-identification with some default features.
|
|
86
|
+
This interface is experimental.
|
|
87
|
+
|
|
88
|
+
Returns:
|
|
89
|
+
torch.utils.data.DataLoader: a dataloader.
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
mini_batch_size = total_batch_size // comm.get_world_size()
|
|
93
|
+
|
|
94
|
+
batch_sampler = torch.utils.data.sampler.BatchSampler(sampler, mini_batch_size, True)
|
|
95
|
+
|
|
96
|
+
train_loader = DataLoaderX(
|
|
97
|
+
comm.get_local_rank(),
|
|
98
|
+
dataset=train_set,
|
|
99
|
+
num_workers=num_workers,
|
|
100
|
+
batch_sampler=batch_sampler,
|
|
101
|
+
collate_fn=fast_batch_collator,
|
|
102
|
+
pin_memory=True,
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
return train_loader
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _test_loader_from_config(cfg, *, dataset_name=None, test_set=None, num_query=0, transforms=None, **kwargs):
|
|
109
|
+
if transforms is None:
|
|
110
|
+
transforms = build_transforms(cfg, is_train=False)
|
|
111
|
+
|
|
112
|
+
if test_set is None:
|
|
113
|
+
assert dataset_name is not None, "dataset_name must be explicitly passed in when test_set is not provided"
|
|
114
|
+
data = DATASET_REGISTRY.get(dataset_name)(root=_root, **kwargs)
|
|
115
|
+
if comm.is_main_process():
|
|
116
|
+
data.show_test()
|
|
117
|
+
test_items = data.query + data.gallery
|
|
118
|
+
test_set = CommDataset(test_items, transforms, relabel=False)
|
|
119
|
+
|
|
120
|
+
# Update query number
|
|
121
|
+
num_query = len(data.query)
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
"test_set": test_set,
|
|
125
|
+
"test_batch_size": cfg.TEST.IMS_PER_BATCH,
|
|
126
|
+
"num_query": num_query,
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
@configurable(from_config=_test_loader_from_config)
|
|
131
|
+
def build_reid_test_loader(test_set, test_batch_size, num_query, num_workers=4):
|
|
132
|
+
"""
|
|
133
|
+
Similar to `build_reid_train_loader`. This sampler coordinates all workers to produce
|
|
134
|
+
the exact set of all samples
|
|
135
|
+
This interface is experimental.
|
|
136
|
+
|
|
137
|
+
Args:
|
|
138
|
+
test_set:
|
|
139
|
+
test_batch_size:
|
|
140
|
+
num_query:
|
|
141
|
+
num_workers:
|
|
142
|
+
|
|
143
|
+
Returns:
|
|
144
|
+
DataLoader: a torch DataLoader, that loads the given reid dataset, with
|
|
145
|
+
the test-time transformation.
|
|
146
|
+
|
|
147
|
+
Examples:
|
|
148
|
+
::
|
|
149
|
+
data_loader = build_reid_test_loader(test_set, test_batch_size, num_query)
|
|
150
|
+
# or, instantiate with a CfgNode:
|
|
151
|
+
data_loader = build_reid_test_loader(cfg, "my_test")
|
|
152
|
+
"""
|
|
153
|
+
|
|
154
|
+
mini_batch_size = test_batch_size // comm.get_world_size()
|
|
155
|
+
data_sampler = samplers.InferenceSampler(len(test_set))
|
|
156
|
+
batch_sampler = torch.utils.data.BatchSampler(data_sampler, mini_batch_size, False)
|
|
157
|
+
test_loader = DataLoaderX(
|
|
158
|
+
comm.get_local_rank(),
|
|
159
|
+
dataset=test_set,
|
|
160
|
+
batch_sampler=batch_sampler,
|
|
161
|
+
num_workers=num_workers, # save some memory
|
|
162
|
+
collate_fn=fast_batch_collator,
|
|
163
|
+
pin_memory=True,
|
|
164
|
+
)
|
|
165
|
+
return test_loader, num_query
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def trivial_batch_collator(batch):
|
|
169
|
+
"""
|
|
170
|
+
A batch collator that does nothing.
|
|
171
|
+
"""
|
|
172
|
+
return batch
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def fast_batch_collator(batched_inputs):
|
|
176
|
+
"""
|
|
177
|
+
A simple batch collator for most common reid tasks
|
|
178
|
+
"""
|
|
179
|
+
elem = batched_inputs[0]
|
|
180
|
+
if isinstance(elem, torch.Tensor):
|
|
181
|
+
out = torch.zeros((len(batched_inputs), *elem.size()), dtype=elem.dtype)
|
|
182
|
+
for i, tensor in enumerate(batched_inputs):
|
|
183
|
+
out[i] += tensor
|
|
184
|
+
return out
|
|
185
|
+
|
|
186
|
+
elif isinstance(elem, Mapping):
|
|
187
|
+
return {key: fast_batch_collator([d[key] for d in batched_inputs]) for key in elem}
|
|
188
|
+
|
|
189
|
+
elif isinstance(elem, float):
|
|
190
|
+
return torch.tensor(batched_inputs, dtype=torch.float64)
|
|
191
|
+
elif isinstance(elem, int):
|
|
192
|
+
return torch.tensor(batched_inputs)
|
|
193
|
+
elif isinstance(elem, string_classes):
|
|
194
|
+
return batched_inputs
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
"""
|
|
3
|
+
@author: liaoxingyu
|
|
4
|
+
@contact: sherlockliao01@gmail.com
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from torch.utils.data import Dataset
|
|
8
|
+
|
|
9
|
+
from .data_utils import read_image
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class CommDataset(Dataset):
|
|
13
|
+
"""Image Person ReID Dataset"""
|
|
14
|
+
|
|
15
|
+
def __init__(self, img_items, transform=None, relabel=True):
|
|
16
|
+
self.img_items = img_items
|
|
17
|
+
self.transform = transform
|
|
18
|
+
self.relabel = relabel
|
|
19
|
+
|
|
20
|
+
pid_set = set()
|
|
21
|
+
cam_set = set()
|
|
22
|
+
for i in img_items:
|
|
23
|
+
pid_set.add(i[1])
|
|
24
|
+
cam_set.add(i[2])
|
|
25
|
+
|
|
26
|
+
self.pids = sorted(list(pid_set))
|
|
27
|
+
self.cams = sorted(list(cam_set))
|
|
28
|
+
if relabel:
|
|
29
|
+
self.pid_dict = dict([(p, i) for i, p in enumerate(self.pids)])
|
|
30
|
+
self.cam_dict = dict([(p, i) for i, p in enumerate(self.cams)])
|
|
31
|
+
|
|
32
|
+
def __len__(self):
|
|
33
|
+
return len(self.img_items)
|
|
34
|
+
|
|
35
|
+
def __getitem__(self, index):
|
|
36
|
+
img_item = self.img_items[index]
|
|
37
|
+
img_path = img_item[0]
|
|
38
|
+
pid = img_item[1]
|
|
39
|
+
camid = img_item[2]
|
|
40
|
+
img = read_image(img_path)
|
|
41
|
+
if self.transform is not None: img = self.transform(img)
|
|
42
|
+
if self.relabel:
|
|
43
|
+
pid = self.pid_dict[pid]
|
|
44
|
+
camid = self.cam_dict[camid]
|
|
45
|
+
return {
|
|
46
|
+
"images": img,
|
|
47
|
+
"targets": pid,
|
|
48
|
+
"camids": camid,
|
|
49
|
+
"img_paths": img_path,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
def num_classes(self):
|
|
54
|
+
return len(self.pids)
|
|
55
|
+
|
|
56
|
+
@property
|
|
57
|
+
def num_cameras(self):
|
|
58
|
+
return len(self.cams)
|