Skip to content
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

How to map mask values to labels #1

Open
max-mapper opened this issue Jul 13, 2023 · 1 comment
Open

How to map mask values to labels #1

max-mapper opened this issue Jul 13, 2023 · 1 comment
Assignees

Comments

@max-mapper
Copy link

Hi, thank you for uploading this. I have successfully trained and exported the included model on our university cluster and have tested that it works in my Deepness plugin.

I am starting to create my own custom dataset and am using the following as my image and mask (actual resolution 4284x4218):

image

image

The colors in the mask are arbitrary single byte values I chose when generating the mask (1, 150, 200) as I have 3 classes (I think

mask = np.zeros((*label.shape[:2], 5), dtype=np.uint8)
for i in range(5):
assumes 5 classes so my class configuration in the yaml has two extra classes, ['background', 'shrub', 'forest', 'null1', 'null2'])

I trained and it ran for 148 epochs before finishing. I exported and tested out the model on the training area and got the following (overlaid on my training mask for display here):

image

image

It looks like it is assigning channel_0 to most of the image, and there is some assignment of channel_1, presumably my shrub layer. None of the forest layer (value 200) were assigned. I tried a larger extent as well, and only got assignments from the first 2 layers.

I can produce much more training data, but wanted to make sure I am using the software correctly first. When defining classes: ['background', 'building', 'woodland', 'water', 'road'], how do you know which pixel values in the raster these classes will be mapped to, is it based on byte order?

And do you think my lack of any forest assignments is based on my low amount or low quality of training data (e.g. my masks for the forest layer are too messy), or maybe it is something I am configuring incorrectly?

@bartoszptak
Copy link
Contributor

Hi,

I can produce much more training data, but wanted to make sure I am using the software correctly first. When defining classes: ['background', 'building', 'woodland', 'water', 'road'], how do you know which pixel values in the raster these classes will be mapped to, is it based on byte order?

It depends on the dataset and you should prepare your own data loader.

It looks like it is assigning channel_0 to most of the image, and there is some assignment of channel_1, presumably my shrub layer. None of the forest layer (value 200) were assigned. I tried a larger extent as well, and only got assignments from the first 2 layers.

It can come from wrong label mapping or model weak generalisation.

assumes 5 classes so my class configuration in the yaml has two extra classes, ['background', 'shrub', 'forest', 'null1', 'null2'])

I think you should modify the code to use only 3 classes instead 5 (with two nulls) because it is not effective.

Additionally, if you would to map labels in QGIS in the future, you can use this instruction to add them to ONNX model.

@bartoszptak bartoszptak self-assigned this Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants