style(model_zoo): add bot, agw, sbs as built-in model

pull/49/head
liaoxingyu 2020-05-01 09:56:33 +08:00
parent 46228ce946
commit fcc1e04f5c
28 changed files with 22 additions and 824 deletions

View File

@ -2,6 +2,25 @@
## Introduction
**BoT**:
Bag of Tricks and A Strong Baseline for Deep Person Re-identification. CVPRW2019, Oral.
**AGW**:
This is a re-implementation of [ReID-Survey with a Powerful AGW Baseline](https://github.com/mangye16/ReID-Survey)
**SBS**:
stronger baseline on top of BoT with tricks:
1. Non-local block
2. GeM pooling
3. Circle loss
4. Freeze backbone training
5. Cutout data augmentation & Auto Augmentation
6. Cosine annealing learning rate decay
7. Soft margin triplet loss
### Market1501 Baselines
@ -122,3 +141,6 @@ Method: BoT(R50-ibn)
| Small(3000) | ImageNet | 96.4% | 87.7% | 69.2% |
| Medium(5000) | ImageNet | 95.1% | 83.5% | 61.2% |
| Large(10000) | ImageNet | 92.5% | 77.3% | 49.8% |

View File

@ -1,64 +0,0 @@
# AGW Baseline in FastReID
Deep Learning for Person Re-identification: A Survey and Outlook. [arXiv](https://arxiv.org/abs/2001.04193)
This is a re-implementation of [ReID-Survey with a Powerful AGW Baseline](https://github.com/mangye16/ReID-Survey)
## Highlights
- A comprehensive survey with in-depth analysis for person Re-ID in recent years (2016-2019).
- A new evaluation metric, namely mean Inverse Negative Penalty (mINP), which measures the ability to find the hardest correct match.
## Training
To train a model, run
```bash
CUDA_VISIBLE_DEVICES=gpus python train_net.py --config-file <config.yml>
```
For example, to launch a end-to-end baseline training on market1501 dataset on GPU#1,
one should excute:
```bash
CUDA_VISIBLE_DEVICES=1 python train_net.py --config-file='configs/AGW_market1501.yml'
```
## Evaluation
To evaluate the model in test set, run similarly:
```bash
CUDA_VISIBLE_DEVICES=gpus python train_net.py --config-file <configs.yaml> --eval-only MODEL.WEIGHTS model.pth
```
## Experimental Results
### Market1501 dataset
| Method | Pretrained | Rank@1 | mAP | mINP |
| :---: | :---: | :---: |:---: | :---: |
| AGW | ImageNet | 94.9% | 87.4% | 63.1% |
### DukeMTMC dataset
| Method | Pretrained | Rank@1 | mAP | mINP |
| :---: | :---: | :---: |:---: | :---: |
| AGW | ImageNet | 89.2% | 79.5% | 44.5% |
### MSMT17 dataset
| Method | Pretrained | Rank@1 | mAP | mINP |
| :---: | :---: | :---: |:---: | :---: |
| AGW | ImageNet | 76.8% | 53.7% | 12.2% |
```
@article{arxiv20reidsurvey,
title={Deep Learning for Person Re-identification: A Survey and Outlook},
author={Ye, Mang and Shen, Jianbing and Lin, Gaojie and Xiang, Tao and Shao, Ling and Hoi, Steven C. H.},
journal={arXiv preprint arXiv:2001.04193},
year={2020},
}
```

View File

@ -1,18 +0,0 @@
_BASE_: "Base-AGW.yml"
MODEL:
HEADS:
NUM_CLASSES: 702
SOLVER:
MAX_ITER: 23000
STEPS: [10000, 18000]
WARMUP_ITERS: 2500
DATASETS:
NAMES: ("DukeMTMC",)
TESTS: ("DukeMTMC",)
OUTPUT_DIR: "logs/dukemtmc/agw"

View File

@ -1,18 +0,0 @@
_BASE_: "Base-AGW.yml"
MODEL:
HEADS:
NUM_CLASSES: 751
SOLVER:
MAX_ITER: 18000
STEPS: [8000, 14000]
WARMUP_ITERS: 2000
DATASETS:
NAMES: ("Market1501",)
TESTS: ("Market1501",)
OUTPUT_DIR: "logs/market1501/agw"

View File

@ -1,22 +0,0 @@
_BASE_: "Base-AGW.yml"
MODEL:
HEADS:
NUM_CLASSES: 1041
DATASETS:
NAMES: ("MSMT17",)
TESTS: ("MSMT17",)
SOLVER:
MAX_ITER: 42000
STEPS: [19000, 33000]
WARMUP_ITERS: 4700
CHECKPOINT_PERIOD: 5000
TEST:
EVAL_PERIOD: 5000
OUTPUT_DIR: "logs/msmt17/agw"

View File

@ -1,71 +0,0 @@
MODEL:
META_ARCHITECTURE: 'Baseline'
BACKBONE:
NAME: "build_resnet_backbone"
DEPTH: 50
LAST_STRIDE: 1
WITH_NL: True
PRETRAIN: True
HEADS:
NAME: "BNneckHead"
POOL_LAYER: "gempool"
CLS_LAYER: "linear"
NUM_CLASSES: 702
LOSSES:
NAME: ("CrossEntropyLoss", "TripletLoss")
CE:
EPSILON: 0.1
SCALE: 1.0
TRI:
MARGIN: 0.0
HARD_MINING: False
USE_COSINE_DIST: False
SCALE: 1.0
DATASETS:
NAMES: ("DukeMTMC",)
TESTS: ("DukeMTMC",)
INPUT:
SIZE_TRAIN: [256, 128]
SIZE_TEST: [256, 128]
REA:
ENABLED: True
PROB: 0.5
MEAN: [123.675, 116.28, 103.53]
DO_PAD: True
DATALOADER:
PK_SAMPLER: True
NUM_INSTANCE: 4
NUM_WORKERS: 16
SOLVER:
OPT: "Adam"
MAX_ITER: 18000
BASE_LR: 0.00035
BIAS_LR_FACTOR: 2.
WEIGHT_DECAY: 0.0005
WEIGHT_DECAY_BIAS: 0.0005
IMS_PER_BATCH: 64
STEPS: [8000, 14000]
GAMMA: 0.1
WARMUP_FACTOR: 0.01
WARMUP_ITERS: 2000
LOG_PERIOD: 200
CHECKPOINT_PERIOD: 6000
TEST:
EVAL_PERIOD: 2000
IMS_PER_BATCH: 512
CUDNN_BENCHMARK: True
OUTPUT_DIR: "logs"

View File

@ -1,3 +0,0 @@
gpus='1'
CUDA_VISIBLE_DEVICES=$gpus python train_net.py --config-file 'configs/AGW_dukemtmc.yml'

View File

@ -1,3 +0,0 @@
gpus='0'
CUDA_VISIBLE_DEVICES=$gpus python train_net.py --config-file 'configs/AGW_market1501.yml'

View File

@ -1,3 +0,0 @@
gpus='3'
CUDA_VISIBLE_DEVICES=$gpus python train_net.py --config-file 'configs/AGW_msmt17.yml'

View File

@ -1,60 +0,0 @@
# encoding: utf-8
"""
@author: sherlock
@contact: sherlockliao01@gmail.com
"""
import os
import sys
sys.path.append('../..')
from fastreid.config import cfg
from fastreid.engine import DefaultTrainer, default_argument_parser, default_setup
from fastreid.utils.checkpoint import Checkpointer
from fastreid.evaluation import ReidEvaluator
class Trainer(DefaultTrainer):
@classmethod
def build_evaluator(cls, cfg, num_query, output_folder=None):
if output_folder is None:
output_folder = os.path.join(cfg.OUTPUT_DIR, "inference")
return ReidEvaluator(cfg, num_query)
def setup(args):
"""
Create configs and perform basic setups.
"""
cfg.merge_from_file(args.config_file)
cfg.merge_from_list(args.opts)
cfg.freeze()
default_setup(cfg, args)
return cfg
def main(args):
cfg = setup(args)
if args.eval_only:
cfg.defrost()
cfg.MODEL.BACKBONE.PRETRAIN = False
model = Trainer.build_model(cfg)
Checkpointer(model, save_dir=cfg.OUTPUT_DIR).resume_or_load(
cfg.MODEL.WEIGHTS, resume=args.resume
)
from torch import nn
model = nn.DataParallel(model)
model.cuda()
res = Trainer.test(cfg, model)
return res
trainer = Trainer(cfg)
trainer.resume_or_load(resume=args.resume)
return trainer.train()
if __name__ == "__main__":
args = default_argument_parser().parse_args()
print("Command Line Args:", args)
main(args)

View File

@ -1,83 +0,0 @@
# Bag of Tricks and A Strong ReID Baseline in FastReID
Bag of Tricks and A Strong Baseline for Deep Person Re-identification. CVPRW2019, Oral.
[Hao Luo\*](https://github.com/michuanhaohao) [Youzhi Gu\*](https://github.com/shaoniangu) [Xingyu Liao\*](https://github.com/L1aoXingyu) [Shenqi Lai](https://github.com/xiaolai-sqlai)
A Strong Baseline and Batch Normalization Neck for Deep Person Re-identification. IEEE Transactions on Multimedia (Accepted).
[[Journal Version(TMM)]](https://ieeexplore.ieee.org/document/8930088)
[[PDF]](http://openaccess.thecvf.com/content_CVPRW_2019/papers/TRMTMCT/Luo_Bag_of_Tricks_and_a_Strong_Baseline_for_Deep_Person_CVPRW_2019_paper.pdf)
[[Slides]](https://drive.google.com/open?id=1h9SgdJenvfoNp9PTUxPiz5_K5HFCho-V)
[[Poster]](https://drive.google.com/open?id=1izZYAwylBsrldxSMqHCH432P6hnyh1vR)
## Training
To train a model, run
```bash
CUDA_VISIBLE_DEVICES=gpus python train_net.py --config-file <config.yml>
```
For example, to launch a end-to-end baseline training on market1501 dataset on GPU#1,
one should excute:
```bash
CUDA_VISIBLE_DEVICES=1 python train_net.py --config-file='configs/bagtricks_market1501.yml'
```
## Evaluation
To evaluate the model in test set, run similarly:
```bash
CUDA_VISIBLE_DEVICES=gpus python train_net.py --config-file <configs.yaml> --eval-only MODEL.WEIGHTS model.pth
```
## Experimental Results
You can reproduce the results by simply excute
```bash
sh scripts/train_market.sh
sh scripts/train_duke.sh
sh scripts/train_msmt.sh
```
### Market1501 dataset
| Method | Pretrained | Rank@1 | mAP | mINP |
| :---: | :---: | :---: |:---: | :---: |
| BagTricks | ImageNet | 93.9% | 84.9% | 57.1% |
### DukeMTMC dataset
| Method | Pretrained | Rank@1 | mAP | mINP |
| :---: | :---: | :---: |:---: | :---: |
| BagTricks | ImageNet | 87.1% | 76.4% | 39.2% |
### MSMT17 dataset
| Method | Pretrained | Rank@1 | mAP | mINP |
| :---: | :---: | :---: |:---: | :---: |
| BagTricks | ImageNet | 72.2% | 48.4% | 9.6% |
```
@InProceedings{Luo_2019_CVPR_Workshops,
author = {Luo, Hao and Gu, Youzhi and Liao, Xingyu and Lai, Shenqi and Jiang, Wei},
title = {Bag of Tricks and a Strong Baseline for Deep Person Re-Identification},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
month = {June},
year = {2019}
}
@ARTICLE{Luo_2019_Strong_TMM,
author={H. {Luo} and W. {Jiang} and Y. {Gu} and F. {Liu} and X. {Liao} and S. {Lai} and J. {Gu}},
journal={IEEE Transactions on Multimedia},
title={A Strong Baseline and Batch Normalization Neck for Deep Person Re-identification},
year={2019},
pages={1-1},
doi={10.1109/TMM.2019.2958756},
ISSN={1941-0077},
}
```

View File

@ -1,72 +0,0 @@
MODEL:
META_ARCHITECTURE: 'Baseline'
OPEN_LAYERS: ""
BACKBONE:
NAME: "build_resnet_backbone"
DEPTH: 50
LAST_STRIDE: 1
PRETRAIN: True
HEADS:
NAME: "BNneckHead"
CLS_LAYER: "linear"
LOSSES:
NAME: ("CrossEntropyLoss", "TripletLoss")
CE:
EPSILON: 0.1
SCALE: 1.0
TRI:
MARGIN: 0.3
HARD_MINING: True
USE_COSINE_DIST: False
SCALE: 1.0
DATASETS:
NAMES: ("DukeMTMC",)
TESTS: ("DukeMTMC",)
INPUT:
SIZE_TRAIN: [256, 128]
SIZE_TEST: [256, 128]
REA:
ENABLED: True
PROB: 0.5
MEAN: [123.675, 116.28, 103.53]
DO_PAD: True
DATALOADER:
PK_SAMPLER: True
NUM_INSTANCE: 4
NUM_WORKERS: 16
SOLVER:
OPT: "Adam"
MAX_ITER: 18000
BASE_LR: 0.00035
BIAS_LR_FACTOR: 2.
WEIGHT_DECAY: 0.0005
WEIGHT_DECAY_BIAS: 0.
IMS_PER_BATCH: 64
STEPS: [8000, 14000]
GAMMA: 0.1
WARMUP_FACTOR: 0.01
WARMUP_ITERS: 2000
LOG_PERIOD: 200
CHECKPOINT_PERIOD: 2000
TEST:
EVAL_PERIOD: 2000
IMS_PER_BATCH: 512
CUDNN_BENCHMARK: True
OUTPUT_DIR: "logs/dukemtmc/softmax"

View File

@ -1,18 +0,0 @@
_BASE_: "Base-bagtricks.yml"
MODEL:
HEADS:
NUM_CLASSES: 702
SOLVER:
MAX_ITER: 23000
STEPS: [10000, 18000]
WARMUP_ITERS: 2500
DATASETS:
NAMES: ("DukeMTMC",)
TESTS: ("DukeMTMC",)
OUTPUT_DIR: "logs/dukemtmc/bagtricks"

View File

@ -1,19 +0,0 @@
_BASE_: "Base-bagtricks.yml"
MODEL:
HEADS:
NUM_CLASSES: 751
SOLVER:
MAX_ITER: 18000
STEPS: [8000, 14000]
WARMUP_ITERS: 2000
DATASETS:
NAMES: ("Market1501",)
TESTS: ("Market1501",)
OUTPUT_DIR: "logs/market1501/bagtricks"

View File

@ -1,21 +0,0 @@
_BASE_: "Base-bagtricks.yml"
MODEL:
HEADS:
NUM_CLASSES: 1041
DATASETS:
NAMES: ("MSMT17",)
TESTS: ("MSMT17",)
SOLVER:
MAX_ITER: 42000
STEPS: [19000, 33000]
WARMUP_ITERS: 4700
CHECKPOINT_PERIOD: 5000
TEST:
EVAL_PERIOD: 5000
OUTPUT_DIR: "logs/msmt17/bagtricks"

View File

@ -1,3 +0,0 @@
gpus='1'
CUDA_VISIBLE_DEVICES=$gpus python train_net.py --config-file 'configs/bagtricks_dukemtmc.yml'

View File

@ -1,3 +0,0 @@
gpus='0'
CUDA_VISIBLE_DEVICES=$gpus python train_net.py --config-file 'configs/bagtricks_market1501.yml'

View File

@ -1,3 +0,0 @@
gpus='2'
CUDA_VISIBLE_DEVICES=$gpus python train_net.py --config-file 'configs/bagtricks_msmt17.yml'

View File

@ -1,60 +0,0 @@
# encoding: utf-8
"""
@author: sherlock
@contact: sherlockliao01@gmail.com
"""
import os
import sys
from torch import nn
sys.path.append('../..')
from fastreid.config import get_cfg
from fastreid.engine import DefaultTrainer, default_argument_parser, default_setup
from fastreid.utils.checkpoint import Checkpointer
from fastreid.evaluation import ReidEvaluator
class Trainer(DefaultTrainer):
@classmethod
def build_evaluator(cls, cfg, num_query, output_folder=None):
if output_folder is None:
output_folder = os.path.join(cfg.OUTPUT_DIR, "inference")
return ReidEvaluator(cfg, num_query)
def setup(args):
"""
Create configs and perform basic setups.
"""
cfg = get_cfg()
cfg.merge_from_file(args.config_file)
cfg.merge_from_list(args.opts)
cfg.freeze()
default_setup(cfg, args)
return cfg
def main(args):
cfg = setup(args)
if args.eval_only:
cfg.defrost()
cfg.MODEL.BACKBONE.PRETRAIN = False
model = Trainer.build_model(cfg)
model = nn.DataParallel(model)
model = model.cuda()
Checkpointer(model, save_dir=cfg.OUTPUT_DIR).load(cfg.MODEL.WEIGHTS)
res = Trainer.test(cfg, model)
return res
trainer = Trainer(cfg)
trainer.resume_or_load(resume=args.resume)
return trainer.train()
if __name__ == "__main__":
args = default_argument_parser().parse_args()
print("Command Line Args:", args)
main(args)

View File

@ -1,48 +0,0 @@
# Stronger Baseline in FastReID
## Training
To train a model, run
```bash
CUDA_VISIBLE_DEVICES=gpus python train_net.py --config-file <config.yaml>
```
For example, to launch a end-to-end baseline training on market1501 dataset with ibn-net on 4 GPUs,
one should excute:
```bash
CUDA_VISIBLE_DEVICES=0,1,2,3 python train_net.py --config-file='configs/sbs_market1501.yml'
```
## Experimental Results
stronger baseline tricks:
1. Non-local block
2. GeM pooling
3. Circle loss
4. Freeze backbone training
5. Cutout data augmentation & Auto Augmentation
6. Cosine annealing learning rate decay
7. Soft margin triplet loss
### Market1501 dataset
| Method | Pretrained | Rank@1 | mAP | mINP |
| :---: | :---: | :---: |:---: | :---: |
| stronger baseline(ResNet50-ibn) | ImageNet | 95.5 | 88.4 | 65.8 |
| Robust-ReID | ImageNet | 96.2 | 89.7 | - |
### DukeMTMC dataset
| Method | Pretrained | Rank@1 | mAP | mINP |
| :---: | :---: | :---: |:---: | :---: |
| stronger baseline(ResNet50-ibn) | ImageNet | 91.3 | 81.6 | 47.6 |
| Robust-ReID | ImageNet | 89.8 | 80.3 | - |
### MSMT17 dataset
| Method | Pretrained | Rank@1 | mAP | mINP |
| :---: | :---: | :---: |:---: | :---: |
| stronger baseline(ResNet50-ibn) | ImageNet | 84.2 | 61.5 | 15.7 |
| ABD-Net | ImageNet | 82.3 | 60.8 | - |

View File

@ -1,84 +0,0 @@
MODEL:
META_ARCHITECTURE: 'Baseline'
OPEN_LAYERS: "heads"
BACKBONE:
NAME: "build_resnet_backbone"
DEPTH: 50
LAST_STRIDE: 1
WITH_IBN: False
WITH_NL: False
PRETRAIN: True
HEADS:
NAME: "BNneckHead"
CLS_LAYER: "circle"
POOL_LAYER: "gempool"
SCALE: 64
MARGIN: 0.35
LOSSES:
NAME: ("CrossEntropyLoss", "TripletLoss",)
CE:
EPSILON: 0.1
SCALE: 1.0
TRI:
MARGIN: 0.0
HARD_MINING: True
NORM_FEAT: False
USE_COSINE_DIST: False
SCALE: 1.0
DATASETS:
NAMES: ("DukeMTMC",)
TESTS: ("DukeMTMC",)
INPUT:
SIZE_TRAIN: [384, 128]
SIZE_TEST: [384, 128]
DO_AUTOAUG: True
REA:
ENABLED: True
PROB: 0.5
MEAN: [123.675, 116.28, 103.53]
DO_PAD: True
DATALOADER:
PK_SAMPLER: True
NUM_INSTANCE: 16
NUM_WORKERS: 16
SOLVER:
OPT: "Adam"
MAX_ITER: 18000
BASE_LR: 0.00035
BIAS_LR_FACTOR: 2.
WEIGHT_DECAY: 0.0005
WEIGHT_DECAY_BIAS: 0.0
IMS_PER_BATCH: 64
SCHED: "DelayedCosineAnnealingLR"
DELAY_ITERS: 2000
ETA_MIN_LR: 0.00000077
STEPS: [8000, 14000]
GAMMA: 0.1
WARMUP_FACTOR: 0.01
WARMUP_ITERS: 2000
FREEZE_ITERS: 2000
LOG_PERIOD: 200
CHECKPOINT_PERIOD: 6000
TEST:
EVAL_PERIOD: 2000
IMS_PER_BATCH: 512
CUDNN_BENCHMARK: True
OUTPUT_DIR: "logs/dukemtmc/softmax"

View File

@ -1,23 +0,0 @@
_BASE_: "Base-Strongerbaseline.yml"
MODEL:
BACKBONE:
NAME: "build_resnet_backbone"
WITH_IBN: True
WITH_NL: True
PRETRAIN_PATH: "/home/liaoxingyu2/lxy/.cache/torch/checkpoints/resnet50_ibn_a.pth.tar"
HEADS:
NUM_CLASSES: 702
SOLVER:
MAX_ITER: 16000
DELAY_ITERS: 8000
WARMUP_ITERS: 2600
FREEZE_ITERS: 2600
DATASETS:
NAMES: ("DukeMTMC",)
TESTS: ("DukeMTMC",)
OUTPUT_DIR: "logs/dukemtmc/resnet_ibn-nl-gem-circle_s64m0.35_loss-cos_delay-autoaug"

View File

@ -1,26 +0,0 @@
_BASE_: "Base-Strongerbaseline.yml"
MODEL:
BACKBONE:
NAME: "build_resnet_backbone"
WITH_IBN: True
WITH_NL: True
PRETRAIN_PATH: "/home/liaoxingyu2/lxy/.cache/torch/checkpoints/resnet50_ibn_a.pth.tar"
HEADS:
NUM_CLASSES: 751
SOLVER:
MAX_ITER: 12000
DELAY_ITERS: 6000
WARMUP_ITERS: 2000
FREEZE_ITERS: 2000
DATASETS:
NAMES: ("Market1501",)
TESTS: ("Market1501",)
TEST:
EVAL_PERIOD: 2000
OUTPUT_DIR: "logs/market1501/resnet_ibn-nl-gem-circle_s64m0.35_loss-cos_delay-autoaug"

View File

@ -1,29 +0,0 @@
_BASE_: "Base-Strongerbaseline.yml"
MODEL:
BACKBONE:
NAME: "build_resnet_backbone"
WITH_IBN: True
WITH_NL: True
PRETRAIN_PATH: "/home/liaoxingyu2/lxy/.cache/torch/checkpoints/resnet50_ibn_a.pth.tar"
HEADS:
NUM_CLASSES: 1041
DATASETS:
NAMES: ("MSMT17",)
TESTS: ("MSMT17",)
SOLVER:
MAX_ITER: 29000
DELAY_ITERS: 14000
WARMUP_ITERS: 4700
FREEZE_ITERS: 4700
CHECKPOINT_PERIOD: 4000
TEST:
EVAL_PERIOD: 4000
OUTPUT_DIR: "logs/msmt17/resnet_ibn-nl-gem-circle_s64m0.35_loss-cos_delay-autoaug"

View File

@ -1,4 +0,0 @@
gpus='0'
CUDA_VISIBLE_DEVICES=$gpus python train_net.py --config-file 'configs/sbs_dukemtmc.yml' \

View File

@ -1,3 +0,0 @@
gpus='2'
CUDA_VISIBLE_DEVICES=$gpus python train_net.py --config-file 'configs/sbs_market1501.yml'

View File

@ -1,3 +0,0 @@
gpus='3'
CUDA_VISIBLE_DEVICES=$gpus python train_net.py --config-file 'configs/sbs_msmt17.yml'

View File

@ -1,60 +0,0 @@
# encoding: utf-8
"""
@author: sherlock
@contact: sherlockliao01@gmail.com
"""
import os
import sys
from torch import nn
sys.path.append('../..')
from fastreid.config import get_cfg
from fastreid.engine import DefaultTrainer, default_argument_parser, default_setup
from fastreid.utils.checkpoint import Checkpointer
from fastreid.evaluation import ReidEvaluator
class Trainer(DefaultTrainer):
@classmethod
def build_evaluator(cls, cfg, num_query, output_folder=None):
if output_folder is None:
output_folder = os.path.join(cfg.OUTPUT_DIR, "inference")
return ReidEvaluator(cfg, num_query)
def setup(args):
"""
Create configs and perform basic setups.
"""
cfg = get_cfg()
cfg.merge_from_file(args.config_file)
cfg.merge_from_list(args.opts)
cfg.freeze()
default_setup(cfg, args)
return cfg
def main(args):
cfg = setup(args)
if args.eval_only:
cfg.defrost()
cfg.MODEL.BACKBONE.PRETRAIN = False
model = Trainer.build_model(cfg)
model = nn.DataParallel(model)
model = model.cuda()
Checkpointer(model, save_dir=cfg.OUTPUT_DIR).load(cfg.MODEL.WEIGHTS)
res = Trainer.test(cfg, model)
return res
trainer = Trainer(cfg)
trainer.resume_or_load(resume=args.resume)
return trainer.train()
if __name__ == "__main__":
args = default_argument_parser().parse_args()
print("Command Line Args:", args)
main(args)