researchmm / SiamDW

[CVPR'19 Oral] Deeper and Wider Siamese Networks for Real-Time Visual Tracking
http://openaccess.thecvf.com/content_CVPR_2019/html/Zhang_Deeper_and_Wider_Siamese_Networks_for_Real-Time_Visual_Tracking_CVPR_2019_paper.html
MIT License
751 stars 180 forks source link

torch.nn.modules.module.ModuleAttributeError: 'SiamRPNRes22' object has no attribute 'module' #109

Open danho47 opened 3 years ago

danho47 commented 3 years ago

I want to train SiamRPN, but I get this error,

/home/honda/SiamDW/siamese_tracking/../lib/core/config.py:183: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. exp_config = edict(yaml.load(f)) => creating logs/SiamRPNRes22 => creating logs/SiamRPNRes22/SiamRPNRes22_2020-11-17-22-10 Namespace(cfg='experiments/train/SiamRPN.yaml', gpus='1', workers=None) {'CHECKPOINT_DIR': 'snapshot', 'GPUS': '1', 'OUTPUT_DIR': 'logs', 'PRINT_FREQ': 10, 'SIAMFC': {'DATASET': {'BLUR': 0, 'COLOR': 1, 'FLIP': 0, 'GOT10K': {'ANNOTATION': '/home/zhbli/Dataset/data3/got10k/train.json', 'PATH': '/home/zhbli/Dataset/data3/got10k/crop511'}, 'ROTATION': 0, 'SCALE': 0.05, 'SHIFT': 4, 'VID': {'ANNOTATION': '/home/zhbli/Dataset/data2/vid/train.json', 'PATH': '/home/zhbli/Dataset/data2/vid/crop511'}}, 'TEST': {'DATA': 'VOT2015', 'END_EPOCH': 50, 'MODEL': 'SiamFCIncep22', 'START_EPOCH': 30}, 'TRAIN': {'BATCH': 32, 'END_EPOCH': 50, 'LR': 0.001, 'LR_END': 1e-07, 'LR_POLICY': 'log', 'MODEL': 'SiamFCIncep22', 'MOMENTUM': 0.9, 'PAIRS': 200000, 'PRETRAIN': 'resnet23_inlayer.model', 'RESUME': False, 'SEARCH_SIZE': 255, 'START_EPOCH': 0, 'STRIDE': 8, 'TEMPLATE_SIZE': 127, 'WEIGHT_DECAY': 0.0001, 'WHICH_USE': 'GOT10K'}, 'TUNE': {'DATA': 'VOT2015', 'METHOD': 'GENE', 'MODEL': 'SiamFCIncep22'}}, 'SIAMRPN': {'DATASET': {'BLUR': 0.2, 'COCO': {'ANNOTATION': '/home/honda/data/data/coco/train2017.json', 'PATH': '/home/honda/data/coco/crop271', 'RANGE': 1, 'USE': 100000}, 'COLOR': 1, 'DET': {'ANNOTATION': '/home/honda/data/det/train.json', 'PATH': '/home/honda/data/det/crop271', 'RANGE': 100, 'USE': 100000}, 'FLIP': 0, 'GOT10K': {'ANNOTATION': '/home/honda/data/data/got10k/train.json', 'PATH': '/home/honda/data/got10k/crop271', 'RANGE': 100, 'USE': 200000}, 'LASOT': {'ANNOTATION': '/home/honda/data/data/lasot/train2017.json', 'PATH': '/home/honda/data/lasot/crop271', 'RANGE': 100, 'USE': 200000}, 'ROTATION': 0, 'SCALE': 0.05, 'SHIFT': 4, 'VID': {'ANNOTATION': '/home/honda/data/Copy of ' 'SiamDW_DATA/VID/train.json', 'PATH': '/home/honda/data/Copy of ' 'SiamDW_DATA/VID/crop255', 'RANGE': 100, 'USE': 200000}, 'YTB': {'ANNOTATION': '/home/honda/data/y2b/train.json', 'PATH': '/home/honda/data/y2b/crop271', 'RANGE': 3, 'USE': 200000}}, 'TEST': {'DATA': 'VOT2016', 'END_EPOCH': 50, 'ISTRUE': True, 'MODEL': 'SiamRPNRes22', 'START_EPOCH': 20, 'THREADS': 16}, 'TRAIN': {'ANCHORS_ALL_KEEP': 64, 'ANCHORS_POS_KEEP': 16, 'ANCHORS_RATIOS': [0.33, 0.5, 1, 2, 3], 'ANCHORS_SCALES': [8], 'ANCHORS_THR_HIGH': 0.6, 'ANCHORS_THR_LOW': 0.3, 'BATCH': 32, 'CLS_TYPE': 'thicker', 'CLS_WEIGHT': 1, 'END_EPOCH': 50, 'ISTRUE': True, 'LR': 0.01, 'LR_END': 1e-05, 'LR_POLICY': 'log', 'MODEL': 'SiamRPNRes22', 'MOMENTUM': 0.9, 'PRETRAIN': 'CIResNet22_PRETRAIN.model', 'REG_WEIGHT': 1, 'RESUME': False, 'SEARCH_SIZE': 255, 'START_EPOCH': 0, 'STRIDE': 8, 'TEMPLATE_SIZE': 127, 'WEIGHT_DECAY': 0.0005, 'WHICH_USE': ['YTB', 'VID']}, 'TUNE': {'DATA': 'VOT2016', 'ISTRUE': False, 'METHOD': 'TPE', 'MODEL': 'SiamRPNRes22'}}, 'WORKERS': 32} /home/honda/SiamDW/siamese_tracking/../lib/models/modules.py:188: UserWarning: nn.init.kaiming_normal is now deprecated in favor of nn.init.kaimingnormal. nn.init.kaiming_normal(m.weight, mode='fan_out') /home/honda/SiamDW/siamesetracking/../lib/models/modules.py:190: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant. nn.init.constant(m.weight, 1) /home/honda/SiamDW/siamesetracking/../lib/models/modules.py:191: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant. nn.init.constant(m.bias, 0) SiamRPNRes22( (criterion): BCEWithLogitsLoss() (features): ResNet22( (features): ResNet( (conv1): Conv2d(3, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False) (bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (relu): ReLU(inplace=True) (maxpool): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False) (layer1): Sequential( (0): Bottleneck_CI( (conv1): Conv2d(64, 64, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (conv2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) (bn2): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (conv3): Conv2d(64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (relu): ReLU(inplace=True) (downsample): Sequential( (0): Conv2d(64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False) (1): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) ) ) (1): Bottleneck_CI( (conv1): Conv2d(256, 64, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (conv2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) (bn2): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (conv3): Conv2d(64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (relu): ReLU(inplace=True) ) (2): Bottleneck_CI( (conv1): Conv2d(256, 64, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (conv2): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) (bn2): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (conv3): Conv2d(64, 256, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (relu): ReLU(inplace=True) ) ) (layer2): Sequential( (0): Bottleneck_CI( (conv1): Conv2d(256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) (bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (conv3): Conv2d(128, 512, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (relu): ReLU(inplace=True) (downsample): Sequential( (0): Conv2d(256, 512, kernel_size=(1, 1), stride=(1, 1), bias=False) (1): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) ) ) (1): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False) (2): Bottleneck_CI( (conv1): Conv2d(512, 128, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) (bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (conv3): Conv2d(128, 512, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (relu): ReLU(inplace=True) ) (3): Bottleneck_CI( (conv1): Conv2d(512, 128, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) (bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (conv3): Conv2d(128, 512, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (relu): ReLU(inplace=True) ) (4): Bottleneck_CI( (conv1): Conv2d(512, 128, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn1): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (conv2): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False) (bn2): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (conv3): Conv2d(128, 512, kernel_size=(1, 1), stride=(1, 1), bias=False) (bn3): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True) (relu): ReLU(inplace=True) ) ) ) ) (connect_model): RPN_Up( (template_cls): Conv2d(512, 5120, kernel_size=(3, 3), stride=(1, 1)) (template_reg): Conv2d(512, 10240, kernel_size=(3, 3), stride=(1, 1)) (search_cls): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1)) (search_reg): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1)) (adjust): Conv2d(20, 20, kernel_size=(1, 1), stride=(1, 1)) ) ) load pretrained model from ./pretrain/CIResNet22_PRETRAIN.model remove prefix 'module.' missing keys:{'connect_model.adjust.weight', 'features.features.layer2.3.bn2.num_batches_tracked', 'features.features.layer2.4.bn3.num_batches_tracked', 'connect_model.adjust.bias', 'features.features.layer1.2.bn3.num_batches_tracked', 'connect_model.search_cls.weight', 'features.features.layer2.2.bn2.num_batches_tracked', 'connect_model.template_cls.bias', 'features.features.layer2.0.bn3.num_batches_tracked', 'connect_model.template_reg.bias', 'features.features.layer1.2.bn2.num_batches_tracked', 'connect_model.search_reg.weight', 'features.features.layer2.2.bn1.num_batches_tracked', 'features.features.layer2.4.bn1.num_batches_tracked', 'features.features.layer1.0.bn2.num_batches_tracked', 'features.features.layer2.4.bn2.num_batches_tracked', 'features.features.layer1.2.bn1.num_batches_tracked', 'features.features.layer2.3.bn3.num_batches_tracked', 'features.features.layer1.0.bn3.num_batches_tracked', 'features.features.layer2.3.bn1.num_batches_tracked', 'features.features.layer1.0.downsample.1.num_batches_tracked', 'features.features.layer1.1.bn2.num_batches_tracked', 'features.features.layer1.0.bn1.num_batches_tracked', 'connect_model.template_cls.weight', 'features.features.layer2.0.bn2.num_batches_tracked', 'features.features.layer2.0.bn1.num_batches_tracked', 'features.features.layer1.1.bn3.num_batches_tracked', 'features.features.layer2.2.bn3.num_batches_tracked', 'features.features.layer2.0.downsample.1.num_batches_tracked', 'features.features.layer1.1.bn1.num_batches_tracked', 'connect_model.search_cls.bias', 'features.features.bn1.num_batches_tracked', 'connect_model.search_reg.bias', 'connect_model.template_reg.weight'} unused checkpoint keys:set() trainable params: features.features.layer2.4.conv1.weight features.features.layer2.4.bn1.weight features.features.layer2.4.bn1.bias features.features.layer2.4.conv2.weight features.features.layer2.4.bn2.weight features.features.layer2.4.bn2.bias features.features.layer2.4.conv3.weight features.features.layer2.4.bn3.weight features.features.layer2.4.bn3.bias connect_model.template_cls.weight connect_model.template_cls.bias connect_model.template_reg.weight connect_model.template_reg.bias connect_model.search_cls.weight connect_model.search_cls.bias connect_model.search_reg.weight connect_model.search_reg.bias connect_model.adjust.weight connect_model.adjust.bias GPU NUM: 1 model prepare done train datas: ['YTB', 'VID'] YTB loaded. VID loaded. dataset length 400000 {'GPUS': '1', 'WORKERS': 32, 'PRINT_FREQ': 10, 'OUTPUT_DIR': 'logs', 'CHECKPOINT_DIR': 'snapshot', 'SIAMFC': {'TRAIN': {'MODEL': 'SiamFCIncep22', 'RESUME': False, 'START_EPOCH': 0, 'END_EPOCH': 50, 'TEMPLATE_SIZE': 127, 'SEARCH_SIZE': 255, 'STRIDE': 8, 'BATCH': 32, 'PAIRS': 200000, 'PRETRAIN': 'resnet23_inlayer.model', 'LR_POLICY': 'log', 'LR': 0.001, 'LR_END': 1e-07, 'MOMENTUM': 0.9, 'WEIGHT_DECAY': 0.0001, 'WHICH_USE': 'GOT10K'}, 'TEST': {'MODEL': 'SiamFCIncep22', 'DATA': 'VOT2015', 'START_EPOCH': 30, 'END_EPOCH': 50}, 'TUNE': {'MODEL': 'SiamFCIncep22', 'DATA': 'VOT2015', 'METHOD': 'GENE'}, 'DATASET': {'VID': {'PATH': '/home/zhbli/Dataset/data2/vid/crop511', 'ANNOTATION': '/home/zhbli/Dataset/data2/vid/train.json'}, 'GOT10K': {'PATH': '/home/zhbli/Dataset/data3/got10k/crop511', 'ANNOTATION': '/home/zhbli/Dataset/data3/got10k/train.json'}, 'SHIFT': 4, 'SCALE': 0.05, 'COLOR': 1, 'FLIP': 0, 'BLUR': 0, 'ROTATION': 0}}, 'SIAMRPN': {'DATASET': {'VID': {'PATH': '/home/honda/data/Copy of SiamDW_DATA/VID/crop255', 'ANNOTATION': '/home/honda/data/Copy of SiamDW_DATA/VID/train.json', 'RANGE': 100, 'USE': 200000}, 'YTB': {'PATH': '/home/honda/data/y2b/crop271', 'ANNOTATION': '/home/honda/data/y2b/train.json', 'RANGE': 3, 'USE': 200000}, 'COCO': {'PATH': '/home/honda/data/coco/crop271', 'ANNOTATION': '/home/honda/data/data/coco/train2017.json', 'RANGE': 1, 'USE': 100000}, 'DET': {'PATH': '/home/honda/data/det/crop271', 'ANNOTATION': '/home/honda/data/det/train.json', 'RANGE': 100, 'USE': 100000}, 'GOT10K': {'PATH': '/home/honda/data/got10k/crop271', 'ANNOTATION': '/home/honda/data/data/got10k/train.json', 'RANGE': 100, 'USE': 200000}, 'LASOT': {'PATH': '/home/honda/data/lasot/crop271', 'ANNOTATION': '/home/honda/data/data/lasot/train2017.json', 'RANGE': 100, 'USE': 200000}, 'SHIFT': 4, 'SCALE': 0.05, 'COLOR': 1, 'FLIP': 0, 'BLUR': 0.2, 'ROTATION': 0}, 'TRAIN': {'MODEL': 'SiamRPNRes22', 'RESUME': False, 'START_EPOCH': 0, 'END_EPOCH': 50, 'TEMPLATE_SIZE': 127, 'SEARCH_SIZE': 255, 'STRIDE': 8, 'BATCH': 32, 'PRETRAIN': 'CIResNet22_PRETRAIN.model', 'LR_POLICY': 'log', 'LR': 0.01, 'LR_END': 1e-05, 'MOMENTUM': 0.9, 'WEIGHT_DECAY': 0.0005, 'CLS_WEIGHT': 1, 'REG_WEIGHT': 1, 'WHICH_USE': ['YTB', 'VID'], 'ANCHORS_RATIOS': [0.33, 0.5, 1, 2, 3], 'ANCHORS_SCALES': [8], 'ANCHORS_THR_HIGH': 0.6, 'ANCHORS_THR_LOW': 0.3, 'ANCHORS_POS_KEEP': 16, 'ANCHORS_ALL_KEEP': 64, 'ISTRUE': True, 'CLS_TYPE': 'thicker'}, 'TEST': {'MODEL': 'SiamRPNRes22', 'DATA': 'VOT2016', 'START_EPOCH': 20, 'END_EPOCH': 50, 'ISTRUE': True, 'THREADS': 16}, 'TUNE': {'MODEL': 'SiamRPNRes22', 'DATA': 'VOT2016', 'METHOD': 'TPE', 'ISTRUE': False}}} Traceback (most recent call last): File "siamese_tracking/train_siamrpn.py", line 200, in main() File "siamese_tracking/train_siamrpn.py", line 190, in main logger, cls_type = config.SIAMRPN.TRAIN.CLS_TYPE) File "/home/honda/SiamDW/siamese_tracking/../lib/core/function.py", line 73, in siamrpn_train model, optimizer = unfix_more(model, optimizer, epoch, cfg, cur_lr, logger) File "/home/honda/SiamDW/siamese_tracking/../lib/core/function.py", line 142, in unfix_more if model.module.features.unfix(epoch / cfg.SIAMFC.TRAIN.END_EPOCH): File "/home/honda/anaconda3/envs/siamdw/lib/python3.7/site-packages/torch/nn/modules/module.py", line 779, in getattr type(self).name, name)) torch.nn.modules.module.ModuleAttributeError: 'SiamRPNRes22' object has no attribute 'module'

Please, some advice