Пример #1
0
    def get_logits(self, image, is_train, **kwargs):
        widths = tf.ones(tf.shape(image)[0],
                         dtype=tf.int32) * tf.shape(image)[2]
        features, sequence_length = self._convnet_layers(
            image, widths, is_train)
        features = rnn_layers(features,
                              sequence_length,
                              self.rnn_size,
                              use_projection=True)
        logits = dense_layer(features,
                             len(self.out_charset) + 1,
                             name='logits')

        return logits, sequence_length
Пример #2
0
    def get_logits(self, image, is_train, **kwargs):
        """
        """
        widths = tf.ones(tf.shape(image)[0],
                         dtype=tf.int32) * tf.shape(image)[2]
        features, sequence_length = self._convnet_layers(
            image, widths, is_train)
        attention_states = rnn_layers(features,
                                      sequence_length,
                                      self.rnn_size,
                                      use_projection=True)
        attention_states = dense_layer(attention_states,
                                       self.rnn_size,
                                       name='att_state_dense')
        logits, weights = attention_decoder(attention_states,
                                            kwargs['label'],
                                            len(self.out_charset),
                                            self.rnn_size,
                                            is_train,
                                            self.FLAGS.label_maxlen,
                                            cell_type='gru')

        return logits, sequence_length