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

Some problem with labels. Please check. #21

Closed engineer1109 closed 6 years ago

engineer1109 commented 6 years ago

Labels can take value between 0 and number of classes. Some problem with labels. Please check. unique_values=[ 0 1 2 4 5 7 8 10 11 13 14 255]

Is it important?

sacmehta commented 6 years ago

Cityscapes data contains 0-18 classes + 1 more class to ignore with pixel value of 255. So, we have a total of 20 classes. To have class labels continuous, we mapped 255 to 19.

engineer1109 commented 6 years ago

@sacmehta Traceback (most recent call last): File "main.py", line 406, in trainValidateSegmentation(parser.parse_args()) File "main.py", line 332, in trainValidateSegmentation train(args, trainLoader_scale1, model, criteria, optimizer, epoch) File "main.py", line 102, in train loss.backward() File "/usr/local/lib/python3.6/dist-packages/torch/tensor.py", line 93, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph) File "/usr/local/lib/python3.6/dist-packages/torch/autograd/init.py", line 89, in backward allow_unreachable=True) # allow_unreachable flag RuntimeError: CUDNN_STATUS_INTERNAL_ERROR Torch v0.4.0 opencv 3.4 What causes it

sacmehta commented 6 years ago

Use PyTorch version 0.3.1

PyTorch version 0.4 onwards, does not support Variables. See PyTorch documentation for changes and make necessary changes to the code if you are using PyTorch 0.4 or above

engineer1109 commented 6 years ago

@sacmehta /pytorch/torch/lib/THCUNN/SpatialClassNLLCriterion.cu:99: void cunn_SpatialClassNLLCriterion_updateOutput_kernel(T , T , T , long , T *, int, int, int, int, int, long) [with T = float, AccumT = float]: block: [9,0,0], thread: [960,0,0] Assertion t >= 0 && t < n_classes failed. Traceback (most recent call last): File "main.py", line 406, in trainValidateSegmentation(parser.parse_args()) File "main.py", line 332, in trainValidateSegmentation train(args, trainLoader_scale1, model, criteria, optimizer, epoch) File "main.py", line 102, in train loss.backward() File "/usr/local/lib/python3.6/dist-packages/torch/autograd/variable.py", line 167, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph, retain_variables) File "/usr/local/lib/python3.6/dist-packages/torch/autograd/init.py", line 99, in backward variables, grad_variables, retain_graph) RuntimeError: CUDNN_STATUS_INTERNAL_ERROR

Still exists

sacmehta commented 6 years ago

Seems like you still have 255 as a label. Did you change that in Transforms file?

engineer1109 commented 6 years ago

@sacmehta Thank you for your helping. It works

monk42 commented 5 years ago

@engineer1109 Could you tell me the detail about how to pre-processing the labels? thanks

sonic311 commented 5 years ago

@engineer1109 Hi. did you solve your problem well?

i encountered the same problem

i did already change the code

if 255 in unique_values: label_img[label_img == 255] = 19 unique_values = np.unique(label_img) like this in loadData.py

but it's not worked..

@sacmehta told me that i should change the Transforms.py's code too. but i dont know how to i change the code. plz let me know how to i change the code of Transforms.py