ScanSSD icon indicating copy to clipboard operation
ScanSSD copied to clipboard

quick test for load pretrainmodel and mismatch model

Open macqueen09 opened this issue 4 years ago • 3 comments

I want to see this model inference. so I use

python test.py \
    --dataset_root ../  \
    --trained_model scanssd/weights/AMATH512_e1GTDB.pth   \
    --test_data testing_data   \
    --model_type 512  \
    --cfg math_gtdb_512  \

AMATH512_e1GTDB.pth is download by your link. and I get mismatch when load model

8440 - 10-Aug-20 17:19:45 - Exception occurred
Traceback (most recent call last):
  File "test.py", line 194, in <module>
    test_gtdb(args)
  File "test.py", line 111, in test_gtdb
    net.load_state_dict(torch.load(args.trained_model, map_location={'cuda:1':'cuda:0'}))
  File "/mnt/data/anaconda3/envs/alphapose/lib/python3.6/site-packages/torch/nn/modules/module.py", line 777, in load_state_dict
    self.__class__.__name__, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for DataParallel:
	size mismatch for module.loc.0.weight: copying a param with shape torch.Size([28, 512, 1, 5]) from checkpoint, the shape in current model is torch.Size([48, 512, 1, 1]).
	size mismatch for module.loc.0.bias: copying a param with shape torch.Size([28]) from checkpoint, the shape in current model is torch.Size([48]).
	size mismatch for module.loc.1.weight: copying a param with shape torch.Size([28, 1024, 1, 5]) from checkpoint, the shape in current model is torch.Size([48, 1024, 1, 1]).
	size mismatch for module.loc.1.bias: copying a param with shape torch.Size([28]) from checkpoint, the shape in current model is torch.Size([48]).
	size mismatch for module.loc.2.weight: copying a param with shape torch.Size([28, 512, 1, 5]) from checkpoint, the shape in current model is torch.Size([48, 512, 1, 1]).
	size mismatch for module.loc.2.bias: copying a param with shape torch.Size([28]) from checkpoint, the shape in current model is torch.Size([48]).
...
many mismatch.....
...
8440 - 10-Aug-20 17:19:45 - Toal time taken 0:00:02.656999
8440 - 10-Aug-20 17:19:45 - Testing done!

what can i do for watch a demo by this model. Thank you very much.

macqueen09 avatar Aug 10 '20 09:08 macqueen09

--cfg math_gtdb_512 is this config match this model?

macqueen09 avatar Aug 10 '20 09:08 macqueen09

sorry when I use hboxes512 , its match. I got

No such file or directory: '/mnt/TFD-ICDAR2019v2/validation_data'

its something I ignore to get validation_data file (as well as train_data test_data ) ?

macqueen09 avatar Aug 10 '20 10:08 macqueen09

and your dir_struct has such structure: ├── ssd │ ├── base_weights │ │ └── vgg16_reducedfc.pth │ ├── data │ │ ├── config.py │ │ ├── gtdb_new.py │ │ ├── init.py │ │ └── pycache │ ├── eval │ ├── gtdb │ │ ├── adjust_

But I hasnot a ssd folder . How can I get a same structure as dir_struct as yours by this code? thanks very much.

macqueen09 avatar Aug 10 '20 10:08 macqueen09