GithubHelp home page GithubHelp logo

xrosliang / open-reid-tracking Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hou-yz/open-reid-tracking

0.0 1.0 0.0 3.93 MB

open-reid with PCB, IDE, triplet, ZJU; MOT/MTMCT feature extraction support included

Python 100.00%

open-reid-tracking's Introduction

Open-ReID-tracking

This repo is based on Cysu's 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.

  • update all models for performance & readability.
  • add data/README.md. check for folder structure & dataset download.
  • add requirements.txt. use conda install --file requirements.txt to install.
  • add BN after feature layer in reid/models/IDE_model.py for separation. This introduces a higher performance.
  • fix high cpu usage via adding os.environ['OMP_NUM_THREADS'] = '1' in runable files.
  • NEW: We adopt a baseline from Hao Luo [git, paper]. See ZJU.py. We achieve competitive performance with the same IDE_model.py.

Please use this repo alongside with our flavor of DeepCC tracker for tracking.

Model

Data

The re-ID datasets should be stored in a file structure like this:

~
└───Data
    └───AIC19
    │   │ track-1 data
    │   │ ...
    │
    └───AIC19-reid
    │   │ track-2 data
    │   │ ...
    │
    └───VeRi
    │   │ ...
    │
    └───DukeMTMC-reID
    │   │ ...
    │
    └───Market-1501-v15.09.15
        │ ...

Usage

Re-ID

training from scratch

CUDA_VISIBLE_DEVICES=0 python3 IDE.py -d market1501 --train

this 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.

resume & evaluate

CUDA_VISIBLE_DEVICES=0 python3 IDE.py -d market1501 --resume YYYY-MM-DD_HH-MM-SS

Feature Extraction for Tracking (to be updated)

We describe the workflow for a simple model. For the full ensemble model, please check

First, please use the following to extract detection bounding boxes from videos.

python3 reid/prepare/extract_bbox.py

Next, train the baseline on re-ID data from AI-City 2019 (track-2).

# train
CUDA_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

Then, the detection bounding box feature are computed.

# gt feat (optional)
# 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
# reid feat (parameter tuning, see DeepCC_aic)
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_mini -b 64
# det feat (tracking pre-requisite, see DeepCC_aic)
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 detections --det_time trainval -b 64
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 detections --det_time test -b 64

Implementation details

Cross-entropy loss:

  • batch_size = 64.
  • learning rate = 0.1, step decay after 40 epochs. Train for 60 epochs in total.
  • 0.1x learning rate for resnet-50 base.
  • weight decay = 5e-4.
  • SGD optimizer, momentum = 0.9, nestrov = true.

Triplet loss:

  • margin=0.3.
  • ims_per_id = 4, ids_per_batch = 32.
  • learning rate = 2e-4, exponentially decay after 150 epochs. Train for 300 epochs in total.
  • unifide learning rate for resnet-50 base and fc feature layer.
  • weight decay = 5e-4.
  • Adam optimizer.

Default Settings:

  • IDE
    • stride = 2 in last conv block.
    • h x w = 256 x 128.
    • random horizontal flip + random crop.
  • Triplet
    • stride = 2 in last conv block.
    • h x w = 256 x 128.
    • random horizontal flip + random crop.
  • PCB
    • stride = 1 in last conv block.
    • h x w = 384 x 128.
    • random horizontal flip.
  • ZJU
    • cross entropy + triplet.
    • ims_per_id = 4, ids_per_batch = 16.
    • h x w = 256 x 128.
    • warmup for 10 epochs.
    • random horizontal flip + pad 10 pixel then random crop + random erasing with re = 0.5.
    • label smooth.
    • stride = 1 in last conv block.
    • BNneck.
    • center loss.

Tracking settings for IDE, Triplet, and PCB:

  • stride = 1 in last conv block.
  • h x w = 384 x 128.
  • horizontal flipping + Random Erasing with re = 0.5.

Raw setting for ZJU:

  • cross entropy + triplet.
  • ims_per_id = 4, ids_per_batch = 16.
  • h x w = 256 x 128.
  • random horizontal flip + pad 10 pixel then random crop.

Experiment Results

dataset model settings mAP (%) Rank-1 (%)
Duke IDE Default 58.70 77.56
Duke Triplet Default 62.40 78.19
Duke PCB Default 68.72 83.12
Duke ZJU Default 75.20 86.71
Market IDE Default 69.34 86.58
Market Triplet Default 72.42 86.55
Market PCB Default 77.53 92.52
Market ZJU Default 85.37 93.79

open-reid-tracking's People

Contributors

cysu avatar hou-yz avatar wk910930 avatar xiaobaishu0097 avatar zydou avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.