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

Create convert_tf_to_darknet.py #99

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tianfengyijiu
Copy link

this script is used to convert tensorflow's checkpoint to Darknet weights file. But there are two problems:

  1. Maybe some layer`s name is different between this project and my
  2. After conversion, the results on the Darknet map is worse than here before conversion.

this script is used to convert tensorflow's checkpoint to Darknet weights file. But there are two problems:
1. Maybe some layer`s name is different between this project and my
2. After conversion, the results on the Darknet map is worse than here before conversion.
@cnmckee
Copy link

cnmckee commented Aug 9, 2019

This script is exactly what I have been looking for. Where these problems ever resolved? How much worse are the results on the new saved weights?

@mew124
Copy link

mew124 commented Dec 17, 2019

Hi, thank you so much for this code! It's exactly what I need! However, I ran into some problems: which checkpoint file do I have to use for this code? When training 4 files are saved: training.meta, training.index and training.data.... and a checkpoint file called checkpoint. If I try to load the checkpoint file i get this error message:

"DataLossError: Unable to open table file \checkpoint: Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?"

I then tried to load the same file as I use in restore_path (only the filename without the endings .meta, .index etc.) and got this error message:
"line 26, in write_bn weightfile.write(reader.get_tensor(layer_name + '/batch_normalization/beta').tobytes())
File "\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 678, in get_tensor
return CheckpointReader_GetTensor(self, compat.as_bytes(tensor_str))"
NotFoundError: Key darknet/conv0/batch_normalization/beta not found in checkpoint

Does anyone have an idea what might be wrong and could help me?

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

Successfully merging this pull request may close these issues.

4 participants