semantic-segmentation-pytorch
semantic-segmentation-pytorch copied to clipboard
Customizing your dataset
I wrote a help page for anyone is planning to implement this repo in ones own project/data. Note that the page is still ongoing and not official, also it might contain some (dumb) issues. Any suggestion is welcome, you can comment in the page as well.
Hi, first, thanks for your efforts. While reading ur article, I met trouble to understand segm input. You wrote segm input format as [0,38,75], but I could not able to find it. Can you help me to find that out?? For info, my dataset has 7 classes including background.
Maybe I type the comment too quickly, the "input format" [0,38,75] actually is the unique pixel value of annotation file. You can find out the labelme annotation by the following (note that you have to covert the .json file to .png file before this)
from PIL import Image
import numpy as np
images = Image.open('path/annotation.jpg').convert('L')
images = np.array(images)
print(np.unique(images))
In your case, there should be 7 unique pixel values.
Thanks for ur comments! I will try it!
Maybe I type the comment too quickly, the "input format" [0,38,75] actually is the unique pixel value of annotation file. You can find out the labelme annotation by the following (note that you have to covert the
.jsonfile to.pngfile before this)from PIL import Image import numpy as np images = Image.open('path/annotation.jpg').convert('L') images = np.array(images) print(np.unique(images))In your case, there should be 7 unique pixel values.
I wrote a help page for anyone is planning to implement this repo in ones own project/data. Note that the page is still ongoing and not official, also it might contain some (dumb) issues. Any suggestion is welcome, you can comment in the page as well.
First Thanks for your help page, it's very useful. There is another problem. In my case, input has 3 classes including background, but only predict 2 classes after following your suggestions. The background is disappeared, how to deal with this. Thanks!
Hi @RicoSuaveGuapo, great resource and thanks for that. Just one observation from the json to png converter Is it beneficial to have a predefined dictionary mapping from label names to label values rather than creating one every time this function is called? Because when I ran this over my dataset (27 labels) what happened is that the label values for the same label name turned out to be different for different images. For example the label 'floor' was given a different value in two different examples.
Hi RicoSuaveGuapo, thanks & good work! Do we know for label to be better predicted how many images required?