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

How to open the binary weights file? #1

Closed
wsyzzz opened this issue Jan 23, 2018 · 2 comments
Closed

How to open the binary weights file? #1

wsyzzz opened this issue Jan 23, 2018 · 2 comments

Comments

@wsyzzz
Copy link

wsyzzz commented Jan 23, 2018

Hi, Simo! You've done an amazing project and really help me a lot! I have a small question that how do you open the binary weights file like tiny-yolo-voc.weights? I wanted to edit it with 'vi tiny-yolo-voc.weights' or 'gedit tiny-yolo-voc.weights' in Ubuntu 16.04 but failed. Does it need any special applications to open it? Thx.

@simo23
Copy link
Owner

simo23 commented Jan 23, 2018

Hi @wsyzzz , thanks!

As the name says the file is binary, which means that it contains only zeros and ones. It is basically a list of float32 numbers saved in binary format, which after the conversion one after the other define the single parameters of the network. So there is nothing human-readable to see into that file :) The only thing you can do is importing it with:

    loaded_weights = np.fromfile(weights_path, dtype='f')

which will convert the binary numbers to float32 numbers readable in numpy. Now you have a list of numbers that you can see, but nothing more. By knowing the order in which they have been saved by the author of the file we can then assign their value into the right parameter of our network.

@wsyzzz
Copy link
Author

wsyzzz commented Jan 23, 2018

@simo23 Thanks for your response! I get it!

@simo23 simo23 closed this as completed Jan 23, 2018
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

2 participants