Skip to content

make sure batch_norm is False when inferencing a image #3162

@beacandler

Description

@beacandler

problem

when using
code: tensorflow/models/reaserch/atttention_ocr:
paper: Attention-based Extraction of Structured Information from Street View Imagery
I encountered a issue.
Recognizition result for one image is depended on images within the same batch, sometimes when batch is larger than the number of acutal images ,the result is absurd.

reason

in batch_norm.
When inferencing a image in a batch, we expect attention_ocr use global mean and std to act on the image, but When Is_training = True(default), attention_ocr will get mean and std by computing in a batch, so the error occurs.

solution

pass is_training=False to batch_norm when inferencing.
so in attention_ocr/python/model.py 209:63
with slim.arg_scope([slim.batch_norm], is_training=is_training)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions