yassouali / pytorch-segmentation

:art: Semantic segmentation models, datasets and losses implemented in PyTorch.
MIT License
1.64k stars 379 forks source link

How can I get test set evaluation (IoU) - urgent please #121

Closed ghassenetanabene closed 3 years ago

ghassenetanabene commented 3 years ago

Hello,

I'm still new in semantic segmentation. I would know how to evaluate my model on the test set, because I think that the evaluation results and tensorboard are used only for the file val.txt. so that I obtain only : train (IoU) & val (IoU).

1) Can someone help me please how can I have these 3 values :

train (IoU) | val (IoU) | test (IoU) ?

2) How can I split the data into train, val and test to perform the best IoU, since I used a custom dataset where I have imbalanced data (pixel (area) of segmentation classes are different and number of occurrences also) ?

Is there some tricks to choose the validation set or I select random images ?

yassouali commented 3 years ago

Hi @ghassenetanabene

Generally, to get the test results for some public benchmark, you need to submit your result to an evaluation server. For example for Pascal VOC, you'll need to use inference.py and save the test results as png files and then upload them to the server to get the results.

As for your custom dataset, in this case, you can evaluate on the test set just as you do with the val set since you have access to the labels. And to create them while having the same label distribution, for segmentation you can't just use say scikit learn train_test split with stratified sampling, maybe a simple way to do this is to try iterative random sampling, and then choose the split that best match the label distribution

ghassenetanabene commented 3 years ago

Thank you very much, I really appreciate your help