From 38a45b7b5ca73e0809e6b91170ec036addb476d7 Mon Sep 17 00:00:00 2001 From: shaoniangu Date: Tue, 26 Mar 2019 17:02:11 +0800 Subject: [PATCH] Update readme according to issue #12 --- README.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index da7baee..fccfa2e 100644 --- a/README.md +++ b/README.md @@ -104,13 +104,13 @@ The designed architecture follows this guide [PyTorch-Project-Template](https:// 5. Prepare pretrained model if you don't have - (1)resnet + (1)Resnet ```python from torchvision import models models.resnet50(pretrained=True) ``` - (2)senet + (2)Senet ```python import torch.utils.model_zoo as model_zoo @@ -118,10 +118,14 @@ The designed architecture follows this guide [PyTorch-Project-Template](https:// ``` 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/` or set in every single command. + (3)Load your self-trained model + + If you want to continue your train process based on your self-trained model, you can change the configuration `PRETRAIN_CHOICE` from 'imagenet' to 'self' and set the `PRETRAIN_PATH` to your self-trained model. We offer `Experiment-pretrain_choice-all_tricks-tri_center-market.sh` as an example. + 6. If you want to know the detailed 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. +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 after your custom modification. 1. Market1501, cross entropy loss + triplet loss @@ -137,23 +141,23 @@ python3 tools/train.py --config_file='configs/softmax_triplet_with_center.yml' M ``` ## 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 is used and whether the feature is normalized (equivalent to use Cosine distance or Euclidean distance) for testing. +You can test your model's performance directly by running these commands in `.sh ` files after your custom modification. You can also change the configuration to determine which feature of BNNeck is used and whether the feature is normalized (equivalent to use Cosine distance or Euclidean distance) for testing. -Please replace the data path of the model. +Please replace the data path of the model and set the `PRETRAIN_CHOICE` as 'self' to avoid time consuming on loading ImageNet pretrained model. 1. Test with Euclidean distance using feature before BN without re-ranking,. ```bash -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')" +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')" MODEL.PRETRAIN_CHOICE "('self')" TEST.WEIGHT "('your path to trained checkpoints')" ``` 2. Test with Cosine distance using feature after BN without re-ranking,. ```bash -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')" +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')" MODEL.PRETRAIN_CHOICE "('self')" TEST.WEIGHT "('your path to trained checkpoints')" ``` 3. Test with Cosine distance using feature after BN with re-ranking ```bash -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')" +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')" MODEL.PRETRAIN_CHOICE "('self')" TEST.RE_RANKING "('yes')" TEST.WEIGHT "('your path to trained checkpoints')" ```