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
Train the model with custom dataset #27
Comments
Hi, I think the easiest way to understand the folder structure and the label types is to have a look at one of the commonly used datasets. Taking Ade20k as an example, I would recommend you to download its contents from this link. The remaining part for you would be to convert your dataset to a similar structure.
Hope it helps! |
Hi, @SushkoVadim thank you I have downloaded the Ade20k dataset and I saw the structure it is simple and straight forward.
Do I have to create train and val for every directory, or can I leave the way it is now.
So in this case I will have two folders similar to Ade20K. |
I am familiar with Pix2PixHD dataset structure. |
Hi, Both are possible. I think it depends on whether you plan to train one model for the whole dataset with all classes, or whether you want to have a separate model for each of your classes. Since there are no images having both "sheep" and "cow" classes, it makes sense to have separate models for different classes (but this is just an assumption, it totally depends on your experiment design).
For the masks, I would suggest a simple test:
In your test, you should see the elements 0 and 1 (e.g., not 255). Then, 0 would correspond to background, and 1 for the cow. Yes, our structure is a bit different from Pix2PixHD, because their repository is for image-to-image translation, while ours is for semantic image synthesis. The closer repository for us is the one of SPADE (https://github.com/NVlabs/SPADE). |
My bad I forgot to mention I want to train one model for the whole dataset. How the structure should look like? |
In your case, if you want to have a single model for all classes, you should organize the first option:
Don't forget to in all the masks background should be class 0, cow 1, sheep 2, so it has to be consistent across all the masks. Image-to-image translation translates images to images, e.g. zebras to horses. Semantic image synthesis is a special class of Image-to-image translation that uses masks as input, not images. Your dataset type is ok for both tasks. |
Thank you that was very helpful I think in my case I can name it as semantic image synthesis. I am using label mask as input. |
@Ghaleb-alnakhlani As you mentioned you want to train one model for the whole dataset, so the semantics labels should be consistent across the whole dataset not just for one image. For example, if you define background-0, cow-1, sheep-2. For the single image contains cow, the label is backgound-0, cow-1; and for the image contains sheep, the label should be backgound-0, sheep-2. Only labelling foreground is not enough, specific class label is needed here. |
Hi @SnowdenLee thank you. Can you please provide an example of how to prepare my data according to what you have mentioned if you know where this is implemented before? |
Hi,
I really don`t know what exactly I need to change in the model in order to run the training.
It will be very helpful if you can tell me how to prepare the dataset for the model.
I wonder how the semantic label should look like?
Let's say we have 3 classes (pedestrian, cow, sheep) and what the target and label folder looks like.
This is how I prepared the dataset (example)
Input (note mask can be in any color other than red, white for example)
Target
Your help is highly appreciated.
The text was updated successfully, but these errors were encountered: