darknet-nnpack icon indicating copy to clipboard operation
darknet-nnpack copied to clipboard

Not getting same precision as Original darknet

Open Favi0 opened this issue 6 years ago • 2 comments

Hi

i have trained my network in AlexeyAB repo, but for some reason im not getting same precision on inference when running with darknet nnpack.. is it because of the NNPACK optimization or what? should i train on the pjreddle darknet instead?

Favi0 avatar Feb 15 '19 06:02 Favi0

This should not be the case, even with most recent commit. However, I did notice that the networks within the /cfg/ subdir in pjreddie's repository have changed, so if the new cfg files use some feature that wasn't previously supported, then the code will have to be updated.

This is what I tested: ./darknet classifier predict cfg/imagenet1k.data cfg/darknet.cfg ~/darknet.weights data/dog.jpg darknet commit 16686cec576580489ab3c7c78183e6efeafae780 + fix: darknet commit 61c9d02ec461e30d55762ec7669d6a1d3c356fb2 + fix: data/dog.jpg: Predicted in 7.476584 seconds. 12.50%: miniature schnauzer 12.40%: malamute 9.10%: standard schnauzer 7.05%: briard 5.45%: muzzle darknet-nnpack (this repository): / Pi 3B+ @ 600MHz data/dog.jpg: Predicted in 2.974895 seconds. 23.06%: standard schnauzer 17.87%: briard 13.81%: muzzle 6.48%: keeshond 5.52%: Shih-Tzu data/dog.jpg: Predicted in 1.434073 seconds. 23.02%: standard schnauzer 17.84%: briard 13.78%: muzzle 6.47%: keeshond 5.51%: Shih-Tzu *** Error in `./darknet': corrupted size vs. prev_size: 0x01a87908 *** Something wrong here.

./darknet classifier predict cfg/imagenet1k.data old_cfg/darknet.cfg ~/darknet.weights data/dog.jpg darknet commit 16686cec576580489ab3c7c78183e6efeafae780 + fix: darknet commit 61c9d02ec461e30d55762ec7669d6a1d3c356fb2 + fix: data/dog.jpg: Predicted in 7.702507 seconds. 11.86%: miniature schnauzer 11.79%: standard schnauzer 11.41%: malamute 6.49%: briard 5.01%: muzzle darknet-nnpack (this repository): Pi 3B+ @ 900MHz data/dog.jpg: Predicted in 2.309745 seconds. 11.86%: miniature schnauzer 11.79%: standard schnauzer 11.41%: malamute 6.49%: briard 5.01%: muzzle data/dog.jpg: Predicted in 1.167057 seconds. 11.86%: miniature schnauzer 11.79%: standard schnauzer 11.41%: malamute 6.49%: briard 5.01%: muzzle

commit 16686cec576580489ab3c7c78183e6efeafae780 Author: Joseph Redmon [email protected] Date: Tue Nov 7 16:22:09 2017 -0800

SEE I TOTALLY LISTEN TO MY COMMUNITY SOMETIMES I'M LOOKING AT YOU ISSUE \#291

commit 61c9d02ec461e30d55762ec7669d6a1d3c356fb2 Author: Joseph Redmon [email protected] Date: Fri Sep 14 08:03:20 2018 -0700 guys one of my beehives died :-( :bee: :skull:

Fix diff: --- a/src/parser.c +++ b/src/parser.c @@ -2,6 +2,7 @@ #include <string.h> #include <stdlib.h> #include <assert.h> +#include <inttypes.h>

#include "activation_layer.h" #include "logistic_layer.h" @@ -1234,7 +1235,7 @@ void load_weights_upto(network *net, char filename, int start, int cutoff) fread(&minor, sizeof(int), 1, fp); fread(&revision, sizeof(int), 1, fp); if ((major10 + minor) >= 2 && major < 1000 && minor < 1000){

  •    fread(net->seen, sizeof(size_t), 1, fp);
    
  •    fread(net->seen, sizeof(uint64_t), 1, fp);
    
    } else { int iseen = 0; fread(&iseen, sizeof(int), 1, fp);

shizukachan avatar Feb 19 '19 04:02 shizukachan

It's noted that I forked off of https://github.com/digitalbrain79/darknet-nnpack so if the issue exists there, it will exist here as well.

After comparing pjreddie darknet latest and originating commits, probably issue lies in some NNPACKism as the origin darknet commit works even with newest CFG file.

shizukachan avatar Feb 19 '19 05:02 shizukachan