AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.65k stars 7.96k forks source link

How to implement focal loss in DARKNET #2594

Open libralx opened 5 years ago

libralx commented 5 years ago

I want to implement focal loss in DARKNET. How can I do that?

AlexeyAB commented 5 years ago

Focal loss already implemented for [yolo] layer. It will be used if you set focal_loss=1 in each [yolo] layer.

https://github.com/AlexeyAB/darknet/blob/7a854302efb7adba80d5e8a747ad5e5ec384a226/src/yolo_layer.c#L158-L177

libralx commented 5 years ago

what does it mean: in each [yolo] layer.

AlexeyAB commented 5 years ago

Find here 3 [yolo] layers: https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov3.cfg

libralx commented 5 years ago

the network show: unused field focal =1

AlexeyAB commented 5 years ago

Can you show screenshot?

libralx commented 5 years ago

@AlexeyAB thanks

below is mine cfg-file

[yolo] focal_loss=1 mask = 6,7,8 anchors = 14, 13, 69, 16, 43, 56, 151, 33, 74, 93, 110,141, 152,206, 220,276, 332,374 classes=4 num=9 jitter=.3 ignore_thresh = .7 truth_thresh = 1 random=1

is there right?