voldemortX / DST-CBC

Implementation of our Pattern Recognition paper "DMT: Dynamic Mutual Training for Semi-Supervised Learning"
BSD 3-Clause "New" or "Revised" License
135 stars 17 forks source link

When I run segmentation code with my own dataset, it occurs the error... #6

Open grbcwq123 opened 3 years ago

grbcwq123 commented 3 years ago

Hello ! When I match my dataset to the cityscapes, it does not work in the model initialization phase. RuntimeError: Error(s) in loading state_dict for DeepLab: size mismatch for classifier.0.convs.0.weight: copying a param with shape torch.Size([19, 2048, 3, 3]) from checkpoint, the shape in current model is torch.Size([4, 2048, 3, 3]).

My dataset contains only 5% labeled images. The size is 2048*1024,which is the same as the cityscapes. Could you help me find the probelm?

Thank you very much!

voldemortX commented 3 years ago

@grbcwq123 Hi! Does your dataset has 4 classes? You should first convert the coco pre-trained weights with customized scripts, specifically, change the codes here to your number of classes.

I've also provided some instructions to train on customized dataset here, but I guess you've found them already.

grbcwq123 commented 3 years ago

Thank you for your response ! Yes, my dataset has 4 classes. But then it occurs this error.

error

What makes me confused is that there was no problem when I directly used the public cityscapes dataset. I've changed those configuration files. Maybe it is related to my cuda or torch version? Sorry for asking such simple questions, but I really try several times. Thank you very much!

voldemortX commented 3 years ago

@grbcwq123 It seems by the first line warning your apex is not correctly installed. I'd say maybe use a new virtual environment to reinstall the dependencies?The exact cuda and torch version may be crucial.

If that can't be done, you can try if you can run the code without mixed precision first.

grbcwq123 commented 3 years ago

Thank you very much !