Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem in training #5

Closed
meroluo opened this issue Feb 27, 2019 · 6 comments
Closed

problem in training #5

meroluo opened this issue Feb 27, 2019 · 6 comments

Comments

@meroluo
Copy link

meroluo commented Feb 27, 2019

Thank you for you wonderful work! I want to train a model on my own dataset, but I meet a problem in the beginning of training, the error is described as below:

===> Setting GPU
=> loading model 'model_0.0001_epoch_60.pth'
/home/weihq/anaconda3/lib/python3.6/site-packages/torch/serialization.py:368: SourceChangeWarning: source code of class 'torch.nn.parallel.data_parallel.DataParallel' has changed. you can retrieve the original source code by accessing the object's source attribute or set torch.nn.Module.dump_patches = True and use the patch tool to revert the changes.
warnings.warn(msg, SourceChangeWarning)
Traceback (most recent call last):
File "train.py", line 89, in
weights = torch.load(opt.pretrained)
File "/home/weihq/anaconda3/lib/python3.6/site-packages/torch/serialization.py", line 304, in load
return _load(f, map_location, pickle_module)
File "/home/weihq/anaconda3/lib/python3.6/site-packages/torch/serialization.py", line 470, in _load
result = unpickler.load()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 918: ordinal not in range(128)

It seems that this error is caused by the encode-decode, but I can't find a effective solution in the webside. hoping you can give me some suggestions. I am Sincerely grateful to your reading.

@wxywhu
Copy link
Owner

wxywhu commented Feb 27, 2019

It seems that the model saved by PYTHON2 is incompatible with PYTHON3. If you want to the pre-trained model, maybe you could change your version of PYTHON. @meroluo

@meroluo
Copy link
Author

meroluo commented Mar 1, 2019

Thank you!! I will try python2 later。

@meroluo
Copy link
Author

meroluo commented Mar 8, 2019

Sorry to bother you again! I have change the version of python to python27,but there seems to have problems with the dataset. I check the generation of my own dataset, but can't find the cause, here are the error description:
(py2) luomeilu@Ubuntu:~/superresolution/SRDenseNet-pytorch-master/SRDenseNet-pytorch-master$ python train.py
Namespace(batchSize=64, cuda=False, lr=0.0001, nEpochs=300, pretrained='model_0.0001_epoch_60.pth', resume='', start_epoch=1, step=30, testbatchSize=64, threads=1)
('Random Seed: ', 3018)
===> Loading datasets
Traceback (most recent call last):
File "train.py", line 55, in
training_data_loader = DataLoader(dataset=train_set, num_workers=opt.threads, batch_size=opt.batchSize, shuffle=True)
File "/home/luomeilu/anaconda3/envs/py2/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 802, in init
sampler = RandomSampler(dataset)
File "/home/luomeilu/anaconda3/envs/py2/lib/python2.7/site-packages/torch/utils/data/sampler.py", line 60, in init
self.num_samples = len(self.data_source)
File "/home/luomeilu/superresolution/SRDenseNet-pytorch-master/SRDenseNet-pytorch-master/dataset.py", line 22, in len
return self.data.shape[0]
AttributeError: 'NoneType' object has no attribute 'shape'

I make my own dataset through generate_train.m, can you give me some suggestions?

@wxywhu
Copy link
Owner

wxywhu commented Mar 14, 2019

@meroluo How did you process your dataset? Which format did your data save?

@meroluo
Copy link
Author

meroluo commented Mar 14, 2019

@meroluo How did you process your dataset? Which format did your data save?

I down sample HR images with bicubic operation and save images as '.png' format.

@wxywhu
Copy link
Owner

wxywhu commented Mar 16, 2019

@meroluo There might be something wrong with your method that you used to read the image, such as PIL or opencv.

@wxywhu wxywhu closed this as completed Apr 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants