dnt 0.2.4__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 +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 +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 +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.3.1.8.dist-info/METADATA +117 -0
- dnt-0.3.1.8.dist-info/RECORD +315 -0
- {dnt-0.2.4.dist-info → dnt-0.3.1.8.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/METADATA +0 -35
- 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.8.dist-info/licenses}/LICENSE +0 -0
- {dnt-0.2.4.dist-info → dnt-0.3.1.8.dist-info}/top_level.txt +0 -0
dnt/filter/filter.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import pandas as pd
|
|
2
|
-
from shapely import geometry, LineString, Polygon
|
|
2
|
+
from shapely import geometry, LineString, Polygon, Point
|
|
3
3
|
import geopandas as gpd
|
|
4
4
|
from tqdm import tqdm
|
|
5
5
|
|
|
@@ -8,7 +8,8 @@ class Filter:
|
|
|
8
8
|
pass
|
|
9
9
|
|
|
10
10
|
@staticmethod
|
|
11
|
-
def filter_iou(detections: pd.DataFrame, zones: geometry.multipolygon = None,
|
|
11
|
+
def filter_iou(detections: pd.DataFrame, zones: geometry.multipolygon = None,
|
|
12
|
+
class_list: list[int] = None, score_threshold: float = 0)->pd.DataFrame:
|
|
12
13
|
|
|
13
14
|
detections = detections.loc[detections[6]>=score_threshold].copy()
|
|
14
15
|
|
|
@@ -78,6 +79,254 @@ class Filter:
|
|
|
78
79
|
|
|
79
80
|
return results
|
|
80
81
|
|
|
82
|
+
@staticmethod
|
|
83
|
+
def filter_tracks_by_zones_agg(tracks:pd.DataFrame,
|
|
84
|
+
zones: geometry.MultiPolygon = None,
|
|
85
|
+
method: str = 'include',
|
|
86
|
+
ref_point: str = 'bc',
|
|
87
|
+
offset: tuple = (0, 0),
|
|
88
|
+
col_names = ['frame', 'track', 'x', 'y', 'w', 'h', 'score', 'cls', 'r3', 'r4'],
|
|
89
|
+
video_index:int = None, video_tot:int = None)->pd.DataFrame:
|
|
90
|
+
'''
|
|
91
|
+
Filter tracks by zones.
|
|
92
|
+
Inputs:
|
|
93
|
+
tracks: tracks
|
|
94
|
+
zones: a list of polygons
|
|
95
|
+
method - 'include' (default), 'exclude'
|
|
96
|
+
ref_point - the reference point of a track bbox,
|
|
97
|
+
defalt is br, others - bl, bc, tl, tc, tr, cl, cc, cr
|
|
98
|
+
offset - the offset to ref_point, default is (0, 0)
|
|
99
|
+
video_index - video index
|
|
100
|
+
video_tot - total videos
|
|
101
|
+
Return:
|
|
102
|
+
Filtered tracks
|
|
103
|
+
'''
|
|
104
|
+
|
|
105
|
+
try:
|
|
106
|
+
tracks.columns = col_names
|
|
107
|
+
except:
|
|
108
|
+
print('Tracks is invalid!')
|
|
109
|
+
|
|
110
|
+
if ref_point == 'cc':
|
|
111
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + tracks['h']/2 + offset[1]))]
|
|
112
|
+
elif ref_point == 'tc':
|
|
113
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + offset[1]))]
|
|
114
|
+
elif ref_point == 'bc':
|
|
115
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
|
|
116
|
+
elif ref_point == 'cl':
|
|
117
|
+
g = [Point(xy) for xy in zip((tracks['x'] + offset[0]), (tracks['y'] + tracks['h']/2 + offset[1]))]
|
|
118
|
+
elif ref_point == 'cr':
|
|
119
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w'] + offset[0]), (tracks['y'] + tracks['h']/2 + offset[1]))]
|
|
120
|
+
elif ref_point == 'tl':
|
|
121
|
+
g = [Point(xy) for xy in zip((tracks['x'] + offset[0]), (tracks['y'] + offset[1]))]
|
|
122
|
+
elif ref_point == 'tr':
|
|
123
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w'] + offset[0]), (tracks['y'] + offset[1]))]
|
|
124
|
+
elif ref_point == 'bl':
|
|
125
|
+
g = [Point(xy) for xy in zip((tracks['x'] + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
|
|
126
|
+
elif ref_point == 'br':
|
|
127
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w'] + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
|
|
128
|
+
else:
|
|
129
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
|
|
130
|
+
|
|
131
|
+
geo_tracks = gpd.GeoDataFrame(tracks, geometry=g)
|
|
132
|
+
|
|
133
|
+
matched_ids = []
|
|
134
|
+
pbar = tqdm(total=len(zones), unit=' zones')
|
|
135
|
+
if video_index and video_tot:
|
|
136
|
+
pbar.set_description_str("Filtering zones {} of {}".format(video_index, video_tot))
|
|
137
|
+
else:
|
|
138
|
+
pbar.set_description_str("Filtering zones ")
|
|
139
|
+
|
|
140
|
+
for zone in zones:
|
|
141
|
+
matched = geo_tracks[geo_tracks.geometry.within(zone)]
|
|
142
|
+
if len(matched)>0:
|
|
143
|
+
matched_ids.extend(matched['track'].unique().tolist())
|
|
144
|
+
pbar.update()
|
|
145
|
+
|
|
146
|
+
pbar.close()
|
|
147
|
+
|
|
148
|
+
if len(matched_ids)>0:
|
|
149
|
+
if method == 'include':
|
|
150
|
+
results = tracks.loc[tracks['track'].isin(matched_ids)].copy()
|
|
151
|
+
else:
|
|
152
|
+
results = tracks.loc[~tracks['track'].isin(matched_ids)].copy()
|
|
153
|
+
else:
|
|
154
|
+
results = tracks.copy()
|
|
155
|
+
|
|
156
|
+
return results
|
|
157
|
+
|
|
158
|
+
@staticmethod
|
|
159
|
+
def filter_frames_by_zones_agg(tracks:pd.DataFrame,
|
|
160
|
+
zones: geometry.MultiPolygon = None,
|
|
161
|
+
method: str = 'include',
|
|
162
|
+
ref_point:str = 'bc',
|
|
163
|
+
offset: tuple = (0, 0),
|
|
164
|
+
col_names = ['frame', 'track', 'x', 'y', 'w', 'h', 'score', 'cls', 'r3', 'r4'],
|
|
165
|
+
video_index:int = None, video_tot:int = None)->pd.DataFrame:
|
|
166
|
+
'''
|
|
167
|
+
Filter tracks by zones.
|
|
168
|
+
Inputs:
|
|
169
|
+
tracks - tracks
|
|
170
|
+
zones - zones (polygon)
|
|
171
|
+
method - 'include' (default) include the tracks if they are within the zones; 'exclude' exclude the tracks if they are within the zones
|
|
172
|
+
ref_point - the reference point of a track bbox, defalt is bottom_point, center_point, left_up, right_up, left_buttom, right_buttom
|
|
173
|
+
offset - the offset to ref_point, default is (0, 0)
|
|
174
|
+
video_index - video index
|
|
175
|
+
video_tot - total videos
|
|
176
|
+
Return:
|
|
177
|
+
Filtered tracks
|
|
178
|
+
'''
|
|
179
|
+
|
|
180
|
+
try:
|
|
181
|
+
tracks.columns = col_names
|
|
182
|
+
except:
|
|
183
|
+
print('Tracks is invalid!')
|
|
184
|
+
|
|
185
|
+
if ref_point == 'cc':
|
|
186
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + tracks['h']/2 + offset[1]))]
|
|
187
|
+
elif ref_point == 'tc':
|
|
188
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + offset[1]))]
|
|
189
|
+
elif ref_point == 'bc':
|
|
190
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
|
|
191
|
+
elif ref_point == 'cl':
|
|
192
|
+
g = [Point(xy) for xy in zip((tracks['x'] + offset[0]), (tracks['y'] + tracks['h']/2 + offset[1]))]
|
|
193
|
+
elif ref_point == 'cr':
|
|
194
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w'] + offset[0]), (tracks['y'] + tracks['h']/2 + offset[1]))]
|
|
195
|
+
elif ref_point == 'tl':
|
|
196
|
+
g = [Point(xy) for xy in zip((tracks['x'] + offset[0]), (tracks['y'] + offset[1]))]
|
|
197
|
+
elif ref_point == 'tr':
|
|
198
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w'] + offset[0]), (tracks['y'] + offset[1]))]
|
|
199
|
+
elif ref_point == 'bl':
|
|
200
|
+
g = [Point(xy) for xy in zip((tracks['x'] + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
|
|
201
|
+
elif ref_point == 'br':
|
|
202
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w'] + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
|
|
203
|
+
else:
|
|
204
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
geo_tracks = gpd.GeoDataFrame(tracks, geometry=g)
|
|
208
|
+
|
|
209
|
+
matched_frames = []
|
|
210
|
+
pbar = tqdm(total=len(zones), unit=' zones')
|
|
211
|
+
if video_index and video_tot:
|
|
212
|
+
pbar.set_description_str("Filtering zones {} of {}".format(video_index, video_tot))
|
|
213
|
+
else:
|
|
214
|
+
pbar.set_description_str("Filtering zones ")
|
|
215
|
+
|
|
216
|
+
for zone in zones:
|
|
217
|
+
matched = geo_tracks[geo_tracks.geometry.within(zone)]
|
|
218
|
+
if len(matched)>0:
|
|
219
|
+
matched_frames.extend(matched.index.values.tolist())
|
|
220
|
+
pbar.update()
|
|
221
|
+
|
|
222
|
+
pbar.close()
|
|
223
|
+
|
|
224
|
+
if len(matched_frames)>0:
|
|
225
|
+
if method == 'include':
|
|
226
|
+
results = tracks.iloc[matched_frames].copy()
|
|
227
|
+
else:
|
|
228
|
+
results = tracks.drop(matched_frames, axis=0).copy()
|
|
229
|
+
else:
|
|
230
|
+
results = tracks.copy()
|
|
231
|
+
|
|
232
|
+
return results
|
|
233
|
+
|
|
234
|
+
@staticmethod
|
|
235
|
+
def filter_tracks_by_zones(tracks:pd.DataFrame,
|
|
236
|
+
zones: list[Polygon] = None,
|
|
237
|
+
method: str = 'list',
|
|
238
|
+
ref_point: str = 'bc',
|
|
239
|
+
offset: tuple = (0, 0),
|
|
240
|
+
col_names = ['frame', 'track', 'x', 'y', 'w', 'h', 'score', 'cls', 'r3', 'r4'],
|
|
241
|
+
zone_name: str = 'zone',
|
|
242
|
+
video_index:int = None, video_tot:int = None)->pd.DataFrame:
|
|
243
|
+
'''
|
|
244
|
+
Filter tracks by zones.
|
|
245
|
+
Inputs:
|
|
246
|
+
tracks - tracks
|
|
247
|
+
zones - zones (polygon)
|
|
248
|
+
method - 'list' (default) - List track ids within zones
|
|
249
|
+
'filter' - filter tracks within zones
|
|
250
|
+
'label' - label tracks with zone index
|
|
251
|
+
ref_point - the reference point of a track bbox,
|
|
252
|
+
br - buttom_right,
|
|
253
|
+
bl - bottom_left
|
|
254
|
+
bc - bottom_center
|
|
255
|
+
cc - center_point,
|
|
256
|
+
cl - left_center,
|
|
257
|
+
cr - right_center,
|
|
258
|
+
tc - top_center,
|
|
259
|
+
tl - top_left,
|
|
260
|
+
tr - top_right,
|
|
261
|
+
offset - the offset to ref_point, default is (0, 0)
|
|
262
|
+
aggregate - combine outputs to one dataframe, add zone column
|
|
263
|
+
zone_name - if aggregate, the field name of zone variable, default is 'zone'
|
|
264
|
+
video_index - video index
|
|
265
|
+
video_tot - total videos
|
|
266
|
+
Return:
|
|
267
|
+
Filtered tracks
|
|
268
|
+
'''
|
|
269
|
+
|
|
270
|
+
try:
|
|
271
|
+
tracks.columns = col_names
|
|
272
|
+
except:
|
|
273
|
+
print('Tracks is invalid!')
|
|
274
|
+
|
|
275
|
+
if ref_point == 'cc':
|
|
276
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + tracks['h']/2 + offset[1]))]
|
|
277
|
+
elif ref_point == 'tc':
|
|
278
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + offset[1]))]
|
|
279
|
+
elif ref_point == 'bc':
|
|
280
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
|
|
281
|
+
elif ref_point == 'cl':
|
|
282
|
+
g = [Point(xy) for xy in zip((tracks['x'] + offset[0]), (tracks['y'] + tracks['h']/2 + offset[1]))]
|
|
283
|
+
elif ref_point == 'cr':
|
|
284
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w'] + offset[0]), (tracks['y'] + tracks['h']/2 + offset[1]))]
|
|
285
|
+
elif ref_point == 'tl':
|
|
286
|
+
g = [Point(xy) for xy in zip((tracks['x'] + offset[0]), (tracks['y'] + offset[1]))]
|
|
287
|
+
elif ref_point == 'tr':
|
|
288
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w'] + offset[0]), (tracks['y'] + offset[1]))]
|
|
289
|
+
elif ref_point == 'bl':
|
|
290
|
+
g = [Point(xy) for xy in zip((tracks['x'] + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
|
|
291
|
+
elif ref_point == 'br':
|
|
292
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w'] + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
|
|
293
|
+
else:
|
|
294
|
+
g = [Point(xy) for xy in zip((tracks['x'] + tracks['w']/2 + offset[0]), (tracks['y'] + tracks['h'] + offset[1]))]
|
|
295
|
+
|
|
296
|
+
geo_tracks = gpd.GeoDataFrame(tracks, geometry=g)
|
|
297
|
+
|
|
298
|
+
matched_ids = []
|
|
299
|
+
pbar = tqdm(total=len(zones), unit=' zones')
|
|
300
|
+
if video_index and video_tot:
|
|
301
|
+
pbar.set_description_str("Filtering zones {} of {}".format(video_index, video_tot))
|
|
302
|
+
else:
|
|
303
|
+
pbar.set_description_str("Filtering zones ")
|
|
304
|
+
|
|
305
|
+
for zone in zones:
|
|
306
|
+
matched = geo_tracks[geo_tracks.geometry.within(zone)]
|
|
307
|
+
if len(matched)>0:
|
|
308
|
+
matched_ids.append(matched['track'].unique().tolist())
|
|
309
|
+
pbar.update()
|
|
310
|
+
|
|
311
|
+
pbar.close()
|
|
312
|
+
|
|
313
|
+
if (method == 'filter') or (method == 'label'):
|
|
314
|
+
tracks[zone_name] = -1
|
|
315
|
+
for i in range(len(matched_ids)):
|
|
316
|
+
tracks.loc[tracks['track'].isin(matched_ids[i]), zone_name] = i
|
|
317
|
+
if method == 'filter':
|
|
318
|
+
results = tracks[tracks[zone_name]!=-1].copy()
|
|
319
|
+
else:
|
|
320
|
+
results = tracks
|
|
321
|
+
else:
|
|
322
|
+
results = []
|
|
323
|
+
if len(matched_ids)>0:
|
|
324
|
+
for i in range(len(matched_ids)):
|
|
325
|
+
result = tracks.loc[tracks['track'].isin(matched_ids[i])].copy()
|
|
326
|
+
results.append(result)
|
|
327
|
+
|
|
328
|
+
return results
|
|
329
|
+
|
|
81
330
|
@staticmethod
|
|
82
331
|
def filter_tracks_by_lines(tracks:pd.DataFrame,
|
|
83
332
|
lines: list[LineString]= None,
|
|
@@ -129,6 +378,88 @@ class Filter:
|
|
|
129
378
|
results.sort_values(by=[0, 1], inplace=True)
|
|
130
379
|
return results
|
|
131
380
|
|
|
381
|
+
@staticmethod
|
|
382
|
+
def filter_tracks_by_lines_v2(tracks:pd.DataFrame,
|
|
383
|
+
lines: list[LineString]= None,
|
|
384
|
+
method: str = 'include',
|
|
385
|
+
tolerance: int = 0,
|
|
386
|
+
bbox_size: int = 0,
|
|
387
|
+
force_line_indexes: list[int] = None,
|
|
388
|
+
video_index:int = None,
|
|
389
|
+
video_tot:int = None) -> pd.DataFrame:
|
|
390
|
+
'''
|
|
391
|
+
Filter tracks by lines
|
|
392
|
+
Inputs:
|
|
393
|
+
tracks - a DataFrame of tracks, [FRAME, TRACK_ID, TOPX, TOPY, WIDTH, LENGTH, RESERVED, RESERVED, RESERVED]
|
|
394
|
+
lines - a list of LineString
|
|
395
|
+
method - filtering method, include (default) - including tracks crossing the lines, exclude - exclude tracks crossing the lines
|
|
396
|
+
tolerance - if a bbox intesect the reference lines of (number of lanes - tolerance), it is hit. default is 0.
|
|
397
|
+
force_line_indexes: the line indexes that a bbox must intersect for matching
|
|
398
|
+
bbox_size - the size of detection bbox, default is 0 - the orginal bbox
|
|
399
|
+
video_index - the index of video for processing
|
|
400
|
+
video_tot - the total number of videos
|
|
401
|
+
Return:
|
|
402
|
+
a DataFrame of [FRAME, TRACK_ID, TOPX, TOPY, WIDTH, LENGTH, RESERVED, RESERVED, RESERVED]
|
|
403
|
+
'''
|
|
404
|
+
tracks.columns = ['frame', 'track', 'x', 'y', 'w', 'h', 'score', 'cls', 'r3', 'r4']
|
|
405
|
+
track_ids = tracks['track'].unique()
|
|
406
|
+
ids = []
|
|
407
|
+
|
|
408
|
+
# set hit criterion
|
|
409
|
+
hit_criterion = len(lines) - tolerance
|
|
410
|
+
if (hit_criterion < 1) or (hit_criterion > len(lines)):
|
|
411
|
+
hit_criterion = len(lines)
|
|
412
|
+
|
|
413
|
+
pbar = tqdm(total=len(track_ids), unit=' tracks')
|
|
414
|
+
if video_index and video_tot:
|
|
415
|
+
pbar.set_description_str("Filtering tracks {} of {}".format(video_index, video_tot))
|
|
416
|
+
else:
|
|
417
|
+
pbar.set_description_str("Filtering tracks ")
|
|
418
|
+
|
|
419
|
+
for track_id in track_ids:
|
|
420
|
+
selected = tracks.loc[(tracks['track']==track_id)].copy()
|
|
421
|
+
hit_cnt = 0
|
|
422
|
+
hit_force = True
|
|
423
|
+
if len(selected)>0:
|
|
424
|
+
if bbox_size == 0:
|
|
425
|
+
g = selected.apply(lambda track: Polygon([(track['x'], track['y']), (track['x'] + track['w'], track['y']),
|
|
426
|
+
(track['x'] + track['w'], track['y'] + track['h']), (track['x'], track['y'] + track['h'])]), axis =1)
|
|
427
|
+
else:
|
|
428
|
+
g = selected.apply(lambda track: Polygon([
|
|
429
|
+
(track['x'] + track['w']/2 - bbox_size, track['y'] + track['h'] - bbox_size),
|
|
430
|
+
(track['x'] + track['w']/2 + bbox_size, track['y'] + track['h'] - bbox_size),
|
|
431
|
+
(track['x'] + track['w']/2 + bbox_size, track['y'] + track['h']),
|
|
432
|
+
(track['x'] + track['w']/2 - bbox_size, track['y'] + track['h'])
|
|
433
|
+
]), axis =1)
|
|
434
|
+
|
|
435
|
+
for line in lines:
|
|
436
|
+
if any(line.intersects(g).values.tolist()):
|
|
437
|
+
hit_cnt+=1
|
|
438
|
+
|
|
439
|
+
if force_line_indexes is not None:
|
|
440
|
+
force_lines = [lines[i] for i in force_line_indexes]
|
|
441
|
+
for line in force_lines:
|
|
442
|
+
if any(line.intersects(g).values.tolist()):
|
|
443
|
+
hit_force = True
|
|
444
|
+
else:
|
|
445
|
+
hit_force = False
|
|
446
|
+
|
|
447
|
+
if (hit_cnt >= hit_criterion) and (hit_force == True):
|
|
448
|
+
ids.append(track_id)
|
|
449
|
+
|
|
450
|
+
pbar.update()
|
|
451
|
+
|
|
452
|
+
pbar.close()
|
|
453
|
+
|
|
454
|
+
results = []
|
|
455
|
+
if method=='include':
|
|
456
|
+
results = tracks.loc[tracks['track'].isin(ids)].copy()
|
|
457
|
+
elif method=='exclude':
|
|
458
|
+
results = tracks.loc[~tracks['track'].isin(ids)].copy()
|
|
459
|
+
|
|
460
|
+
results.sort_values(by=['frame', 'track'], inplace=True)
|
|
461
|
+
return results
|
|
462
|
+
|
|
132
463
|
if __name__=='__main__':
|
|
133
464
|
pass
|
|
134
465
|
|
dnt/label/labeler.py
CHANGED
|
@@ -84,19 +84,19 @@ class Labeler:
|
|
|
84
84
|
color = element['color']
|
|
85
85
|
size = element['size']
|
|
86
86
|
thick = element['thick']
|
|
87
|
-
cv2.putText(frame, label_txt, element['coords'][0], 0, size, color, thick)
|
|
87
|
+
cv2.putText(frame, label_txt, tuple(map(int, element['coords'][0])), 0, size, color, thick)
|
|
88
88
|
|
|
89
89
|
elif element['type'] == 'line':
|
|
90
90
|
coords = element['coords']
|
|
91
91
|
color = element['color']
|
|
92
92
|
thick = element['thick']
|
|
93
|
-
cv2.line(frame, coords[0], coords[1], color, thick)
|
|
93
|
+
cv2.line(frame, tuple(map(int, coords[0])), tuple(map(int, coords[1])), color, thick)
|
|
94
94
|
|
|
95
95
|
elif element['type'] == 'box':
|
|
96
96
|
coords = element['coords']
|
|
97
97
|
color = element['color']
|
|
98
98
|
thick = element['thick']
|
|
99
|
-
cv2.rectangle(frame, coords[0], coords[1], color, thick)
|
|
99
|
+
cv2.rectangle(frame, tuple(map(int, coords[0])), tuple(map(int, coords[1])), color, thick)
|
|
100
100
|
|
|
101
101
|
elif element['type'] == 'bbox':
|
|
102
102
|
coords = element['coords']
|
|
@@ -105,7 +105,7 @@ class Labeler:
|
|
|
105
105
|
label_txt = element['desc']
|
|
106
106
|
size = element['size']
|
|
107
107
|
|
|
108
|
-
cv2.rectangle(frame, coords[0], coords[1], color, thick)
|
|
108
|
+
cv2.rectangle(frame, tuple(map(int, coords[0])), tuple(map(int, coords[1])), color, thick)
|
|
109
109
|
cv2.putText(frame, str(label_txt), (int(coords[0][0]), int(coords[0][1]-int(10*size))),
|
|
110
110
|
cv2.FONT_HERSHEY_SIMPLEX, size, color, thick)
|
|
111
111
|
|