dnt 0.2.4__py3-none-any.whl → 0.3.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of dnt might be problematic. Click here for more details.
- dnt/__init__.py +3 -2
- dnt/analysis/__init__.py +3 -2
- dnt/analysis/interaction.py +503 -0
- dnt/analysis/stop.py +22 -17
- dnt/analysis/stop2.py +289 -0
- dnt/analysis/stop3.py +754 -0
- dnt/detect/signal/detector.py +317 -0
- dnt/detect/yolov8/detector.py +116 -16
- 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 +321 -1
- dnt/label/labeler.py +4 -4
- dnt/label/labeler2.py +502 -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 +28 -18
- 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/dsort.py +21 -28
- dnt/track/re_class.py +94 -0
- dnt/track/sort/sort.py +5 -1
- dnt/track/tracker.py +207 -30
- {dnt-0.2.4.dist-info → dnt-0.3.1.3.dist-info}/METADATA +30 -10
- dnt-0.3.1.3.dist-info/RECORD +314 -0
- {dnt-0.2.4.dist-info → dnt-0.3.1.3.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.3.dist-info}/LICENSE +0 -0
- {dnt-0.2.4.dist-info → dnt-0.3.1.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,473 @@
|
|
|
1
|
+
import cv2, os, sys
|
|
2
|
+
import matplotlib.pyplot as plt
|
|
3
|
+
import numpy as np
|
|
4
|
+
from collections import deque
|
|
5
|
+
|
|
6
|
+
from bot_tracker import matching
|
|
7
|
+
from bot_tracker.gmc import GMC
|
|
8
|
+
from bot_tracker.basetrack import BaseTrack, TrackState
|
|
9
|
+
from bot_tracker.kalman_filter import KalmanFilter
|
|
10
|
+
|
|
11
|
+
from fast_reid_inference import FastReIDInterface # type: ignore
|
|
12
|
+
|
|
13
|
+
class STrack(BaseTrack):
|
|
14
|
+
shared_kalman = KalmanFilter()
|
|
15
|
+
|
|
16
|
+
def __init__(self, tlwh, score, feat=None, feat_history=50):
|
|
17
|
+
|
|
18
|
+
# wait activate
|
|
19
|
+
self._tlwh = np.asarray(tlwh, dtype=np.float)
|
|
20
|
+
self.kalman_filter = None
|
|
21
|
+
self.mean, self.covariance = None, None
|
|
22
|
+
self.is_activated = False
|
|
23
|
+
|
|
24
|
+
self.score = score
|
|
25
|
+
self.tracklet_len = 0
|
|
26
|
+
|
|
27
|
+
self.smooth_feat = None
|
|
28
|
+
self.curr_feat = None
|
|
29
|
+
if feat is not None:
|
|
30
|
+
self.update_features(feat)
|
|
31
|
+
self.features = deque([], maxlen=feat_history)
|
|
32
|
+
self.alpha = 0.9
|
|
33
|
+
|
|
34
|
+
def update_features(self, feat):
|
|
35
|
+
feat /= np.linalg.norm(feat)
|
|
36
|
+
self.curr_feat = feat
|
|
37
|
+
if self.smooth_feat is None:
|
|
38
|
+
self.smooth_feat = feat
|
|
39
|
+
else:
|
|
40
|
+
self.smooth_feat = self.alpha * self.smooth_feat + (1 - self.alpha) * feat
|
|
41
|
+
self.features.append(feat)
|
|
42
|
+
self.smooth_feat /= np.linalg.norm(self.smooth_feat)
|
|
43
|
+
|
|
44
|
+
def predict(self):
|
|
45
|
+
mean_state = self.mean.copy()
|
|
46
|
+
if self.state != TrackState.Tracked:
|
|
47
|
+
mean_state[6] = 0
|
|
48
|
+
mean_state[7] = 0
|
|
49
|
+
|
|
50
|
+
self.mean, self.covariance = self.kalman_filter.predict(mean_state, self.covariance)
|
|
51
|
+
|
|
52
|
+
@staticmethod
|
|
53
|
+
def multi_predict(stracks):
|
|
54
|
+
if len(stracks) > 0:
|
|
55
|
+
multi_mean = np.asarray([st.mean.copy() for st in stracks])
|
|
56
|
+
multi_covariance = np.asarray([st.covariance for st in stracks])
|
|
57
|
+
for i, st in enumerate(stracks):
|
|
58
|
+
if st.state != TrackState.Tracked:
|
|
59
|
+
multi_mean[i][6] = 0
|
|
60
|
+
multi_mean[i][7] = 0
|
|
61
|
+
multi_mean, multi_covariance = STrack.shared_kalman.multi_predict(multi_mean, multi_covariance)
|
|
62
|
+
for i, (mean, cov) in enumerate(zip(multi_mean, multi_covariance)):
|
|
63
|
+
stracks[i].mean = mean
|
|
64
|
+
stracks[i].covariance = cov
|
|
65
|
+
|
|
66
|
+
@staticmethod
|
|
67
|
+
def multi_gmc(stracks, H=np.eye(2, 3)):
|
|
68
|
+
if len(stracks) > 0:
|
|
69
|
+
multi_mean = np.asarray([st.mean.copy() for st in stracks])
|
|
70
|
+
multi_covariance = np.asarray([st.covariance for st in stracks])
|
|
71
|
+
|
|
72
|
+
R = H[:2, :2]
|
|
73
|
+
R8x8 = np.kron(np.eye(4, dtype=float), R)
|
|
74
|
+
t = H[:2, 2]
|
|
75
|
+
|
|
76
|
+
for i, (mean, cov) in enumerate(zip(multi_mean, multi_covariance)):
|
|
77
|
+
mean = R8x8.dot(mean)
|
|
78
|
+
mean[:2] += t
|
|
79
|
+
cov = R8x8.dot(cov).dot(R8x8.transpose())
|
|
80
|
+
|
|
81
|
+
stracks[i].mean = mean
|
|
82
|
+
stracks[i].covariance = cov
|
|
83
|
+
|
|
84
|
+
def activate(self, kalman_filter, frame_id):
|
|
85
|
+
"""Start a new tracklet"""
|
|
86
|
+
self.kalman_filter = kalman_filter
|
|
87
|
+
self.track_id = self.next_id()
|
|
88
|
+
|
|
89
|
+
self.mean, self.covariance = self.kalman_filter.initiate(self.tlwh_to_xywh(self._tlwh))
|
|
90
|
+
|
|
91
|
+
self.tracklet_len = 0
|
|
92
|
+
self.state = TrackState.Tracked
|
|
93
|
+
if frame_id == 1:
|
|
94
|
+
self.is_activated = True
|
|
95
|
+
self.frame_id = frame_id
|
|
96
|
+
self.start_frame = frame_id
|
|
97
|
+
|
|
98
|
+
def re_activate(self, new_track, frame_id, new_id=False):
|
|
99
|
+
|
|
100
|
+
self.mean, self.covariance = self.kalman_filter.update(self.mean, self.covariance, self.tlwh_to_xywh(new_track.tlwh))
|
|
101
|
+
if new_track.curr_feat is not None:
|
|
102
|
+
self.update_features(new_track.curr_feat)
|
|
103
|
+
self.tracklet_len = 0
|
|
104
|
+
self.state = TrackState.Tracked
|
|
105
|
+
self.is_activated = True
|
|
106
|
+
self.frame_id = frame_id
|
|
107
|
+
if new_id:
|
|
108
|
+
self.track_id = self.next_id()
|
|
109
|
+
self.score = new_track.score
|
|
110
|
+
|
|
111
|
+
def update(self, new_track, frame_id):
|
|
112
|
+
"""
|
|
113
|
+
Update a matched track
|
|
114
|
+
:type new_track: STrack
|
|
115
|
+
:type frame_id: int
|
|
116
|
+
:type update_feature: bool
|
|
117
|
+
:return:
|
|
118
|
+
"""
|
|
119
|
+
self.frame_id = frame_id
|
|
120
|
+
self.tracklet_len += 1
|
|
121
|
+
|
|
122
|
+
new_tlwh = new_track.tlwh
|
|
123
|
+
|
|
124
|
+
self.mean, self.covariance = self.kalman_filter.update(self.mean, self.covariance, self.tlwh_to_xywh(new_tlwh))
|
|
125
|
+
|
|
126
|
+
if new_track.curr_feat is not None:
|
|
127
|
+
self.update_features(new_track.curr_feat)
|
|
128
|
+
|
|
129
|
+
self.state = TrackState.Tracked
|
|
130
|
+
self.is_activated = True
|
|
131
|
+
|
|
132
|
+
self.score = new_track.score
|
|
133
|
+
|
|
134
|
+
@property
|
|
135
|
+
def tlwh(self):
|
|
136
|
+
"""Get current position in bounding box format `(top left x, top left y,
|
|
137
|
+
width, height)`.
|
|
138
|
+
"""
|
|
139
|
+
if self.mean is None:
|
|
140
|
+
return self._tlwh.copy()
|
|
141
|
+
ret = self.mean[:4].copy()
|
|
142
|
+
ret[:2] -= ret[2:] / 2
|
|
143
|
+
return ret
|
|
144
|
+
|
|
145
|
+
@property
|
|
146
|
+
def tlbr(self):
|
|
147
|
+
"""Convert bounding box to format `(min x, min y, max x, max y)`, i.e.,
|
|
148
|
+
`(top left, bottom right)`.
|
|
149
|
+
"""
|
|
150
|
+
ret = self.tlwh.copy()
|
|
151
|
+
ret[2:] += ret[:2]
|
|
152
|
+
return ret
|
|
153
|
+
|
|
154
|
+
@property
|
|
155
|
+
def xywh(self):
|
|
156
|
+
"""Convert bounding box to format `(min x, min y, max x, max y)`, i.e.,
|
|
157
|
+
`(top left, bottom right)`.
|
|
158
|
+
"""
|
|
159
|
+
ret = self.tlwh.copy()
|
|
160
|
+
ret[:2] += ret[2:] / 2.0
|
|
161
|
+
return ret
|
|
162
|
+
|
|
163
|
+
@staticmethod
|
|
164
|
+
def tlwh_to_xyah(tlwh):
|
|
165
|
+
"""Convert bounding box to format `(center x, center y, aspect ratio,
|
|
166
|
+
height)`, where the aspect ratio is `width / height`.
|
|
167
|
+
"""
|
|
168
|
+
ret = np.asarray(tlwh).copy()
|
|
169
|
+
ret[:2] += ret[2:] / 2
|
|
170
|
+
ret[2] /= ret[3]
|
|
171
|
+
return ret
|
|
172
|
+
|
|
173
|
+
@staticmethod
|
|
174
|
+
def tlwh_to_xywh(tlwh):
|
|
175
|
+
"""Convert bounding box to format `(center x, center y, width,
|
|
176
|
+
height)`.
|
|
177
|
+
"""
|
|
178
|
+
ret = np.asarray(tlwh).copy()
|
|
179
|
+
ret[:2] += ret[2:] / 2
|
|
180
|
+
return ret
|
|
181
|
+
|
|
182
|
+
def to_xywh(self):
|
|
183
|
+
return self.tlwh_to_xywh(self.tlwh)
|
|
184
|
+
|
|
185
|
+
@staticmethod
|
|
186
|
+
def tlbr_to_tlwh(tlbr):
|
|
187
|
+
ret = np.asarray(tlbr).copy()
|
|
188
|
+
ret[2:] -= ret[:2]
|
|
189
|
+
return ret
|
|
190
|
+
|
|
191
|
+
@staticmethod
|
|
192
|
+
def tlwh_to_tlbr(tlwh):
|
|
193
|
+
ret = np.asarray(tlwh).copy()
|
|
194
|
+
ret[2:] += ret[:2]
|
|
195
|
+
return ret
|
|
196
|
+
|
|
197
|
+
def __repr__(self):
|
|
198
|
+
return 'OT_{}_({}-{})'.format(self.track_id, self.start_frame, self.end_frame)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
class BoTSORT(object):
|
|
202
|
+
def __init__(self, args, frame_rate=30):
|
|
203
|
+
|
|
204
|
+
self.tracked_stracks = [] # type: list[STrack]
|
|
205
|
+
self.lost_stracks = [] # type: list[STrack]
|
|
206
|
+
self.removed_stracks = [] # type: list[STrack]
|
|
207
|
+
BaseTrack.clear_count()
|
|
208
|
+
|
|
209
|
+
self.frame_id = 0
|
|
210
|
+
self.args = args
|
|
211
|
+
|
|
212
|
+
self.track_high_thresh = args['track_high_thresh']
|
|
213
|
+
self.track_low_thresh = args['track_low_thresh']
|
|
214
|
+
self.new_track_thresh = args['new_track_thresh']
|
|
215
|
+
|
|
216
|
+
self.buffer_size = int(frame_rate / 30.0 * args['track_buffer'])
|
|
217
|
+
self.max_time_lost = self.buffer_size
|
|
218
|
+
self.kalman_filter = KalmanFilter()
|
|
219
|
+
|
|
220
|
+
# ReID module
|
|
221
|
+
self.proximity_thresh = args['proximity_thresh']
|
|
222
|
+
self.appearance_thresh = args['appearance_thresh']
|
|
223
|
+
|
|
224
|
+
cfg_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../third_party/fast-reid/configs", args['fast_reid_config']))
|
|
225
|
+
weight_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../third_party/fast-reid/checkpoint", args['fast_reid_weights']))
|
|
226
|
+
|
|
227
|
+
if args['with_reid']:
|
|
228
|
+
self.encoder = FastReIDInterface(config_file=cfg_path, weights_path=weight_path,
|
|
229
|
+
device=args['device'], half=args['half'])
|
|
230
|
+
|
|
231
|
+
self.gmc = GMC(method=args['cmc_method'], verbose=[args['name'], args['ablation']])
|
|
232
|
+
|
|
233
|
+
def update(self, det_results, img):
|
|
234
|
+
self.frame_id += 1
|
|
235
|
+
activated_starcks = []
|
|
236
|
+
refind_stracks = []
|
|
237
|
+
lost_stracks = []
|
|
238
|
+
removed_stracks = []
|
|
239
|
+
|
|
240
|
+
if len(det_results):
|
|
241
|
+
bboxes = det_results[:, :4] # x1, y1, x2, y2
|
|
242
|
+
scores = det_results[:, 4] # detection confidence
|
|
243
|
+
classes = det_results[:, 5] # class
|
|
244
|
+
features = det_results[:, 6:] # fast-reid features
|
|
245
|
+
|
|
246
|
+
# Remove bad detections
|
|
247
|
+
lowest_inds = scores > self.track_low_thresh
|
|
248
|
+
bboxes = bboxes[lowest_inds]
|
|
249
|
+
scores = scores[lowest_inds]
|
|
250
|
+
classes = classes[lowest_inds]
|
|
251
|
+
|
|
252
|
+
# Find high threshold detections
|
|
253
|
+
remain_inds = scores > self.track_high_thresh
|
|
254
|
+
dets = bboxes[remain_inds]
|
|
255
|
+
scores_keep = scores[remain_inds]
|
|
256
|
+
classes_keep = classes[remain_inds]
|
|
257
|
+
|
|
258
|
+
else:
|
|
259
|
+
bboxes = []
|
|
260
|
+
scores = []
|
|
261
|
+
classes = []
|
|
262
|
+
dets = []
|
|
263
|
+
scores_keep = []
|
|
264
|
+
classes_keep = []
|
|
265
|
+
|
|
266
|
+
'''Extract embeddings '''
|
|
267
|
+
if self.args['with_reid']:
|
|
268
|
+
features_keep = self.encoder.inference(img, dets)
|
|
269
|
+
|
|
270
|
+
if len(dets) > 0:
|
|
271
|
+
'''Detections'''
|
|
272
|
+
if self.args['with_reid']:
|
|
273
|
+
detections = [STrack(STrack.tlbr_to_tlwh(tlbr), s, f) for
|
|
274
|
+
(tlbr, s, f) in zip(dets, scores_keep, features_keep)]
|
|
275
|
+
else:
|
|
276
|
+
detections = [STrack(STrack.tlbr_to_tlwh(tlbr), s) for
|
|
277
|
+
(tlbr, s) in zip(dets, scores_keep)]
|
|
278
|
+
else:
|
|
279
|
+
detections = []
|
|
280
|
+
|
|
281
|
+
''' Add newly detected tracklets to tracked_stracks'''
|
|
282
|
+
unconfirmed = []
|
|
283
|
+
tracked_stracks = [] # type: list[STrack]
|
|
284
|
+
for track in self.tracked_stracks:
|
|
285
|
+
if not track.is_activated:
|
|
286
|
+
unconfirmed.append(track)
|
|
287
|
+
else:
|
|
288
|
+
tracked_stracks.append(track)
|
|
289
|
+
|
|
290
|
+
''' Step 2: First association, with high score detection boxes'''
|
|
291
|
+
strack_pool = joint_stracks(tracked_stracks, self.lost_stracks)
|
|
292
|
+
|
|
293
|
+
# Predict the current location with KF
|
|
294
|
+
STrack.multi_predict(strack_pool)
|
|
295
|
+
|
|
296
|
+
# Fix camera motion
|
|
297
|
+
warp = self.gmc.apply(img, dets)
|
|
298
|
+
STrack.multi_gmc(strack_pool, warp)
|
|
299
|
+
STrack.multi_gmc(unconfirmed, warp)
|
|
300
|
+
|
|
301
|
+
# Associate with high score detection boxes
|
|
302
|
+
ious_dists = matching.iou_distance(strack_pool, detections)
|
|
303
|
+
ious_dists_mask = (ious_dists > self.proximity_thresh)
|
|
304
|
+
|
|
305
|
+
if not self.args['mot20']:
|
|
306
|
+
ious_dists = matching.fuse_score(ious_dists, detections)
|
|
307
|
+
|
|
308
|
+
if self.args['with_reid']:
|
|
309
|
+
emb_dists = matching.embedding_distance(strack_pool, detections) / 2.0
|
|
310
|
+
raw_emb_dists = emb_dists.copy()
|
|
311
|
+
emb_dists[emb_dists > self.appearance_thresh] = 1.0
|
|
312
|
+
emb_dists[ious_dists_mask] = 1.0
|
|
313
|
+
dists = np.minimum(ious_dists, emb_dists)
|
|
314
|
+
|
|
315
|
+
# Popular ReID method (JDE / FairMOT)
|
|
316
|
+
# raw_emb_dists = matching.embedding_distance(strack_pool, detections)
|
|
317
|
+
# dists = matching.fuse_motion(self.kalman_filter, raw_emb_dists, strack_pool, detections)
|
|
318
|
+
# emb_dists = dists
|
|
319
|
+
|
|
320
|
+
# IoU making ReID
|
|
321
|
+
# dists = matching.embedding_distance(strack_pool, detections)
|
|
322
|
+
# dists[ious_dists_mask] = 1.0
|
|
323
|
+
else:
|
|
324
|
+
dists = ious_dists
|
|
325
|
+
|
|
326
|
+
matches, u_track, u_detection = matching.linear_assignment(dists, thresh=self.args['match_thresh'])
|
|
327
|
+
|
|
328
|
+
for itracked, idet in matches:
|
|
329
|
+
track = strack_pool[itracked]
|
|
330
|
+
det = detections[idet]
|
|
331
|
+
if track.state == TrackState.Tracked:
|
|
332
|
+
track.update(detections[idet], self.frame_id)
|
|
333
|
+
activated_starcks.append(track)
|
|
334
|
+
else:
|
|
335
|
+
track.re_activate(det, self.frame_id, new_id=False)
|
|
336
|
+
refind_stracks.append(track)
|
|
337
|
+
|
|
338
|
+
''' Step 3: Second association, with low score detection boxes'''
|
|
339
|
+
if len(scores):
|
|
340
|
+
inds_high = scores < self.track_high_thresh
|
|
341
|
+
inds_low = scores > self.track_low_thresh
|
|
342
|
+
inds_second = np.logical_and(inds_low, inds_high)
|
|
343
|
+
dets_second = bboxes[inds_second]
|
|
344
|
+
scores_second = scores[inds_second]
|
|
345
|
+
classes_second = classes[inds_second]
|
|
346
|
+
else:
|
|
347
|
+
dets_second = []
|
|
348
|
+
scores_second = []
|
|
349
|
+
classes_second = []
|
|
350
|
+
|
|
351
|
+
# association the untrack to the low score detections
|
|
352
|
+
if len(dets_second) > 0:
|
|
353
|
+
'''Detections'''
|
|
354
|
+
detections_second = [STrack(STrack.tlbr_to_tlwh(tlbr), s) for
|
|
355
|
+
(tlbr, s) in zip(dets_second, scores_second)]
|
|
356
|
+
else:
|
|
357
|
+
detections_second = []
|
|
358
|
+
|
|
359
|
+
r_tracked_stracks = [strack_pool[i] for i in u_track if strack_pool[i].state == TrackState.Tracked]
|
|
360
|
+
dists = matching.iou_distance(r_tracked_stracks, detections_second)
|
|
361
|
+
matches, u_track, u_detection_second = matching.linear_assignment(dists, thresh=0.5)
|
|
362
|
+
for itracked, idet in matches:
|
|
363
|
+
track = r_tracked_stracks[itracked]
|
|
364
|
+
det = detections_second[idet]
|
|
365
|
+
if track.state == TrackState.Tracked:
|
|
366
|
+
track.update(det, self.frame_id)
|
|
367
|
+
activated_starcks.append(track)
|
|
368
|
+
else:
|
|
369
|
+
track.re_activate(det, self.frame_id, new_id=False)
|
|
370
|
+
refind_stracks.append(track)
|
|
371
|
+
|
|
372
|
+
for it in u_track:
|
|
373
|
+
track = r_tracked_stracks[it]
|
|
374
|
+
if not track.state == TrackState.Lost:
|
|
375
|
+
track.mark_lost()
|
|
376
|
+
lost_stracks.append(track)
|
|
377
|
+
|
|
378
|
+
'''Deal with unconfirmed tracks, usually tracks with only one beginning frame'''
|
|
379
|
+
detections = [detections[i] for i in u_detection]
|
|
380
|
+
ious_dists = matching.iou_distance(unconfirmed, detections)
|
|
381
|
+
ious_dists_mask = (ious_dists > self.proximity_thresh)
|
|
382
|
+
if not self.args['mot20']:
|
|
383
|
+
ious_dists = matching.fuse_score(ious_dists, detections)
|
|
384
|
+
|
|
385
|
+
if self.args['with_reid']:
|
|
386
|
+
emb_dists = matching.embedding_distance(unconfirmed, detections) / 2.0
|
|
387
|
+
raw_emb_dists = emb_dists.copy()
|
|
388
|
+
emb_dists[emb_dists > self.appearance_thresh] = 1.0
|
|
389
|
+
emb_dists[ious_dists_mask] = 1.0
|
|
390
|
+
dists = np.minimum(ious_dists, emb_dists)
|
|
391
|
+
else:
|
|
392
|
+
dists = ious_dists
|
|
393
|
+
|
|
394
|
+
matches, u_unconfirmed, u_detection = matching.linear_assignment(dists, thresh=0.7)
|
|
395
|
+
for itracked, idet in matches:
|
|
396
|
+
unconfirmed[itracked].update(detections[idet], self.frame_id)
|
|
397
|
+
activated_starcks.append(unconfirmed[itracked])
|
|
398
|
+
for it in u_unconfirmed:
|
|
399
|
+
track = unconfirmed[it]
|
|
400
|
+
track.mark_removed()
|
|
401
|
+
removed_stracks.append(track)
|
|
402
|
+
|
|
403
|
+
""" Step 4: Init new stracks"""
|
|
404
|
+
for inew in u_detection:
|
|
405
|
+
track = detections[inew]
|
|
406
|
+
if track.score < self.new_track_thresh:
|
|
407
|
+
continue
|
|
408
|
+
|
|
409
|
+
track.activate(self.kalman_filter, self.frame_id)
|
|
410
|
+
activated_starcks.append(track)
|
|
411
|
+
|
|
412
|
+
""" Step 5: Update state"""
|
|
413
|
+
for track in self.lost_stracks:
|
|
414
|
+
if self.frame_id - track.end_frame > self.max_time_lost:
|
|
415
|
+
track.mark_removed()
|
|
416
|
+
removed_stracks.append(track)
|
|
417
|
+
|
|
418
|
+
""" Merge """
|
|
419
|
+
self.tracked_stracks = [t for t in self.tracked_stracks if t.state == TrackState.Tracked]
|
|
420
|
+
self.tracked_stracks = joint_stracks(self.tracked_stracks, activated_starcks)
|
|
421
|
+
self.tracked_stracks = joint_stracks(self.tracked_stracks, refind_stracks)
|
|
422
|
+
self.lost_stracks = sub_stracks(self.lost_stracks, self.tracked_stracks)
|
|
423
|
+
self.lost_stracks.extend(lost_stracks)
|
|
424
|
+
self.lost_stracks = sub_stracks(self.lost_stracks, self.removed_stracks)
|
|
425
|
+
self.removed_stracks.extend(removed_stracks)
|
|
426
|
+
self.tracked_stracks, self.lost_stracks = remove_duplicate_stracks(self.tracked_stracks, self.lost_stracks)
|
|
427
|
+
|
|
428
|
+
# output_stracks = [track for track in self.tracked_stracks if track.is_activated]
|
|
429
|
+
output_stracks = [track for track in self.tracked_stracks]
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
return output_stracks
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
def joint_stracks(tlista, tlistb):
|
|
436
|
+
exists = {}
|
|
437
|
+
res = []
|
|
438
|
+
for t in tlista:
|
|
439
|
+
exists[t.track_id] = 1
|
|
440
|
+
res.append(t)
|
|
441
|
+
for t in tlistb:
|
|
442
|
+
tid = t.track_id
|
|
443
|
+
if not exists.get(tid, 0):
|
|
444
|
+
exists[tid] = 1
|
|
445
|
+
res.append(t)
|
|
446
|
+
return res
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
def sub_stracks(tlista, tlistb):
|
|
450
|
+
stracks = {}
|
|
451
|
+
for t in tlista:
|
|
452
|
+
stracks[t.track_id] = t
|
|
453
|
+
for t in tlistb:
|
|
454
|
+
tid = t.track_id
|
|
455
|
+
if stracks.get(tid, 0):
|
|
456
|
+
del stracks[tid]
|
|
457
|
+
return list(stracks.values())
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
def remove_duplicate_stracks(stracksa, stracksb):
|
|
461
|
+
pdist = matching.iou_distance(stracksa, stracksb)
|
|
462
|
+
pairs = np.where(pdist < 0.15)
|
|
463
|
+
dupa, dupb = list(), list()
|
|
464
|
+
for p, q in zip(*pairs):
|
|
465
|
+
timep = stracksa[p].frame_id - stracksa[p].start_frame
|
|
466
|
+
timeq = stracksb[q].frame_id - stracksb[q].start_frame
|
|
467
|
+
if timep > timeq:
|
|
468
|
+
dupb.append(q)
|
|
469
|
+
else:
|
|
470
|
+
dupa.append(p)
|
|
471
|
+
resa = [t for i, t in enumerate(stracksa) if not i in dupa]
|
|
472
|
+
resb = [t for i, t in enumerate(stracksb) if not i in dupb]
|
|
473
|
+
return resa, resb
|