Skip to content

Commit 71349a1

Browse files
authored
Merge pull request tensorflow#2565 from alexgorban/master
#attention_ocr: fix deprecation warnings and update usage examples
2 parents 3653ef1 + d906b13 commit 71349a1

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

research/attention_ocr/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pip install --upgrade tensorflow-gpu
3434
2. At least 158GB of free disk space to download the FSNS dataset:
3535

3636
```
37-
cd models/attention_ocr/python/datasets
37+
cd research/attention_ocr/python/datasets
3838
aria2c -c -j 20 -i ../../../street/python/fsns_urls.txt
3939
cd ..
4040
```
@@ -50,7 +50,7 @@ cd ..
5050
To run all unit tests:
5151

5252
```
53-
cd models/attention_ocr/python
53+
cd research/attention_ocr/python
5454
python -m unittest discover -p '*_test.py'
5555
```
5656

research/attention_ocr/python/demo_inference.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
1313
Usage:
1414
python demo_inference.py --batch_size=32 \
15+
--checkpoint=model.ckpt-399731\
1516
--image_path_pattern=./datasets/data/fsns/temp/fsns_train_%02d.png
1617
"""
1718
import numpy as np

research/attention_ocr/python/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def char_predictions(self, chars_logit):
299299
with shape [batch_size x seq_length].
300300
"""
301301
log_prob = utils.logits_to_log_prob(chars_logit)
302-
ids = tf.to_int32(tf.argmax(log_prob, dimension=2), name='predicted_chars')
302+
ids = tf.to_int32(tf.argmax(log_prob, axis=2), name='predicted_chars')
303303
mask = tf.cast(
304304
slim.one_hot_encoding(ids, self._params.num_char_classes), tf.bool)
305305
all_scores = tf.nn.softmax(chars_logit)

research/attention_ocr/python/model_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import string
2020
import tensorflow as tf
2121
from tensorflow.contrib import slim
22-
from tensorflow.contrib.tfprof import model_analyzer
2322

2423
import model
2524
import data_provider
@@ -127,9 +126,9 @@ def test_model_size_less_then1_gb(self):
127126
ocr_model = self.create_model()
128127
ocr_model.create_base(images=self.fake_images, labels_one_hot=None)
129128
with self.test_session() as sess:
130-
tfprof_root = model_analyzer.print_model_analysis(
129+
tfprof_root = tf.profiler.profile(
131130
sess.graph,
132-
tfprof_options=model_analyzer.TRAINABLE_VARS_PARAMS_STAT_OPTIONS)
131+
options=tf.profiler.ProfileOptionBuilder.trainable_variables_parameter())
133132

134133
model_size_bytes = 4 * tfprof_root.total_parameters
135134
self.assertLess(model_size_bytes, 1 * 2**30)

research/attention_ocr/python/sequence_layers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def char_one_hot(self, logit):
216216
Returns:
217217
A tensor with shape [batch_size, num_char_classes]
218218
"""
219-
prediction = tf.argmax(logit, dimension=1)
219+
prediction = tf.argmax(logit, axis=1)
220220
return slim.one_hot_encoding(prediction, self._params.num_char_classes)
221221

222222
def get_input(self, prev, i):

0 commit comments

Comments
 (0)