sacmehta / ESPNet

ESPNet: Efficient Spatial Pyramid of Dilated Convolutions for Semantic Segmentation
https://sacmehta.github.io/ESPNet/
MIT License
541 stars 112 forks source link

How do I train the segmentation categories I need ? #76

Closed tensorflowt closed 4 years ago

tensorflowt commented 4 years ago

Hello!

Thank you very much for your open source project, which is very suitable for mobile terminal.

I recently trained my own segmentation category based on cityscapes datasets through your project. Currently, the segmentation category I care about is road, and I realized the model training by modifying the training sample label and adjusting the number of training parameter categories(--classes,default=1).

When I finished the model training and tested the segmentation effect of my model through your code, the following problems occurred:

Traceback (most recent call last): File "VisualizeResults.py", line 192, in <module> main(args) File "VisualizeResults.py", line 140, in main modelA.load_state_dict(torch.load(model_weight_file)) File "/home/dl/anaconda3/envs/pytorch_v1.0/lib/python3.6/site-packages/torch/nn/modules/module.py", line 769, in load_state_dict self.__class__.__name__, "\n\t".join(error_msgs))) RuntimeError: Error(s) in loading state_dict for ESPNet_Encoder: size mismatch for classifier.conv.weight: copying a param with shape torch.Size([20, 256, 1, 1]) from checkpoint, the shape in current model is torch.Size([1, 256, 1, 1]).

How else do I need to modify my code? I hope to get your help. Thank you.

sacmehta commented 4 years ago

See this issue: https://github.com/sacmehta/ESPNet/issues/14#issuecomment-406377511