weight balancing in pretraining networks.
3 次查看(过去 30 天)
显示 更早的评论
Dear Deep Learning Team,
Hello, i have a question about training process.
During i work on transfer learning (using pretrained model),
My data has not BALANCED, how to fixing or weight balancing "the gradient value" of mini-batch depends on ratio of my data?
for examples,
now, i have 3 class; A, B, and C // ratio of class is 5:5:1
i try to give weights to gradient
:: In "TrainNetwork" function > trainer.train > computeGradientsForTraning
:: in that function , i found "gradient" variable
> (end-1) cell has 2048x3 array
> (end / the last) cell has 3 value which maybe means average gradients
in that point, i want to give weight to gradient for 3rd class training,
most of "Ypred" predicted A or B, mooooooreeeeeeeee than C
What can i do in this situation?
Thanks for help
0 个评论
回答(1 个)
Maria Duarte Rosa
2019-4-5
Once can define a custom weighted classfication layer:
Please see here for an example using this layer:
1 个评论
Raza Ali
2019-10-16
is it applicable to images as well? becasue i am trying weighted classfication layer for images but its giving error.
can you specify how to use it for image data (what shold be the class weights for 100 images with the size 256 x 256 by 3)
另请参阅
类别
在 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!