Giter Site home page Giter Site logo

issac8huxleg / reid-strong-baseline Goto Github PK

View Code? Open in Web Editor NEW

This project forked from michuanhaohao/reid-strong-baseline

0.0 2.0 0.0 499 KB

Bag of Tricks and A Strong Baseline for Deep Person Re-identification

Home Page: https://arxiv.org/abs/1903.07071

License: MIT License

Shell 7.49% Python 92.51%

reid-strong-baseline's Introduction

Bags of Tricks and A Strong ReID Baseline

Paper: "Bags of Tricks and A Strong Baseline for Deep Person Re-identification"[pdf]

The codes are expanded on a ReID-baseline , which is open sourced by our co-first author Xingyu Liao.

Authors

We support

  • easy dataset preparation
  • end-to-end training and evaluation
  • high modular management

Bag of tricks

  • Warm up learning rate
  • Random erasing augmentation
  • Label smoothing
  • Last stride
  • BNNeck
  • Center loss

Pipeline

Results (rank1/mAP)

Model Market1501 DukeMTMC-reID
Standard baseline 87.7 (74.0) 79.7 (63.8)
+Warmup 88.7 (75.2) 80.6(65.1)
+Random erasing augmentation 91.3 (79.3) 81.5 (68.3)
+Label smoothing 91.4 (80.3) 82.4 (69.3)
+Last stride=1 92.0 (81.7) 82.6 (70.6)
+BNNeck 94.1 (85.7) 86.2 (75.9)
+Center loss 94.5 (85.9) 86.4 (76.4)
+Reranking 95.4 (94.2) 90.3 (89.1)

model(Market1501)

model(DukeMTMC-reID)

Get Started

The designed architecture follows this guide PyTorch-Project-Template, you can check each folder's purpose by yourself.

  1. cd to folder where you want to download this repo

  2. Run git clone https://github.com/michuanhaohao/reid-strong-baseline.git

  3. Install dependencies:

  4. Prepare dataset

    Create a directory to store reid datasets under this repo via

    cd reid-strong-baseline
    mkdir data

    (1)Market1501

    data
        market1501 # this folder contains 6 files.
            bounding_box_test/
            bounding_box_train/
            ......

    (2)DukeMTMC-reID

    data
        dukemtmc-reid
        	DukeMTMC-reID # this folder contains 8 files.
            	bounding_box_test/
            	bounding_box_train/
            	......
  5. Prepare pretrained model if you don't have

    from torchvision import models
    models.resnet50(pretrained=True)

    Then it will automatically download model in ~/.torch/models/, you should set this path in config/defaults.py for all training or set in every single training config file in configs/.

  6. If you want to know the detained configurations and their meaning, please refer to config/defaults.py. If you want to set your own parameters, you can follow our method: create a new yml file, then set your own parameters. Add --config_file='configs/your yml file' int the commands described below, then our code will merge your configuration. automatically.

Train

You can run these commands in .sh files for training different datasets of differernt loss. You can also directly run code sh *.sh to run our demo.

  1. Market1501, cross entropy loss + triplet loss
python3 tools/train.py --config_file='configs/softmax_triplet.yml' MODEL.DEVICE_ID "('your device id')" DATASETS.NAMES "('market1501')" OUTPUT_DIR "('your path to save checkpoints and logs')"
  1. DukeMTMC-reID, cross entropy loss + triplet loss + center loss
python3 tools/train.py --config_file='configs/softmax_triplet_with_center.yml' MODEL.DEVICE_ID "('your device id')" DATASETS.NAMES "('dukemtmc')" OUTPUT_DIR "('your path to save checkpoints and logs')"

Test

You can test your model's performance directly by running these commands in .sh files. You can also change the configuration to determine which feature of BNNeck and whether the feature is normalized (equivalent to use Cosine distance or Euclidean distance) for testing.

Please replace the data path of the model.

  1. Test with Euclidean distance using feature before BN without re-ranking,.
python3 tools/test.py --config_file='configs/softmax_triplet_with_center.yml' MODEL.DEVICE_ID "('your device id')" DATASETS.NAMES "('market1501')" TEST.NECK_FEAT "('before')" TEST.FEAT_NORM "('no')" TEST.WEIGHT "('your path to trained checkpoints')"
  1. Test with Cosine distance using feature after BN without re-ranking,.
python3 tools/test.py --config_file='configs/softmax_triplet_with_center.yml' MODEL.DEVICE_ID "('your device id')" DATASETS.NAMES "('market1501')" TEST.NECK_FEAT "('after')" TEST.FEAT_NORM "('yes')" TEST.WEIGHT "('your path to trained checkpoints')"
  1. Test with Cosine distance using feature after BN with re-ranking
python3 tools/test.py --config_file='configs/softmax_triplet_with_center.yml' MODEL.DEVICE_ID "('your device id')" DATASETS.NAMES "('dukemtmc')" TEST.NECK_FEAT "('after')" TEST.FEAT_NORM "('yes')" TEST.RE_RANKING "('yes')" TEST.WEIGHT "('your path to trained checkpoints')"

reid-strong-baseline's People

Contributors

michuanhaohao avatar

Watchers

James Cloos avatar  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.