liuyuisanai / focal-loss Goto Github PK
View Code? Open in Web Editor NEWReproduction of Focal-loss on caffe
Reproduction of Focal-loss on caffe
Hi,sciencefans:
thank you for sharing your code , and I want to know is the Focal Loss work well?? How much improve than before?
when calculate average loss,why not ignore the number of ignored label?(loss = loss/batch_size is not correct?)Thank you!
Rt
can you provide train_test.prototext and solver.prototext file?
Have you tested the focal loss on any dataset? Are there improvements with focal loss?
please, I got this error“error LNK2001: 无法解析的外部符号 "protected: virtual void __cdecl caffe::FocalLossLayer::Forward_gpu(class std::vector<class caffe::Blob *,class std::allocator<class caffe::Blob *> > const &,class std::vector<class caffe::Blob *,class std::allocator<class caffe::Blob *> > const &)" (?Forward_gpu@?$FocalLossLayer@N@caffe@@MEAAXAEBV?$vector@PEAV?$Blob@N@caffe@@v?$allocator@PEAV?$Blob@N@caffe@@@std@@@std@@0@Z) E:\DXD\caffefl\caffe\windows\caffe\focal_loss_layer.obj caffe
Hi
I find the focal_loss_layer.cpp is similar with sigmoid_cross_entropy_loss_layer.cpp.
The only difference is that you define the num = bottom[0]->num() , and the top[0]->mutable_cpu_data()[0] = loss / num ,instead of top[0]->mutable_cpu_data()[0] = loss/normalizer_ .
May I ask what's the meaning of the num,and where is the focal-loss?
Thanks
Hi,
to normalize loss, you divide the loss by the total count of anchors, but the paper suggest to divide only the positive anchors.
Why did you do that?
thanks
Any idea why would i be getting this error:
*** Aborted at 1504167002 (unix time) try "date -d @1504167002" if you are using GNU date ***
PC: @ 0x2b47a0e52cc9 (unknown)
*** SIGABRT (@0x18cf00003615) received by PID 13845 (TID 0x2b479e738280) from PID 13845; stack trace: ***
@ 0x2b47a0e52d40 (unknown)
@ 0x2b47a0e52cc9 (unknown)
@ 0x2b47a0e560d8 (unknown)
@ 0x2b47a0e8ff24 (unknown)
@ 0x2b47a0e9dac6 (unknown)
@ 0x2b47a0e9f340 (unknown)
@ 0x2b47a01afdad (unknown)
@ 0x2b479fc9f63e (unknown)
@ 0x2b479eae4504 caffe::LayerParameter::MergeFrom()
@ 0x2b479eb39fd0 caffe::InsertSplits()
@ 0x2b479ed1c97d caffe::Net<>::Init()
@ 0x2b479ed1ef15 caffe::Net<>::Net()
@ 0x2b479ecca1ba caffe::Solver<>::InitTrainNet()
@ 0x2b479eccb1cc caffe::Solver<>::Init()
@ 0x2b479eccb4fa caffe::Solver<>::Solver()
@ 0x2b479ecf26d3 caffe::Creator_SGDSolver<>()
@ 0x40fcf8 caffe::SolverRegistry<>::CreateSolver()
@ 0x408e34 train()
@ 0x4065ac main
@ 0x2b47a0e3dec5 (unknown)
@ 0x406eb3 (unknown)
@ 0x0 (unknown)
Thanks in advance
In training phase, we use SoftmaxWithLoss Layer and replace it with Softmax in testing. If I use FocalLoss in training, is it still replaced by Softmax?
I found unrecognized token in gpu file:
`oriloss[ i ] = - £¨input_data[ i ] * ( target[ i ] - ( input_data[ i ] >= 0 ) ) -
log(1 + exp(input_data[ i ] - 2 * input_data[ i ] *
( input_data[ i ] >= 0 )))£©;`
hi, @liuyuisanai
when i train the model for 2 classification, I have this error. So, I try to change the output num of fc layer from 2 to 1. It can work. But the acc is very low...just about 60%...I use the same focal loss layer as the README. Please help me. The following is the fc layer and focal loss layer:
layer {
name: "fc1"
type: "InnerProduct"
bottom: "view_blob1"
top: "fc_blob1"
inner_product_param {
num_output: 2
weight_filler {
type: "xavier"
}
bias_filler {
type: "constant"
}
}
}
layer {
name: "loss_focal"
type: "FocalLoss"
bottom: "fc_blob1"
bottom: "label"
top: "loss_focal"
loss_weight: 10
loss_param{
normalize: true
normalization: FULL
}
}
thank you very much.
According to the paper, the loss should multiply alpha for positive samples and (1-alpha) for negative samples, while the code uses alpha for both positive and negative samples.
I set alpha to 0.5 and gamma to 0.5, the loss will go to NAN. After changing gamma to 1, loss became normal. I didn't see any restriction of gamma in the paper. Is there difference between your code and the paper?
when i run this code,i got this error: Check failed: bottom[0]->count() == bottom[1]->count() (20 vs. 10) SIGMOID_CROSS_ENTROPY_LOSS layer inputs must have the same count.
how do i solve it?
Have you planed implementing an softmax-based version for multiclass case?
Tks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.