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

Two bugs need to be fixed for training. #127

Closed
zhaowt61 opened this issue Mar 13, 2019 · 4 comments
Closed

Two bugs need to be fixed for training. #127

zhaowt61 opened this issue Mar 13, 2019 · 4 comments

Comments

@zhaowt61
Copy link

1 change the " ptr = 0" in the function "load_weights(self, weights_path):" to "ptr=5". Because they added header_info into the weights file, which makes the loading mismatched by 5 bits. This bug is hidden so deep!
2 remove "model.eval()" in "detect.py"

The above solutions worked perfectly for me.

@BeibinLi
Copy link

I do not think these two changes will make difference.

  1. The original code is correct. The five bits are read in "header = np.fromfile(fp, dtype=np.int32, count=5)" line.

  2. "detect.py" does not affect training. So, removing "model.eval()" would not affect the training result either. Moreover, "model.eval()" is strongly advised for testing.

@zhaowt61
Copy link
Author

I do not think these two changes will make difference.

1. The original code is correct. The five bits are read in "header = np.fromfile(fp, dtype=np.int32, count=5)" line.

2. "detect.py" does not affect training. So, removing "model.eval()" would not affect the training result either. Moreover, "model.eval()" is strongly advised for testing.

The first change is necessary, because I found that the loading and saving of weights are mis-matched.

@stevehjc
Copy link

1 change the " ptr = 0" in the function "load_weights(self, weights_path):" to "ptr=5". Because they added header_info into the weights file, which makes the loading mismatched by 5 bits. This bug is hidden so deep!
2 remove "model.eval()" in "detect.py"

The above solutions worked perfectly for me.

I think ptr=0 is right, but definition of self.header_info is wrong:
modify the
self.header_info = np.array([0, 0, 0, self.seen, 0])
to
self.header_info = np.array([0, 0, 0, self.seen, 0],dtype=np.int32),default np.int is np.int64. This is why these are 5bit offset.

@ygliang2009
Copy link

I do not think these two changes will make difference.

1. The original code is correct. The five bits are read in "header = np.fromfile(fp, dtype=np.int32, count=5)" line.

2. "detect.py" does not affect training. So, removing "model.eval()" would not affect the training result either. Moreover, "model.eval()" is strongly advised for testing.

The first change is necessary, because I found that the loading and saving of weights are mis-matched.

when loading yolov3 official yolov3.weights, need to use ptr = 0, when loading the model from saving trained, need to modify ptr = 0 to ptr = 5

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

5 participants