{"id":13441587,"url":"https://github.com/hou-yz/open-reid-tracking","last_synced_at":"2025-03-20T12:31:45.504Z","repository":{"id":56472062,"uuid":"136114485","full_name":"hou-yz/open-reid-tracking","owner":"hou-yz","description":"open-reid with PCB, IDE, triplet, ZJU; MOT/MTMCT feature extraction support included","archived":false,"fork":false,"pushed_at":"2020-11-05T12:30:47.000Z","size":4023,"stargazers_count":108,"open_issues_count":0,"forks_count":21,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-08-01T03:34:57.258Z","etag":null,"topics":["feature-extraction","re-id","re-identification","reid","tracking"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hou-yz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-05T03:26:25.000Z","updated_at":"2024-07-20T15:36:06.000Z","dependencies_parsed_at":"2022-08-15T19:20:49.538Z","dependency_job_id":null,"html_url":"https://github.com/hou-yz/open-reid-tracking","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hou-yz%2Fopen-reid-tracking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hou-yz%2Fopen-reid-tracking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hou-yz%2Fopen-reid-tracking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hou-yz%2Fopen-reid-tracking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hou-yz","download_url":"https://codeload.github.com/hou-yz/open-reid-tracking/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221760053,"owners_count":16876343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["feature-extraction","re-id","re-identification","reid","tracking"],"created_at":"2024-07-31T03:01:35.775Z","updated_at":"2025-03-20T12:31:45.490Z","avatar_url":"https://github.com/hou-yz.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Open-ReID-tracking\n\nThis repo is based on Cysu's [open-reid](https://github.com/Cysu/open-reid), which is a great re-ID library. For performance, we implemented some other baseline models on top of it. For utility, we add some function for the tracking-by-detection workflow in tracking works. \n\n- update all models for performance \u0026 readability. \n- add ```data/README.md```. check for folder structure \u0026 dataset download. \n- add ```requirements.txt```. use ```conda install --file requirements.txt``` to install. \n- add BN after feature layer in ```reid/models/IDE_model.py``` for separation. This introduces a higher performance.\n- fix high cpu usage via adding ```os.environ['OMP_NUM_THREADS'] = '1'``` in runable files. \n- NEW: We adopt a baseline from Hao Luo \\[[git](https://github.com/michuanhaohao/reid-strong-baseline), [paper](https://arxiv.org/abs/1903.07071)\\]. See ```ZJU.py```. We achieve competitive performance with the same `IDE_model.py`. \n\nPlease use this repo alongside with our flavor of [DeepCC](https://github.com/hou-yz/DeepCC_aic) tracker for tracking. \n\n## Model\n- IDE \\[[paper](https://www.cv-foundation.org/openaccess/content_iccv_2015/papers/Zheng_Scalable_Person_Re-Identification_ICCV_2015_paper.pdf)\\]\n- Triplet \\[[paper](https://arxiv.org/abs/1703.07737)\\]\n- PCB \\[[git](https://github.com/syfafterzy/PCB_RPP_for_reID), [paper](http://openaccess.thecvf.com/content_ECCV_2018/papers/Yifan_Sun_Beyond_Part_Models_ECCV_2018_paper.pdf)\\]\n- ZJU \\[[git](https://github.com/michuanhaohao/reid-strong-baseline), [paper](https://arxiv.org/abs/1903.07071)\\]\n\n\n## Data\nThe re-ID datasets should be stored in a file structure like this:\n```\n~\n└───Data\n    └───AIC19\n    │   │ track-1 data\n    │   │ ...\n    │\n    └───AIC19-reid\n    │   │ track-2 data\n    │   │ ...\n    │\n    └───VeRi\n    │   │ ...\n    │\n    └───DukeMTMC-reID\n    │   │ ...\n    │\n    └───Market-1501-v15.09.15\n        │ ...\n```\n\n\n## Usage\n### Re-ID\ntraining from scratch\n```shell script\nCUDA_VISIBLE_DEVICES=0 python3 IDE.py -d market1501 --train\n```\nthis will automatically save your logs at `./logs/ide/market1501/YYYY-MM-DD_HH-MM-SS`, where `YYYY-MM-DD_HH-MM-SS` is the time stamp when the training started. \n\nresume \u0026 evaluate\n```shell script\nCUDA_VISIBLE_DEVICES=0 python3 IDE.py -d market1501 --resume YYYY-MM-DD_HH-MM-SS\n```\n\n### Feature Extraction for Tracking (to be updated)\nWe describe the workflow for a simple model. For the full ensemble model, please check \n\nFirst, please use the following to extract detection bounding boxes from videos.\n```shell script\npython3 reid/prepare/extract_bbox.py\n```\n\nNext, train the baseline on re-ID data from AI-City 2019 (track-2). \n```shell script\n# train\nCUDA_VISIBLE_DEVICES=0,1 python3 ZJU.py --train -d aic_reid --logs-dir logs/ZJU/256/aic_reid/lr001_colorjitter --colorjitter  --height 256 --width 256 --lr 0.01 --step-size 30,60,80 --warmup 10 --LSR --backbone densenet121 --features 256 --BNneck -s 1 -b 64 --epochs 120\n```\nThen, the detection bounding box feature are computed. \n```shell script\n# gt feat (optional)\n# CUDA_VISIBLE_DEVICES=0,1 python3 save_cnn_feature.py -a zju --backbone densenet121 --resume logs/ZJU/256/aic_reid/lr001_colorjitter/model_best.pth.tar --features 256 --height 256 --width 256 --l0_name zju_lr001_colorjitter_256 --BNneck -s 1 -d aic --type gt_all -b 64\n# reid feat (parameter tuning, see DeepCC_aic)\nCUDA_VISIBLE_DEVICES=0,1 python3 save_cnn_feature.py -a zju --backbone densenet121 --resume logs/ZJU/256/aic_reid/lr001_colorjitter/model_best.pth.tar --features 256 --height 256 --width 256 --l0_name zju_lr001_colorjitter_256 --BNneck -s 1 -d aic --type gt_mini -b 64\n# det feat (tracking pre-requisite, see DeepCC_aic)\nCUDA_VISIBLE_DEVICES=0,1 python3 save_cnn_feature.py -a zju --backbone densenet121 --resume logs/ZJU/256/aic_reid/lr001_colorjitter/model_best.pth.tar --features 256 --height 256 --width 256 --l0_name zju_lr001_colorjitter_256 --BNneck -s 1 -d aic --type detections --det_time trainval -b 64\nCUDA_VISIBLE_DEVICES=0,1 python3 save_cnn_feature.py -a zju --backbone densenet121 --resume logs/ZJU/256/aic_reid/lr001_colorjitter/model_best.pth.tar --features 256 --height 256 --width 256 --l0_name zju_lr001_colorjitter_256 --BNneck -s 1 -d aic --type detections --det_time test -b 64\n```\n\n## Implementation details\n\nCross-entropy loss:\n- `batch_size = 64`.\n- `learning rate = 0.1`, step decay after 40 epochs. Train for 60 epochs in total.\n- 0.1x learning rate for `resnet-50` base.\n- `weight decay = 5e-4`.\n- SGD optimizer, `momentum = 0.9`, `nestrov = true`.\n\nTriplet loss:\n- `margin=0.3`.\n- `ims_per_id = 4`, `ids_per_batch = 32`.\n- `learning rate = 2e-4`, exponentially decay after 150 epochs. Train for 300 epochs in total.\n- unifide learning rate for `resnet-50` base and `fc` feature layer.\n- `weight decay = 5e-4`.\n- Adam optimizer.\n\n\n`Default` Settings:\n- IDE \n  - `stride = 2` in last conv block.\n  - `h x w = 256 x 128`.\n  - random horizontal flip + random crop.\n- Triplet\n  - `stride = 2` in last conv block.\n  - `h x w = 256 x 128`.\n  - random horizontal flip + random crop.\n- PCB\n  - `stride = 1` in last conv block.\n  - `h x w = 384 x 128`.\n  - random horizontal flip.\n- ZJU\n  - cross entropy + triplet.\n  - `ims_per_id = 4`, `ids_per_batch = 16`.\n  - `h x w = 256 x 128`.\n  - warmup for 10 epochs.\n  - random horizontal flip + pad 10 pixel then random crop + random erasing with `re = 0.5`.\n  - label smooth.\n  - `stride = 1` in last conv block.\n  - ~~BNneck.~~\n  - ~~center loss.~~\n\n`Tracking` settings for IDE, Triplet, and PCB:\n- `stride = 1` in last conv block.\n- `h x w = 384 x 128`.\n- horizontal flipping + Random Erasing with `re = 0.5`.\n\n`Raw` setting for ZJU:\n  - cross entropy + triplet.\n  - `ims_per_id = 4`, `ids_per_batch = 16`.\n  - `h x w = 256 x 128`.\n  - random horizontal flip + pad 10 pixel then random crop.\n\n\n\n## Experiment Results\n\n| dataset | model  | settings                        | mAP (%) | Rank-1 (%) |\n| ---     | ---    | ---                             | :---: | :---: |\n| Duke|IDE|Default                                   | 58.70 | 77.56 |\n| Duke|Triplet|Default                               | 62.40 | 78.19 |\n| Duke|PCB|Default                                   | 68.72 | 83.12 |\n| Duke|ZJU|Default                                   | 75.20 | 86.71 |\n| Market|IDE|Default                                   | 69.34 | 86.58 |\n| Market|Triplet|Default                               | 72.42 | 86.55 |\n| Market|PCB|Default                                   | 77.53 | 92.52 |\n| Market|ZJU|Default                                   | 85.37 | 93.79 |\n\n\u003c!---\n| Duke|IDE|Default                                | 51.65 | 71.10 |\n| Duke|IDE|Tracking w/ crop                      | 58.05 | 75.63 |\n| Duke|IDE|Tracking                              | 62.93 | 79.67 |\n| Duke|Triplet|Default                                     | 59.76 | 76.26 |\n| Duke|Triplet|Tracking w/ crop                           | 63.50 | 78.19 |\n| Duke|Triplet|Tracking                                   | 66.44 | 81.33 |\n| Duke|PCB|Default' (Tracking w/o RE)                | 68.41 | 83.12 |\n| Duke|PCB|Default' + fc64                        | 68.06 | 82.76 |\n| Duke|PCB|Default' + NOT normalizing stripes     | 66.01 | 83.17 |\n| Duke|PCB|Tracking                              | 68.70 | 82.81 |\n| Duke|PCB|Tracking + fc64                       | 68.59 | 82.85 |\n--\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhou-yz%2Fopen-reid-tracking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhou-yz%2Fopen-reid-tracking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhou-yz%2Fopen-reid-tracking/lists"}