martinkersner / train-DeepLab

Train DeepLab for Semantic Image Segmentation
MIT License
172 stars 76 forks source link

Error while changing the number of classes #9

Open nattari opened 8 years ago

nattari commented 8 years ago

Hi,

I am trying to train on a different number of classes than mentioned in the example here. I have two classes, so it becomes 2+1(background)=3 classes. I changed the value of NUM_LABEL in run_pascal_strong.sh but it gives error saying "unexpected label 3". What could be the reason behind it? PS: I am following all the pre-processing steps as mentioned and they work fine.

Thanks.

aurooj commented 8 years ago

Hello,

I am also facing the same issue. I have 2 classes including background. And it keeps on giving me error "unexpected label 147". The label value keeps on changing. I have checked everything I could, and don't see any issue in my prototxt file. But I dont know how to solve this issue. Any hints?

albertoQD commented 8 years ago

Hello @aurooj and @nattari,

I had the same problem. Make sure that your label images have values <=NUM_LABEL. That is, if you are using 3 classes (considering background), you label image should have values from 0 (for background) to 3.

Hope this helps,

Cheers.

aurooj commented 8 years ago

Hi Alberto,

Thanks for your reply. Yes, I checked my dataset, all it has is 0's and 1's when num_output = 2. I tried printing the gt_label in interp_layer.cpp and it shows that it takes 1 as an input but after this layer, my labels change to value 38, which is weird and then it is obvious that seg_accuracy_layer.cpp throws an error of unexpected_label..

nattari commented 7 years ago

@albertoQD thanks for your reply. i don't think that could be a problem because in deeplab we could choose a sub-set of classes and they may not be contiguous and start from 0. Believe it's something else.

zhangrui0828 commented 7 years ago

Hi @nattari @aurooj @albertoQD ,I have the same problem about "Unexpected label ***", and the number after “Unpexted label” is always different at every time.

When I run run_pascal_strong.sh(NUM_LABELS=21 or NUM_LABELS=4), softmax_loss_layer.cpp shorws an error of unexpected label. …... I0612 15:44:39.689864 12910 net.cpp:208] This network produces output accuracy I0612 15:44:39.689891 12910 net.cpp:467] Collecting Learning Rate and Weight Decay. I0612 15:44:39.689899 12910 net.cpp:219] Network initialization done. I0612 15:44:39.689903 12910 net.cpp:220] Memory required for data: 3663953152 I0612 15:44:39.689975 12910 solver.cpp:41] Solver scaffolding done. I0612 15:44:39.689981 12910 solver.cpp:160] Solving DeepLab-LargeFOV I0612 15:44:39.689985 12910 solver.cpp:161] Learning Rate Policy: step F0612 15:44:41.198884 12910 softmax_loss_layer.cpp:86] Unexpected label 19 Check failure stack trace: *** @ 0x7efefd561daa (unknown) @ 0x7efefd561ce4 (unknown) @ 0x7efefd5616e6 (unknown) @ 0x7efefd564687 (unknown) @ 0x5482a8 caffe::SoftmaxWithLossLayer<>::Forward_cpu() @ 0x47413a caffe::Net<>::ForwardFromTo() @ 0x4743cf caffe::Net<>::ForwardPrefilled() @ 0x57a320 caffe::Solver<>::Solve() @ 0x419be8 train() @ 0x412278 main @ 0x7efefa399f45 (unknown) @ 0x417927 (unknown) @ (nil) (unknown) Aborted

aurooj commented 7 years ago

I have answered this question here: https://stackoverflow.com/questions/40370852/unexpected-labal-38-deeplab-error/44530258#44530258

On Jun 12, 2017 11:04 PM, "zhangrui0828" notifications@github.com wrote:

Hi @nattari https://github.com/nattari @aurooj https://github.com/aurooj @albertoQD https://github.com/albertoqd ,I have the same problem about "Unexpected label ***", and the number after “Unpexted label” is always different at every time. My configuration is as following: The DeepLab model : DeepLab_LargeFOV. Dataset: original PASCAL VOC12. Init model is vgg16_20M. Solver: exper/voc12/config/DeepLab_LargeFOV/solver_train.prototxt train_net: exper/voc12/config/DeepLab_LargeFOV/train_train.prototxt source: exper/voc12/list/train.txt

When I run run_pascal_strong.sh, an error always occur and I can't further proceed. The error is shown below. …... I0612 15:44:39.689864 12910 net.cpp:208] This network produces output accuracy I0612 15:44:39.689891 12910 net.cpp:467] Collecting Learning Rate and Weight Decay. I0612 15:44:39.689899 12910 net.cpp:219] Network initialization done. I0612 15:44:39.689903 12910 net.cpp:220] Memory required for data: 3663953152 I0612 15:44:39.689975 12910 solver.cpp:41] Solver scaffolding done. I0612 15:44:39.689981 12910 solver.cpp:160] Solving DeepLab-LargeFOV I0612 15:44:39.689985 12910 solver.cpp:161] Learning Rate Policy: step F0612 15:44:41.198884 12910 softmax_loss_layer.cpp:86] Unexpected label 19 Check failure stack trace: @ 0x7efefd561daa (unknown) @ 0x7efefd561ce4 (unknown) @ 0x7efefd5616e6 (unknown) @ 0x7efefd564687 (unknown) @ 0x5482a8 caffe::SoftmaxWithLossLayer<>::Forward_cpu() @ 0x47413a caffe::Net<>::ForwardFromTo() @ 0x4743cf caffe::Net<>::ForwardPrefilled() @ 0x57a320 caffe::Solver<>::Solve() @ 0x419be8 train() @ 0x412278 main @ 0x7efefa399f45 (unknown) @ 0x417927 (unknown) @ (nil) (unknown) Aborted

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/martinkersner/train-DeepLab/issues/9#issuecomment-307993326, or mute the thread https://github.com/notifications/unsubscribe-auth/AOK4XWAaLasoHRnfWJjUb8dgjqY3LvCCks5sDfxagaJpZM4J9kW_ .

zhangrui0828 commented 7 years ago

@aurooj Thank you for answering my question. The differents between them are as following:(1) I didn't change the number of classes and used the original PASCAL VOC2012,(2)the error comes from softmax_loss_layer.cpp, not seg_accuracy_layer.cpp,(3) when I run the run_pascal_strong.sh, the value of unexpected label will change at every time. Thus, where should I change? Any help will be highly appreciated. Thanks!

aurooj commented 7 years ago

@zhangrui0828 Sorry for being late in replying. So, are you sure your data has labels all from 0 to 20?

Twsit commented 7 years ago

@zhangrui0828 Have you transformed the annotations by removing the colormap?