Open linshuheng6 opened 5 years ago
This is my command, may be helpful for you.
python main.py --input ./input --video_root ~/hdd/dataset/tacos/videos/ --output ./output.json --model ./resnext-101-64f-kinetics.pth --mode feature --model_depth 101 --model_name resnext --resnet_shortcut B
NOTE: --resnet_shortcut B
and --model_name resnext
.
@suxb201 Thank you! It works!
This is my opts def parse_opts(): parser = argparse.ArgumentParser() parser.add_argument('--input', default='input', type=str, help='Input file path') parser.add_argument('--video_root', default='F:/ucf-crime/Anomaly-Videos/Abuse', type=str, help='Root path of input videos') parser.add_argument('--model', default='models/resnet-34-kinetics-ucf101_split1.pth', type=str, help='Model file path') parser.add_argument('--output', default='output.json', type=str, help='Output file path') parser.add_argument('--mode', default='feature', type=str, help='Mode (score | feature). score outputs class scores. feature outputs features (after global average pooling).') parser.add_argument('--batch_size', default=8, type=int, help='Batch Size') parser.add_argument('--n_threads', default=1, type=int, help='Number of threads for multi-thread loading') parser.add_argument('--model_name', default='resnet', type=str, help='Currently only support resnet') parser.add_argument('--model_depth', default=34, type=int, help='Depth of resnet (10 | 18 | 34 | 50 | 101)') parser.add_argument('--resnet_shortcut', default='A', type=str, help= 'Shortcut type of resnet (A | B), and B is used on the models except for resnet-18 and -34' ) parser.add_argument('--wide_resnet_k', default=2, type=int, help='Wide resnet k') parser.add_argument('--resnext_cardinality', default=32, type=int, help='ResNeXt cardinality') parser.add_argument('--no_cuda', action='store_true', help='If true, cuda is not used.') parser.set_defaults(verbose=False) parser.add_argument('--verbose', action='store_true', help='') parser.set_defaults(verbose=False) parser.add_argument('--savepath', default=r'F:\C3D\video-classification-3d-cnn-pytorch\feature')
The following is the Error:
RuntimeError: Error(s) in loading state_dict for DataParallel: Missing key(s) in state_dict: "module.module.conv1.weight", "module.module.bn1.weight", "module.module.bn1.bias", "module.module.bn1.running_mean", "module.module.bn1.running_var", "module.module.layer1.0.conv1.weight", "module.module.layer1.0.bn1.weight", "module.module.layer1.0.bn1.bias", "module.module.layer1.0.bn1.running_mean", "module.module.layer1.0.bn1.running_var", "module.module.layer1.0.conv2.weight", "module.module.layer1.0.bn2.weight", "module.module.layer1.0.bn2.bias", "module.module.layer1.0.bn2.running_mean", "module.module.layer1.0.bn2.running_var", "module.module.layer1.1.conv1.weight", "module.module.layer1.1.bn1.weight", "module.module.layer1.1.bn1.bias", "module.module.layer1.1.bn1.running_mean", "module.module.layer1.1.bn1.running_var", "module.module.layer1.1.conv2.weight", "module.module.layer1.1.bn2.weight", "module.module.layer1.1.bn2.bias", "module.module.layer1.1.bn2.running_mean", "module.module.layer1.1.bn2.running_var", "module.module.layer1.2.conv1.weight", "module.module.layer1.2.bn1.weight", "module.module.layer1.2.bn1.bias", "module.module.layer1.2.bn1.running_mean", "module.module.layer1.2.bn1.running_var", "module.module.layer1.2.conv2.weight", "module.module.layer1.2.bn2.weight", "module.module.layer1.2.bn2.bias", "module.module.layer1.2.bn2.running_mean", "module.module.layer1.2.bn2.running_var", "module.module.layer2.0.conv1.weight", "module.module.layer2.0.bn1.weight", "module.module.layer2.0.bn1.bias", "module.module.layer2.0.bn1.running_mean", "module.module.layer2.0.bn1.running_var", "module.module.layer2.0.conv2.weight", "module.module.layer2.0.bn2.weight", "module.module.layer2.0.bn2.bias", "module.module.layer2.0.bn2.running_mean", "module.module.layer2.0.bn2.running_var", "module.module.layer2.1.conv1.weight", "module.module.layer2.1.bn1.weight", "module.module.layer2.1.bn1.bias", "module.module.layer2.1.bn1.running_mean", "module.module.layer2.1.bn1.running_var", "module.module.layer2.1.conv2.weight", "module.module.layer2.1.bn2.weight", "module.module.layer2.1.bn2.bias", "module.module.layer2.1.bn2.running_mean", "module.module.layer2.1.bn2.running_var", "module.module.layer2.2.conv1.weight", "module.module.layer2.2.bn1.weight", "module.module.layer2.2.bn1.bias", "module.module.layer2.2.bn1.running_mean", "module.module.layer2.2.bn1.running_var", "module.module.layer2.2.conv2.weight", "module.module.layer2.2.bn2.weight", "module.module.layer2.2.bn2.bias", "module.module.layer2.2.bn2.running_mean", "module.module.layer2.2.bn2.running_var", "module.module.layer2.3.conv1.weight", "module.module.layer2.3.bn1.weight", "module.module.layer2.3.bn1.bias", "module.module.layer2.3.bn1.running_mean", "module.module.layer2.3.bn1.running_var", "module.module.layer2.3.conv2.weight", "module.module.layer2.3.bn2.weight", "module.module.layer2.3.bn2.bias", "module.module.layer2.3.bn2.running_mean", "module.module.layer2.3.bn2.running_var", "module.module.layer3.0.conv1.weight", "module.module.layer3.0.bn1.weight", "module.module.layer3.0.bn1.bias", "module.module.layer3.0.bn1.running_mean", "module.module.layer3.0.bn1.running_var", "module.module.layer3.0.conv2.weight", "module.module.layer3.0.bn2.weight", "module.module.layer3.0.bn2.bias", "module.module.layer3.0.bn2.running_mean", "module.module.layer3.0.bn2.running_var", "module.module.layer3.1.conv1.weight", "module.module.layer3.1.bn1.weight", "module.module.layer3.1.bn1.bias", "module.module.layer3.1.bn1.running_mean", "module.module.layer3.1.bn1.running_var", "module.module.layer3.1.conv2.weight", "module.module.layer3.1.bn2.weight", "module.module.layer3.1.bn2.bias", "module.module.layer3.1.bn2.running_mean", "module.module.layer3.1.bn2.running_var", "module.module.layer3.2.conv1.weight", "module.module.layer3.2.bn1.weight", "module.module.layer3.2.bn1.bias", "module.module.layer3.2.bn1.running_mean", "module.module.layer3.2.bn1.running_var", "module.module.layer3.2.conv2.weight", "module.module.layer3.2.bn2.weight", "module.module.layer3.2.bn2.bias", "module.module.layer3.2.bn2.running_mean", "module.module.layer3.2.bn2.running_var", "module.module.layer3.3.conv1.weight", "module.module.layer3.3.bn1.weight", "module.module.layer3.3.bn1.bias", "module.module.layer3.3.bn1.running_mean", "module.module.layer3.3.bn1.running_var", "module.module.layer3.3.conv2.weight", "module.module.layer3.3.bn2.weight", "module.module.layer3.3.bn2.bias", "module.module.layer3.3.bn2.running_mean", "module.module.layer3.3.bn2.running_var", "module.module.layer3.4.conv1.weight", "module.module.layer3.4.bn1.weight", "module.module.layer3.4.bn1.bias", "module.module.layer3.4.bn1.running_mean", "module.module.layer3.4.bn1.running_var", "module.module.layer3.4.conv2.weight", "module.module.layer3.4.bn2.weight", "module.module.layer3.4.bn2.bias", "module.module.layer3.4.bn2.running_mean", "module.module.layer3.4.bn2.running_var", "module.module.layer3.5.conv1.weight", "module.module.layer3.5.bn1.weight", "module.module.layer3.5.bn1.bias", "module.module.layer3.5.bn1.running_mean", "module.module.layer3.5.bn1.running_var", "module.module.layer3.5.conv2.weight", "module.module.layer3.5.bn2.weight", "module.module.layer3.5.bn2.bias", "module.module.layer3.5.bn2.running_mean", "module.module.layer3.5.bn2.running_var", "module.module.layer4.0.conv1.weight", "module.module.layer4.0.bn1.weight", "module.module.layer4.0.bn1.bias", "module.module.layer4.0.bn1.running_mean", "module.module.layer4.0.bn1.running_var", "module.module.layer4.0.conv2.weight", "module.module.layer4.0.bn2.weight", "module.module.layer4.0.bn2.bias", "module.module.layer4.0.bn2.running_mean", "module.module.layer4.0.bn2.running_var", "module.module.layer4.1.conv1.weight", "module.module.layer4.1.bn1.weight", "module.module.layer4.1.bn1.bias", "module.module.layer4.1.bn1.running_mean", "module.module.layer4.1.bn1.running_var", "module.module.layer4.1.conv2.weight", "module.module.layer4.1.bn2.weight", "module.module.layer4.1.bn2.bias", "module.module.layer4.1.bn2.running_mean", "module.module.layer4.1.bn2.running_var", "module.module.layer4.2.conv1.weight", "module.module.layer4.2.bn1.weight", "module.module.layer4.2.bn1.bias", "module.module.layer4.2.bn1.running_mean", "module.module.layer4.2.bn1.running_var", "module.module.layer4.2.conv2.weight", "module.module.layer4.2.bn2.weight", "module.module.layer4.2.bn2.bias", "module.module.layer4.2.bn2.running_mean", "module.module.layer4.2.bn2.running_var", "module.module.fc.weight", "module.module.fc.bias". Unexpected key(s) in state_dict: "module.conv1.weight", "module.bn1.weight", "module.bn1.bias", "module.bn1.running_mean", "module.bn1.running_var", "module.layer1.0.conv1.weight", "module.layer1.0.bn1.weight", "module.layer1.0.bn1.bias", "module.layer1.0.bn1.running_mean", "module.layer1.0.bn1.running_var", "module.layer1.0.conv2.weight", "module.layer1.0.bn2.weight", "module.layer1.0.bn2.bias", "module.layer1.0.bn2.running_mean", "module.layer1.0.bn2.running_var", "module.layer1.1.conv1.weight", "module.layer1.1.bn1.weight", "module.layer1.1.bn1.bias", "module.layer1.1.bn1.running_mean", "module.layer1.1.bn1.running_var", "module.layer1.1.conv2.weight", "module.layer1.1.bn2.weight", "module.layer1.1.bn2.bias", "module.layer1.1.bn2.running_mean", "module.layer1.1.bn2.running_var", "module.layer1.2.conv1.weight", "module.layer1.2.bn1.weight", "module.layer1.2.bn1.bias", "module.layer1.2.bn1.running_mean", "module.layer1.2.bn1.running_var", "module.layer1.2.conv2.weight", "module.layer1.2.bn2.weight", "module.layer1.2.bn2.bias", "module.layer1.2.bn2.running_mean", "module.layer1.2.bn2.running_var", "module.layer2.0.conv1.weight", "module.layer2.0.bn1.weight", "module.layer2.0.bn1.bias", "module.layer2.0.bn1.running_mean", "module.layer2.0.bn1.running_var", "module.layer2.0.conv2.weight", "module.layer2.0.bn2.weight", "module.layer2.0.bn2.bias", "module.layer2.0.bn2.running_mean", "module.layer2.0.bn2.running_var", "module.layer2.1.conv1.weight", "module.layer2.1.bn1.weight", "module.layer2.1.bn1.bias", "module.layer2.1.bn1.running_mean", "module.layer2.1.bn1.running_var", "module.layer2.1.conv2.weight", "module.layer2.1.bn2.weight", "module.layer2.1.bn2.bias", "module.layer2.1.bn2.running_mean", "module.layer2.1.bn2.running_var", "module.layer2.2.conv1.weight", "module.layer2.2.bn1.weight", "module.layer2.2.bn1.bias", "module.layer2.2.bn1.running_mean", "module.layer2.2.bn1.running_var", "module.layer2.2.conv2.weight", "module.layer2.2.bn2.weight", "module.layer2.2.bn2.bias", "module.layer2.2.bn2.running_mean", "module.layer2.2.bn2.running_var", "module.layer2.3.conv1.weight", "module.layer2.3.bn1.weight", "module.layer2.3.bn1.bias", "module.layer2.3.bn1.running_mean", "module.layer2.3.bn1.running_var", "module.layer2.3.conv2.weight", "module.layer2.3.bn2.weight", "module.layer2.3.bn2.bias", "module.layer2.3.bn2.running_mean", "module.layer2.3.bn2.running_var", "module.layer3.0.conv1.weight", "module.layer3.0.bn1.weight", "module.layer3.0.bn1.bias", "module.layer3.0.bn1.running_mean", "module.layer3.0.bn1.running_var", "module.layer3.0.conv2.weight", "module.layer3.0.bn2.weight", "module.layer3.0.bn2.bias", "module.layer3.0.bn2.running_mean", "module.layer3.0.bn2.running_var", "module.layer3.1.conv1.weight", "module.layer3.1.bn1.weight", "module.layer3.1.bn1.bias", "module.layer3.1.bn1.running_mean", "module.layer3.1.bn1.running_var", "module.layer3.1.conv2.weight", "module.layer3.1.bn2.weight", "module.layer3.1.bn2.bias", "module.layer3.1.bn2.running_mean", "module.layer3.1.bn2.running_var", "module.layer3.2.conv1.weight", "module.layer3.2.bn1.weight", "module.layer3.2.bn1.bias", "module.layer3.2.bn1.running_mean", "module.layer3.2.bn1.running_var", "module.layer3.2.conv2.weight", "module.layer3.2.bn2.weight", "module.layer3.2.bn2.bias", "module.layer3.2.bn2.running_mean", "module.layer3.2.bn2.running_var", "module.layer3.3.conv1.weight", "module.layer3.3.bn1.weight", "module.layer3.3.bn1.bias", "module.layer3.3.bn1.running_mean", "module.layer3.3.bn1.running_var", "module.layer3.3.conv2.weight", "module.layer3.3.bn2.weight", "module.layer3.3.bn2.bias", "module.layer3.3.bn2.running_mean", "module.layer3.3.bn2.running_var", "module.layer3.4.conv1.weight", "module.layer3.4.bn1.weight", "module.layer3.4.bn1.bias", "module.layer3.4.bn1.running_mean", "module.layer3.4.bn1.running_var", "module.layer3.4.conv2.weight", "module.layer3.4.bn2.weight", "module.layer3.4.bn2.bias", "module.layer3.4.bn2.running_mean", "module.layer3.4.bn2.running_var", "module.layer3.5.conv1.weight", "module.layer3.5.bn1.weight", "module.layer3.5.bn1.bias", "module.layer3.5.bn1.running_mean", "module.layer3.5.bn1.running_var", "module.layer3.5.conv2.weight", "module.layer3.5.bn2.weight", "module.layer3.5.bn2.bias", "module.layer3.5.bn2.running_mean", "module.layer3.5.bn2.running_var", "module.layer4.0.conv1.weight", "module.layer4.0.bn1.weight", "module.layer4.0.bn1.bias", "module.layer4.0.bn1.running_mean", "module.layer4.0.bn1.running_var", "module.layer4.0.conv2.weight", "module.layer4.0.bn2.weight", "module.layer4.0.bn2.bias", "module.layer4.0.bn2.running_mean", "module.layer4.0.bn2.running_var", "module.layer4.1.conv1.weight", "module.layer4.1.bn1.weight", "module.layer4.1.bn1.bias", "module.layer4.1.bn1.running_mean", "module.layer4.1.bn1.running_var", "module.layer4.1.conv2.weight", "module.layer4.1.bn2.weight", "module.layer4.1.bn2.bias", "module.layer4.1.bn2.running_mean", "module.layer4.1.bn2.running_var", "module.layer4.2.conv1.weight", "module.layer4.2.bn1.weight", "module.layer4.2.bn1.bias", "module.layer4.2.bn1.running_mean", "module.layer4.2.bn1.running_var", "module.layer4.2.conv2.weight", "module.layer4.2.bn2.weight", "module.layer4.2.bn2.bias", "module.layer4.2.bn2.running_mean", "module.layer4.2.bn2.running_var", "module.fc.weight", "module.fc.bias".
In other words, is this pre-trained model resnet-34-kinetics-ucf101_split1.pth mismatch the model file?