Multilabel Image Classification Using Deep Learning--Imbalanced Data
16 次查看(过去 30 天)
显示 更早的评论
When I use imbalanced multilabel data to study the example ''openExample('nnet/MultilabelImageClassificationUsingDeepLearningExample') '' ,I found that the loss funtion(CustomBinaryCrossEntropyLossLayer.m, crossentropy) could not be weightd. So I want to use classificationlayer to replace, but classificationlayer could not used in multilabel data.
The crossentropy fuction in supporting file doesn't have Multi-label classificaion with weighted classes.The label is onehotlabel and we use sigmoid instead of softmax.So ,how can I create the outputlayer to achieve Multi-label classificaion with weighted classes?
3 个评论
Tarily
2023-6-13
Did you solve this problem? I have the same issue now and I hope to get your help.😭
采纳的回答
Varun Sai Alaparthi
2023-1-12
Hello XT,
There is no direct example or functionality as of MATLAB R2022b to directly do weighted multilabel classification.
But as a workaround you can try building the custom weighted cross entropy layer. Please refer the following link to get more information on this
Or you can try building custom classification layer with Tversky loss which is especially built to handle unbalanced data . You can check the following link for more information on this
Alternatively, there are some ways which can be used to balance the dataset before fitting to the classifier to get the better result. These methods are as follows:
- Under Sampling- Removing the unwanted or repeated data from the majority class and keep only a part of these useful points. In this way, there can be some balance in the data.
- Over Sampling- Try to get more data points for the minority class. Or try to replicate some of the data points of the minority class in order to increase cardinality.
- Generate Data- You can decide to generate synthetic data for the minority class for balancing the data. This can be done using SMOTE method. Below is the link to use SMOTE method-https://www.mathworks.com/matlabcentral/fileexchange/38830-smote-synthetic-minority-over-sampling-technique
Refer to this link for more information on oversampling:
I hope this information helps and please reach out for any further issues.
Sincerely
Varun
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!