Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

differences between original repo and this fork #705

Open
lyzband opened this issue Apr 26, 2018 · 4 comments
Open

differences between original repo and this fork #705

lyzband opened this issue Apr 26, 2018 · 4 comments

Comments

@lyzband
Copy link

lyzband commented Apr 26, 2018

I have trained and detected with my own data set using original repo(pjreddie darknet) and this fork one after another under exactly same condition but they showed different results.
sometimes this fork double-detects the objects as you can see from the following image, while it never happens with original repo.
clouds-fashion-free-103123

I followed the comment (#232) to make the results identical but still not perfectly matching, the double-detecting problem got relatively solved though.
And then I figured that the code not only here but also there:

are different.
What does this difference mean?
Will I get the identical result if I change this line?
or are there any other lines that are different from each other?
Looking forward to hearing from you

@AlexeyAB
Copy link
Owner

AlexeyAB commented Apr 26, 2018

Hi,

original repo
https://github.com/pjreddie/darknet/blob/80d9bec20f0a44ab07616215c6eadb2d633492fe/examples/detector.c#L64-L65

You refer to the old commit (8 Nov 2017) from original repo where was nms = 0.3 https://github.com/pjreddie/darknet/blob/80d9bec20f0a44ab07616215c6eadb2d633492fe/examples/detector.c#L579


Try to use the same nms = 0.45 in both repo.


Also try to use the same weights & cfg files on this repo and original repo.

@lyzband
Copy link
Author

lyzband commented Apr 27, 2018

oh, I refered to wrong commit by mistake, however, I used both repos with same nms( = .45) while testing and i also have tried to use the same weights and cfgs but still got the different results.
that's why i have changed the code in detection part of this repo(#232 ), to keep same ratio while resizing, but the results from each repo were still different(even with same nms, weight, and cfg).

and then I found the different lines from 2 repos, as i mentioned earlier:

Anyway, to be more clearer, my goal is to get the exactly identical results from original repo and this repo using same weight and cfg.
Any other lines in this repo that I have to change for that?

@AlexeyAB
Copy link
Owner

and then I found the different lines from 2 repos, as i mentioned earlier:

https://github.com/pjreddie/darknet/blob/master/examples/detector.c#L65-L66
https://github.com/AlexeyAB/darknet/blob/master/src/detector.c#L119-L120

Yes, it affects only on training. But if you use the same cfg/weights for detection, it should not affect.


  1. Check that you use letterbox_image:

    darknet/src/detector.c

    Lines 1072 to 1073 in 5e3dcb6

    //image sized = resize_image(im, net.w, net.h);
    image sized = letterbox_image(im, net.w, net.h); letterbox = 1;

  1. Also there was fixed [reorg] layer: fixed usage of [reorg]-layer What's the different between Darknet here and the official one? #529 (comment)

It was done because: (1) pjreddie#344 and (2) opencv/opencv#9705 (comment)

  • Or (for this repository) use [reorg_old] instead of [reorg] in your yolo-voc.cfg or yolo.cfg
  • Or undo these changes: fe44d3d

  1. Also there is fused Conv-layer and batch-norm layer to speedup detection about 7%.
    Just comment this line:
    fuse_conv_batchnorm(net);

@lyzband
Copy link
Author

lyzband commented May 2, 2018

  1. Check that you use letterbox_image:
    darknet/src/detector.c
    Lines 1072 to 1073 in 5e3dcb6
    //image sized = resize_image(im, net.w, net.h);
    image sized = letterbox_image(im, net.w, net.h); letterbox = 1;

Yeap I have done it already.

  1. Also there was fixed [reorg] layer: fixed usage of [reorg]-layer What's the different between Darknet here and the official one? #529 (comment)
    It was done because: (1) reorg_cpu seems unusual pjreddie/darknet#344 and (2) Added DNN Darknet Yolo v2 for object detection opencv/opencv#9705 (comment)
    -Or (for this repository) use [reorg_old] instead of [reorg] in your yolo-voc.cfg or yolo.cfg
    -Or undo these changes: fe44d3d

I am using my own weights which were trained from yolov3 via original repo.
And it seems like yolov3.cfg does not contain [reorg] layer anymore.

  1. Also there is fused Conv-layer and batch-norm layer to speedup detection about 7%.
    Just comment this line:
    darknet/src/detector.c
    Line 1051 in 5e3dcb6
    fuse_conv_batchnorm(net);

this change is for speed up so it does not affect the detection result.

In conclusion, the only option that I could apply is to change 'resize_image' into 'letterbox_image' but that is what I have already done to my code. Any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants