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

Broken darknet export #262

Open
alexkokh opened this issue Sep 4, 2021 · 7 comments
Open

Broken darknet export #262

alexkokh opened this issue Sep 4, 2021 · 7 comments

Comments

@alexkokh
Copy link

alexkokh commented Sep 4, 2021

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.

@MohamedElsaeidy
Copy link

MohamedElsaeidy commented Sep 5, 2021

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

@alexkokh
Copy link
Author

alexkokh commented Sep 5, 2021

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.

@MohamedElsaeidy
Copy link

MohamedElsaeidy commented Sep 5, 2021

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

@alexkokh
Copy link
Author

alexkokh commented Sep 6, 2021

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.

@B1ackg0d
Copy link

B1ackg0d commented Sep 6, 2021

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.

@alexkokh
Copy link
Author

alexkokh commented Sep 6, 2021

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.

@ceccocats
Copy link
Owner

ceccocats commented Sep 29, 2021

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

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

4 participants