Closed Harmonicahappy closed 5 years ago
Thanks a lot! Looks correct to me, but just in case: did you manage to reliably verify that it fixes the issues? Could you maybe show the logs? On Apr 16, 2019, 09:04 +0200, Terence Wu notifications@github.com, wrote:
First of all, you define GO flag's index as 1 in data_gen.py: class DataGen(object): GO_ID = 1 EOS_ID = 2 IMAGE_HEIGHT = 32 CHARMAP = ['', '', ''] + list('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ') Second, decoder_inputs will be filled with value 0 in model.py: self.decoder_inputs = [] self.target_weights = [] for i in xrange(self.decoder_size + 1): self.decoder_inputs.append( tf.tile([0], [num_images]) ) In train mode, it is ok because decoder_inputs will be filled with ground truth labels, but in predict mode, first element of decoder_inputs will be 0, and it is not the correct index for GO flag. You can view, comment on, or merge this pull request online at: https://github.com/emedvedev/attention-ocr/pull/132 Commit Summary
• Fix bug of issue#86 and issue#131
File Changes
• M aocr/model/model.py (2)
Patch Links:
• https://github.com/emedvedev/attention-ocr/pull/132.patch • https://github.com/emedvedev/attention-ocr/pull/132.diff
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Thanks a lot! Looks correct to me, but just in case: did you manage to reliably verify that it fixes the issues? Could you maybe show the logs? … On Apr 16, 2019, 09:04 +0200, Terence Wu @.***>, wrote: First of all, you define GO flag's index as 1 in data_gen.py: class DataGen(object): GO_ID = 1 EOS_ID = 2 IMAGE_HEIGHT = 32 CHARMAP = ['', '', ''] + list('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ') Second, decoder_inputs will be filled with value 0 in model.py: self.decoder_inputs = [] self.target_weights = [] for i in xrange(self.decoder_size + 1): self.decoder_inputs.append( tf.tile([0], [num_images]) ) In train mode, it is ok because decoder_inputs will be filled with ground truth labels, but in predict mode, first element of decoder_inputs will be 0, and it is not the correct index for GO flag. You can view, comment on, or merge this pull request online at: #132 Commit Summary • Fix bug of issue#86 and issue#131 File Changes • M aocr/model/model.py (2) Patch Links: • https://github.com/emedvedev/attention-ocr/pull/132.patch • https://github.com/emedvedev/attention-ocr/pull/132.diff — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
I am sorry I didn't keep logs. When I use the old version, accuracy in test mode is 89%, but it drops to 86% in predict mode; after I fix it like above, the accuracy returns to 89%, so I am 100% sure that it is a right fix
No worries at all, let's merge it then :) And again, thanks for investigating!
@emedvedev, in my case, it doesn't work when I run exported model. T.T
Do you have solution?
First of all, you define
GO
flag's index as 1 indata_gen.py
:Second,
decoder_inputs
will be filled with value 0 inmodel.py
:In train mode, it is ok because
decoder_inputs
will be filled with ground truth labels, but in predict mode, first element ofdecoder_inputs
will be 0, and it is not the correct index forGO
flag.