Repository navigation
Closed
Description
Feature-request: State-of-art Yolo v4 Detector
- paper: https://arxiv.org/abs/2004.10934
- source code: https://github.com/AlexeyAB/darknet
- cfg-file Yolov4: https://github.com/AlexeyAB/darknet/blob/master/cfg/yolov4.cfg
- weights-file Yolov4: https://drive.google.com/open?id=1cewMfusmPjYWbrnuJRuKhPMwRe_b9PaT
Many other features from Darknet were added previously.
But should be added at least new two features:
- Mish-activation:
float softplus(float x, float threshold = 20) {
if (x > threshold) return x; // too large
else if (x < -threshold) return expf(x); // too small
return logf(expf(x) + 1);
}
float mish_activation(float input) {
const float MISH_THRESHOLD = 20;
output = input * tanh( softplus(input, MISH_THRESHOLD) );
return output;
}- Eliminate grid sensitivity - by using
scale_x_y=parameter from[yolo]layer in cfg-file (by default usescale_x_y=1.0if the value is not set in cfg file)
we should use:
const float x_tmp = logistic_activate(srcData[box_index + 0]) * scale_x_y - (scale_x_y - 1) / 2;
const float y_tmp = logistic_activate(srcData[box_index + 1]) * scale_x_y - (scale_x_y - 1) / 2;
dstData[box_index + 0] = (x + x_tmp)) / cols;
dstData[box_index + 1] = (y + y_tmp)) / rows;instead of
opencv/modules/dnn/src/layers/region_layer.cpp
Lines 305 to 306 in 51a42c0
| dstData[box_index + 0] = (x + logistic_activate(srcData[box_index + 0])) / cols; | |
| dstData[box_index + 1] = (y + logistic_activate(srcData[box_index + 1])) / rows; |
Comparison of detectors on Microsoft COCO dataset and Tesla V100 GPU:
Reacted by Yashas Samaga B L, tompollok, Dmitry Kurtaev, Simón Sepúlveda Osses, hiroyuki.obinata, Muhammad Mohiuddin, Liubov Talamanova , RAJKIRAN NATARAJAN, aabajwa, dont32 and 18 more
Reacted by Yashas Samaga B L, dont32, Rohit Lal, pablob2292, Wooseok Choi, Yukihiro Saito, Luxonis-Brandon and Aleksei Kharitonov
Reacted by pablob2292, Aleksei Kharitonov, Wooseok Choi, Luxonis-Brandon, Luxonis-Brian and Matheus Oliveira Franca


Activity
dkurt commentedon Apr 27, 2020
This issue goes to @l-bat 😎
l-bat commentedon Apr 30, 2020
Hi! PR #17185 with Yolo v4 support has been merged to 3.4 branch
diecalsa-EDEM commentedon May 2, 2020
l-bat commentedon May 2, 2020
dkurt commentedon May 2, 2020
Let me lock this thread. Too much questions.
snehitvaddi commentedon Dec 1, 2020
@diecalsa-EDEM Where you able to use YoloV4 in OpenCV??
@l-bat From which versions of OpenCV, is YoloV4 is supported??
wooseokyourself commentedon Dec 1, 2020
My opencv is 4.4 and yolov4 works well. You might have to use version 3.4.12<= or 4.4.0<=
diecalsa commentedon Dec 1, 2020
Hi!
thanks for your answers. With the latest releases it forks fine!
aidamanzano commentedon Jan 8, 2021
wooseokyourself commentedon Jan 8, 2021
Hey! It seems I gave the confusing answer above.
Not sure, but yolov4 seems to support from 3.4.9 and from 4.4.0. I checked that the mish layer was supported from 3.4.9 (https://docs.opencv.org/3.4.9/d4/da1/classcv_1_1dnn_1_1MishLayer.html) and 4.4.0.
However, it seems that 3.4.12 has the same scope of support as 4.4.0, (https://github.com/opencv/opencv/wiki/ChangeLog#version3412) so if your system requires opencv 3.x then I recommend to build 3.4.12 or later.
I will correct the answer I wrote above. Sorry if you have any confusion from that.
aidamanzano commentedon Jan 8, 2021