tkDNN icon indicating copy to clipboard operation
tkDNN copied to clipboard

Broken darknet export

Open alexkokh opened this issue 4 years ago • 7 comments

There's couple issues with exporting weights from darknet:

  • the darknet fork is broken, there are unmerged changes in convolution_kernels.cu
  • fopen mode in darknet.c is wrong (should be "wb") and results in larger files in Windows (I haven't tested the Linux version yet). Due to this the exported layer files are corrupt and can't be used.

My solution was to use the current darknet master branch, add the export code to it and change the fopen mode to "wb". Perhaps you may want to fix your darknet fork as well.

alexkokh avatar Sep 04 '21 22:09 alexkokh

git clone https://git.hipert.unimore.it/fgatti/darknet.git i think you should just use this repo for exporting only and make it without any changes , and it would for you pretty good

https://github.com/ceccocats/tkDNN/blob/master/docs/exporting_weights.md

MohamedElsaeidy avatar Sep 05 '21 14:09 MohamedElsaeidy

Have you checked the links in the original post? Those two problems are in the repo you’re referring to. You can’t even build that code the way it is now and the export is producing corrupt files.

alexkokh avatar Sep 05 '21 14:09 alexkokh

for producing larger files , yes it does . i made 2 folders layers , debug and it worked fine. using this command ./darknet export layers

for convultion_kernals i didn't get issue with it. what model u trying to export

MohamedElsaeidy avatar Sep 05 '21 14:09 MohamedElsaeidy

You don't seem to be understanding the problem. It's irrelevant what model is being exported. Binary files shouldn't be written in text mode. It may not make a difference in Linux, however it breaks Windows compatibility.

alexkokh avatar Sep 06 '21 03:09 alexkokh

I also encountered the first problem you mentioned, and then I can compile after modifying it. T )KW4UHDVTA`G~H96C ZJ But my darknet still cannot generate debug files in Windows.

B1ackg0d avatar Sep 06 '21 08:09 B1ackg0d

You don’t need the debug files for inference, as long as you have the correctly exported layer files you should be good. It’s easier to use the up to date darknet code instead of modifying individual files, except for the export code obviously.

alexkokh avatar Sep 06 '21 19:09 alexkokh

Hi @alexkokh, thank you for pointing out this errors. In response of the listed issues:

  • the unmerged changes are for sure an issue we need to fix it
  • about the binary mode, I use only Linux and since it has no difference I missed the "b" flag. If you have fixed the issue by adding the correct flag we can update the code. Or you can make a merge request.

As a quick workaround I suggest to compile darknet export repo in CPU only mode (as written in the readme ), since the unmerged change is inside a cudnn ifdef I haven't noticed that. Also the debug export is only supported in CPU mode. Since you don't need performance is pretty fine to run on CPU.

Best, Francesco

ceccocats avatar Sep 29 '21 03:09 ceccocats