YOLOv3_TensorFlow icon indicating copy to clipboard operation
YOLOv3_TensorFlow copied to clipboard

Create convert_tf_to_darknet.py

Open tianfengyijiu opened this issue 5 years ago • 2 comments

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.

tianfengyijiu avatar Jun 24 '19 12:06 tianfengyijiu

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?

cnmckee avatar Aug 09 '19 21:08 cnmckee

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?

mew124 avatar Dec 17 '19 19:12 mew124