caffe实现focal loss层的一些理解和对实现一个layer层易犯错的地方的总结

 

首先要在caffe.proto中的LayerParameter中增加一行optional FocalLossParameter focal_loss_param = 205;,然后再单独在caffe.proto中增加

message FocalLossParameter{    
    optional float gamma = 1 [default = 2];                       
    optional float alpha = 2 [default = 0.25]; 

}                                        

 

实际上可以这样理解,FocalLossParameter就是一个layer下的子类,focal_loss_param相当于这个类的一个实例,message FocalLossParameter就相当于这个类的类定义

只要在hpp中引用#include "caffe/proto/caffe.pb.h",就可以在cpp调用这个类

 

posted @ 2018-07-30 16:19  有梦就要去实现他  阅读(1057)  评论(0编辑  收藏  举报