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

Training problem #70

Closed
nuitvolgit opened this issue Sep 19, 2019 · 7 comments
Closed

Training problem #70

nuitvolgit opened this issue Sep 19, 2019 · 7 comments
Labels
training Training Related Questions

Comments

@nuitvolgit
Copy link

nuitvolgit commented Sep 19, 2019

I use tensorflow 2.0.0-rc1

I trained using train.py with a default training image: "girl.png"
After training with FLAGS.mode='fit', FLAGS.transfer='none',
I tested it with the same trained image using detect.py
But I got following warnings and couldn't detect any objects as well.

.......
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-0.layer_with_weights-0.kernel
W0919 11:04:29.340978 140067676804928 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-0.layer_with_weights-0.kernel
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-0.layer_with_weights-1.gamma
W0919 11:04:29.341034 140067676804928 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-0.layer_with_weights-1.gamma
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-0.layer_with_weights-1.beta
W0919 11:04:29.341070 140067676804928 util.py:144] Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-0.layer_with_weights-1.beta
WARNING:tensorflow:Unresolved object in checkpoint: (root).optimizer's state 'm' for (root).layer_with_weights-0.layer_with_weights-2.kernel
................... and so on..

It looks like weights are not fully restored for some reason.

If I train with FLAGS.mode = 'eager_tf', I don't get such warning when running detect.py

It seems like saving weight using "model.save_weights" does not provide warning but
using "ModelCheckpoint" does provide warning.

I am not sure.

Any ideas?

@nuitvolgit
Copy link
Author

I still get the same warning but the detection works.
It turned out that the reason of detection failure was not related to the warnings.
I tried to train a single class detection but the class probability was not trained since the softmax for a single class always gives 1.
So I changed the score value in the yolo_nms function such that if the class number is one, then score is the same as the confidence.

@mmortazavi
Copy link

I am having a quick start using this repo. Just read your comments about single class detection! How did you change in score value in the yolo_nms function? Would you mind sharing your modified yolo_nms function here so we could use as well? Thanks

@nuitvolgit
Copy link
Author

nuitvolgit commented Oct 10, 2019

I changed the following line in yolo_nms function:

scores = confidence * class_probs

to like this:

if classes > 1:
scores = confidence * class_probs
else:
scores = confidence

This is because the class_prob is not trained for a single class case.
So its value is almost like zero from the start to the end of the training.

@nuitvolgit
Copy link
Author

nuitvolgit commented Oct 10, 2019 via email

@SpontaneousDuck
Copy link

This fix for one class should be pushed up to the main! Maybe i'll get around to a PR

@lazerliu
Copy link

lazerliu commented Nov 6, 2019

My detection is also not work,I train with pascal 16 epochs,and then detect nothing!
I wonder what the correct steps to validate the model I trained.thks

@zzh8829 zzh8829 added the training Training Related Questions label Dec 20, 2019
@zzh8829
Copy link
Owner

zzh8829 commented Dec 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
training Training Related Questions
Projects
None yet
Development

No branches or pull requests

5 participants