Skip to content

Feature-request: State-of-art Yolo v4 Detector #17148

Closed

Description

@AlexeyAB

Feature-request: State-of-art Yolo v4 Detector

Many other features from Darknet were added previously.
But should be added at least new two features:

  1. 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;
}

  1. Eliminate grid sensitivity - by using scale_x_y= parameter from [yolo] layer in cfg-file (by default use scale_x_y=1.0 if 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

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:

comparison


modern_gpus

Activity

  1. dkurt commented on Apr 27, 2020

    @dkurt
    Member

    This issue goes to @l-bat 😎

  2. linked a pull request that will close this issueSupport Yolov4 #17185on Apr 29, 2020
  3. l-bat commented on Apr 30, 2020

    @l-bat
    Contributor

    Hi! PR #17185 with Yolo v4 support has been merged to 3.4 branch

  4. diecalsa-EDEM commented on May 2, 2020

    @diecalsa-EDEM
  5. l-bat commented on May 2, 2020

    @l-bat
  6. dkurt commented on May 2, 2020

    @dkurt
    Member

    Let me lock this thread. Too much questions.

  7. locked as too heated and limited conversation to collaborators on May 2, 2020
  8. snehitvaddi commented on Dec 1, 2020

    @snehitvaddi

    Hi,

    I am trying to use my trained yolov4 net with opencv:
    net = cv2.dnn.readNetFromDarknet("./models/yolov4_hand.cfg","./models/yolov4_hand.weights")

    but I am getting this error:
    Unsupported activation: mish in function 'ReadDarknetFromCfgStream'.

    Has opencv yolov4 support yet?

    @diecalsa-EDEM Where you able to use YoloV4 in OpenCV??

    • If yes, which version of OpenCV are you using.

    @l-bat From which versions of OpenCV, is YoloV4 is supported??

  9. wooseokyourself commented on Dec 1, 2020

    @wooseokyourself

    Hi,
    I am trying to use my trained yolov4 net with opencv:
    net = cv2.dnn.readNetFromDarknet("./models/yolov4_hand.cfg","./models/yolov4_hand.weights")
    but I am getting this error:
    Unsupported activation: mish in function 'ReadDarknetFromCfgStream'.
    Has opencv yolov4 support yet?

    @diecalsa-EDEM Where you able to use YoloV4 in OpenCV??

    • If yes, which version of OpenCV are you using.

    @l-bat From which versions of OpenCV, is YoloV4 is supported??

    My opencv is 4.4 and yolov4 works well. You might have to use version 3.4.12<= or 4.4.0<=

  10. diecalsa commented on Dec 1, 2020

    @diecalsa

    Hi,
    I am trying to use my trained yolov4 net with opencv:
    net = cv2.dnn.readNetFromDarknet("./models/yolov4_hand.cfg","./models/yolov4_hand.weights")
    but I am getting this error:
    Unsupported activation: mish in function 'ReadDarknetFromCfgStream'.
    Has opencv yolov4 support yet?

    @diecalsa-EDEM Where you able to use YoloV4 in OpenCV??

    • If yes, which version of OpenCV are you using.

    @l-bat From which versions of OpenCV, is YoloV4 is supported??

    My opencv is 4.4 and yolov4 works well. You might have to use version .4 or higher

    Hi!

    thanks for your answers. With the latest releases it forks fine!

  11. aidamanzano commented on Jan 8, 2021

    @aidamanzano
  12. wooseokyourself commented on Jan 8, 2021

    @wooseokyourself

    Hi, just to clarify, if I have Opencv 3.4.4 and I trained my model using YOLOv4, what do I need to if I am also getting this error:
    cv2.error: OpenCV(3.4.4) /home/aida/opencv/modules/dnn/src/darknet/darknet_io.cpp:552: error: (-212:Parsing error) Unsupported activation: mish in function 'ReadDarknetFromCfgStream'?
    Should I uninstall opencv 3.4 and install opencv 4 and recompile darknet?

    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.

  13. aidamanzano commented on Jan 8, 2021

    @aidamanzano
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions