-
Notifications
You must be signed in to change notification settings - Fork 45.5k
Fix demo_inference to properly normalize input #2978
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
Conversation
Before the fix the demo_inference.py used batch_norm and it did the normalization of input image implicitly. If at inference time the batch_norm was disabled the inference produced incorrect results. This fix does the proper input image normalization and disables the batch_norm at inference time.
@sguada Can you please review the change? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix before merging
feed_dict={images_placeholder: images_data}) | ||
print("Predicted strings:") | ||
for line in predictions: | ||
for line in run(FLAGS.checkpoint, FLAGS.batch_size, FLAGS.dataset_name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to:
predictions = run(FLAGS.checkpoint, FLAGS.batch_size, FLAGS.dataset_name, FLAGS.image_path_pattern)
for line in predictions:
print(line)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
feed_dict={images_placeholder: images_data}) | ||
print("Predicted strings:") | ||
for line in predictions: | ||
for line in run(FLAGS.checkpoint, FLAGS.batch_size, FLAGS.dataset_name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed
Use temp variable for predictions.
This PR was messed up with unsuccessful merges with the upstream. I will create a new one with the required changes to the Attention OCR only. |
Before the fix the demo_inference.py used batch_norm and it did the normalization of input image implicitly. If at the inference time the batch_norm was disabled the inference produced incorrect results.
This fix: