Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions research/attention_ocr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pip install --upgrade tensorflow-gpu
2. At least 158GB of free disk space to download the FSNS dataset:

```
cd models/attention_ocr/python/datasets
cd research/attention_ocr/python/datasets
aria2c -c -j 20 -i ../../../street/python/fsns_urls.txt
cd ..
```
Expand All @@ -50,7 +50,7 @@ cd ..
To run all unit tests:

```
cd models/attention_ocr/python
cd research/attention_ocr/python
python -m unittest discover -p '*_test.py'
```

Expand Down
1 change: 1 addition & 0 deletions research/attention_ocr/python/demo_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

Usage:
python demo_inference.py --batch_size=32 \
--checkpoint=model.ckpt-399731\
--image_path_pattern=./datasets/data/fsns/temp/fsns_train_%02d.png
"""
import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion research/attention_ocr/python/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def char_predictions(self, chars_logit):
with shape [batch_size x seq_length].
"""
log_prob = utils.logits_to_log_prob(chars_logit)
ids = tf.to_int32(tf.argmax(log_prob, dimension=2), name='predicted_chars')
ids = tf.to_int32(tf.argmax(log_prob, axis=2), name='predicted_chars')
mask = tf.cast(
slim.one_hot_encoding(ids, self._params.num_char_classes), tf.bool)
all_scores = tf.nn.softmax(chars_logit)
Expand Down
5 changes: 2 additions & 3 deletions research/attention_ocr/python/model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import string
import tensorflow as tf
from tensorflow.contrib import slim
from tensorflow.contrib.tfprof import model_analyzer

import model
import data_provider
Expand Down Expand Up @@ -127,9 +126,9 @@ def test_model_size_less_then1_gb(self):
ocr_model = self.create_model()
ocr_model.create_base(images=self.fake_images, labels_one_hot=None)
with self.test_session() as sess:
tfprof_root = model_analyzer.print_model_analysis(
tfprof_root = tf.profiler.profile(
sess.graph,
tfprof_options=model_analyzer.TRAINABLE_VARS_PARAMS_STAT_OPTIONS)
options=tf.profiler.ProfileOptionBuilder.trainable_variables_parameter())

model_size_bytes = 4 * tfprof_root.total_parameters
self.assertLess(model_size_bytes, 1 * 2**30)
Expand Down
2 changes: 1 addition & 1 deletion research/attention_ocr/python/sequence_layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def char_one_hot(self, logit):
Returns:
A tensor with shape [batch_size, num_char_classes]
"""
prediction = tf.argmax(logit, dimension=1)
prediction = tf.argmax(logit, axis=1)
return slim.one_hot_encoding(prediction, self._params.num_char_classes)

def get_input(self, prev, i):
Expand Down