JDAI-CV / fast-reid

SOTA Re-identification Methods and Toolbox
Apache License 2.0
3.42k stars 837 forks source link

ResNest error #297

Closed wangbingo closed 4 years ago

wangbingo commented 4 years ago

Dr: When I tried an everything default training with a ResNest backbone, it goes wrong. And both M and D are the same. Any suggestion? Thanks.

cd fast-reid && python ./tools/train_net.py --config-file ./configs/DukeMTMC/bagtricks_S50.yml MODEL.DEVICE "cuda:0"

Traceback (most recent call last): File "./tools/train_net.py", line 58, in args=(args,), File "./fastreid/engine/launch.py", line 71, in launch main_func(args) File "./tools/train_net.py", line 42, in main trainer = DefaultTrainer(cfg) File "./fastreid/engine/defaults.py", line 211, in init model = self.build_model(cfg) File "./fastreid/engine/defaults.py", line 377, in build_model model = build_model(cfg) File "./fastreid/modeling/meta_arch/build.py", line 24, in build_model model = META_ARCH_REGISTRY.get(meta_arch)(cfg) File "./fastreid/modeling/meta_arch/baseline.py", line 26, in init self.backbone = build_backbone(cfg) File "./fastreid/modeling/backbones/build.py", line 27, in build_backbone backbone = BACKBONE_REGISTRY.get(backbone_name)(cfg) File "./fastreid/modeling/backbones/resnest.py", line 401, in build_resnest_backbone avd=True, avd_first=False) File "./fastreid/modeling/backbones/resnest.py", line 209, in init self.layer1 = self._make_layer(block, 64, layers[0], 1, bn_norm, with_ibn=with_ibn, is_first=False) File "./fastreid/modeling/backbones/resnest.py", line 269, in _make_layer last_gamma=self.last_gamma)) File "./fastreid/modeling/backbones/resnest.py", line 78, in init dropblock_prob=dropblock_prob) File "./fastreid/layers/splat.py", line 42, in init self.bn0 = get_norm(norm_layer, channels radix, num_splits) TypeError: get_norm() takes 2 positional arguments but 3 were given -----------------------full config------------------------------------------ [10/07 17:07:41 fastreid]: Contents of args.config_file=./configs/DukeMTMC/bagtricks_S50.yml: BASE: "../Base-bagtricks.yml"

MODEL: BACKBONE: NAME: "build_resnest_backbone"

DATASETS: NAMES: ("DukeMTMC",) TESTS: ("DukeMTMC",)

OUTPUT_DIR: "logs/dukemtmc/bagtricks_S50"

[10/07 17:07:41 fastreid]: Running with full config: CUDNN_BENCHMARK: True DATALOADER: NAIVE_WAY: True NUM_INSTANCE: 4 NUM_WORKERS: 8 PK_SAMPLER: True DATASETS: COMBINEALL: False NAMES: ('DukeMTMC',) TESTS: ('DukeMTMC',) INPUT: CJ: BRIGHTNESS: 0.15 CONTRAST: 0.15 ENABLED: False HUE: 0.1 PROB: 0.8 SATURATION: 0.1 DO_AUGMIX: False DO_AUTOAUG: False DO_FLIP: True DO_PAD: True FLIP_PROB: 0.5 PADDING: 10 PADDING_MODE: constant REA: ENABLED: True MEAN: [123.675, 116.28, 103.53] PROB: 0.5 RPT: ENABLED: False PROB: 0.5 SIZE_TEST: [256, 128] SIZE_TRAIN: [256, 128] MODEL: BACKBONE: DEPTH: 50x FEAT_DIM: 2048 LAST_STRIDE: 1 NAME: build_resnest_backbone NORM: BN PRETRAIN: True PRETRAIN_PATH: /export/home/lxy/.cache/torch/checkpoints/resnet50-19c8e357.pth WITH_IBN: False WITH_NL: False WITH_SE: False DEVICE: cuda:0 FREEZE_LAYERS: [''] HEADS: CLS_LAYER: linear EMBEDDING_DIM: 0 MARGIN: 0.15 NAME: EmbeddingHead NECK_FEAT: before NORM: BN NUM_CLASSES: 0 POOL_LAYER: avgpool SCALE: 128 WITH_BNNECK: True LOSSES: CE: ALPHA: 0.2 EPSILON: 0.1 SCALE: 1.0 CIRCLE: ALPHA: 128 MARGIN: 0.25 SCALE: 1.0 FL: ALPHA: 0.25 GAMMA: 2 SCALE: 1.0 NAME: ('CrossEntropyLoss', 'TripletLoss') TRI: HARD_MINING: True MARGIN: 0.3 NORM_FEAT: False SCALE: 1.0 META_ARCHITECTURE: Baseline PIXEL_MEAN: [123.675, 116.28, 103.53] PIXEL_STD: [58.395, 57.120000000000005, 57.375] WEIGHTS: OUTPUT_DIR: logs/dukemtmc/bagtricks_S50 SOLVER: AMP_ENABLED: False BASE_LR: 0.00035 BIAS_LR_FACTOR: 2.0 CHECKPOINT_PERIOD: 60 DELAY_ITERS: 0 ETA_MIN_LR: 3e-07 FREEZE_ITERS: 0 GAMMA: 0.1 HEADS_LR_FACTOR: 1.0 IMS_PER_BATCH: 64 MAX_ITER: 120 MOMENTUM: 0.9 OPT: Adam SCHED: WarmupMultiStepLR STEPS: [40, 90] SWA: ENABLED: False ETA_MIN_LR: 3.5e-06 ITER: 10 LR_FACTOR: 10.0 LR_SCHED: False PERIOD: 2 WARMUP_FACTOR: 0.01 WARMUP_ITERS: 10 WARMUP_METHOD: linear WEIGHT_DECAY: 0.0005 WEIGHT_DECAY_BIAS: 0.0005 TEST: AQE: ALPHA: 3.0 ENABLED: False QE_K: 5 QE_TIME: 1 EVAL_PERIOD: 30 IMS_PER_BATCH: 128 METRIC: cosine PRECISE_BN: DATASET: Market1501 ENABLED: False NUM_ITER: 300 RERANK: ENABLED: False K1: 20 K2: 6 LAMBDA: 0.3 ROC_ENABLED: False [10/07 17:07:41 fastreid]: Full config saved to /content/fast-reid/logs/dukemtmc/bagtricks_S50/config.yaml [10/07 17:07:41 fastreid.utils.env]: Using a generated random seed 41885242 [10/07 17:07:41 fastreid.engine.defaults]: Prepare training set [10/07 17:07:42 fastreid.data.datasets.bases]: => Loaded DukeMTMC in csv format: subset # ids # images # cameras
train 702 16522 8

[10/07 17:07:42 fastreid.engine.defaults]: Auto-scaling the config to num_classes=702, max_Iter=30960, wamrup_Iter=2580, freeze_Iter=0, delay_Iter=0, step_Iter=[10320, 23220], ckpt_Iter=15600, eval_Iter=7800. Traceback (most recent call last): File "./tools/train_net.py", line 58, in args=(args,), File "./fastreid/engine/launch.py", line 71, in launch main_func(args) File "./tools/train_net.py", line 42, in main trainer = DefaultTrainer(cfg) File "./fastreid/engine/defaults.py", line 211, in init model = self.build_model(cfg) File "./fastreid/engine/defaults.py", line 377, in build_model model = build_model(cfg) File "./fastreid/modeling/meta_arch/build.py", line 24, in build_model model = META_ARCH_REGISTRY.get(meta_arch)(cfg) File "./fastreid/modeling/meta_arch/baseline.py", line 26, in init self.backbone = build_backbone(cfg) File "./fastreid/modeling/backbones/build.py", line 27, in build_backbone backbone = BACKBONE_REGISTRY.get(backbone_name)(cfg) File "./fastreid/modeling/backbones/resnest.py", line 401, in build_resnest_backbone avd=True, avd_first=False) File "./fastreid/modeling/backbones/resnest.py", line 209, in init self.layer1 = self._make_layer(block, 64, layers[0], 1, bn_norm, with_ibn=with_ibn, is_first=False) File "./fastreid/modeling/backbones/resnest.py", line 269, in _make_layer last_gamma=self.last_gamma)) File "./fastreid/modeling/backbones/resnest.py", line 78, in init dropblock_prob=dropblock_prob) File "./fastreid/layers/splat.py", line 42, in init self.bn0 = get_norm(norm_layer, channels radix, num_splits) TypeError: get_norm() takes 2 positional arguments but 3 were given

L1aoXingyu commented 4 years ago

fixed, please use the latest code.

wangbingo commented 4 years ago

It works! Thx, Doc.

ShowTsai commented 4 years ago

so the parameter num_splits in init can be removed

sky186 commented 3 years ago

@L1aoXingyu 最新代码 agw_s50 自己的数据训练, 加载提供的预训练模型 error ModuleAttributeError embeddinghead object has no attribute weight

L1aoXingyu commented 3 years ago

@sky186 加载的 imagenet pretrain model?

sky186 commented 3 years ago

@L1aoXingyu imagenet 和 您训练的模型,都加载过,是一样的错误

L1aoXingyu commented 3 years ago

可以正常训练吗