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 can I perform data training on a custom binary segmentation dataset? #1056

Open
MrLangZe opened this issue Feb 7, 2025 · 3 comments
Open

Comments

@MrLangZe
Copy link

MrLangZe commented Feb 7, 2025

I tried to build my own dataset for training by following the code example at https://github.com/qubvel-org/segmentation_models.pytorch/blob/main/examples/cars%20segmentation%20(camvid).ipynb, but failed. How can I replace my own binary segmentation dataset in the code?

@qubvel
Copy link
Collaborator

qubvel commented Feb 7, 2025

Hey @MrLangZe, sorry to hear you get some issues. You just need to build your own dataset class which will return image and binary mask, the rest should be the same.
The mask should contain 0 and 1 values and to be of shape (batch_size, 1, height, width) - with the same height and width as image.

@MrLangZe
Copy link
Author

MrLangZe commented Feb 7, 2025

Thank you, I have another question, can I use smp.metrics.accuracy() to get the MPA (Mean Pixel Average) indicator results? I tried to set a class_weights list, but the result was not as expected.

@MrLangZe
Copy link
Author

MrLangZe commented Feb 7, 2025

Thank you, I have another question, can I use smp.metrics.accuracy() to get the MPA (Mean Pixel Average) indicator results? I tried to set a class_weights list, but the result was not as expected.

Hello, it seems that in this code segment, I tried to implement the metric MPA using the following formula: MPA = 1/classes *sum (TP / (TP + FN + TN + FP)), but I encountered difficulties due to my unfamiliarity with the interface. I wonder if you could give me some advice, thanks.

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