Skip to content

Commit 0a9d29a

Browse files
committed
Update per review
Change default value for output_blob to None Move preprocess script and update link in README Signed-off-by: Junze Wu <[email protected]>
1 parent 7523f55 commit 0a9d29a

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

demos/handwritten_text_recognition_demo/python/handwritten_text_recognition_demo.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def build_argparser():
4848
help="Path to the decoding char list file. Default is for Japanese")
4949
args.add_argument("-dc", "--designated_characters", type=str, default=None, help="Optional. Path to the designated character file")
5050
args.add_argument("-tk", "--top_k", type=int, default=20, help="Optional. Top k steps in looking up the decoded character, until a designated one is found")
51-
args.add_argument("-ob", "--output_blob", type=str, default="output", help="Optional. Name of the output layer of the model. Default is \'output\'")
51+
args.add_argument("-ob", "--output_blob", type=str, default=None, help="Optional. Name of the output layer of the model. Default is None, in which case the demo will read the output name from the model, assuming there is only 1 output layer")
5252
return parser
5353

5454

@@ -85,9 +85,13 @@ def main():
8585
net = ie.read_network(args.model, os.path.splitext(args.model)[0] + ".bin")
8686

8787
assert len(net.input_info) == 1, "Demo supports only single input topologies"
88-
8988
input_blob = next(iter(net.input_info))
90-
out_blob = args.output_blob
89+
90+
if args.output_blob is not None:
91+
out_blob = args.output_blob
92+
else:
93+
assert len(net.outputs) == 1, "Demo supports only single output topologies"
94+
out_blob = next(iter(net.output_info))
9195

9296
characters = get_characters(args)
9397
codec = CTCCodec(characters, args.designated_characters, args.top_k)

models/intel/handwritten-english-recognition-0001/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ The network is able to recognize English text consisting of characters in the [G
1818
| Accuracy on GNHK test subset (excluding images wider than 2000px after resized to height 96px with aspect ratio) | 81.5% |
1919
| Source framework | PyTorch\* |
2020

21-
> **Note:** to achieve the accuracy, images from the GNHK test set should be binarized using adaptive thresholding, and preprocessed into single-line text images, using the coordinates from the accompanying JSON annotation files in the GNHK dataset. See [preprocess_gnhk.py](../../../demos/handwritten_text_recognition_demo/python/utils/preprocess_gnhk.py).
21+
> **Note:** to achieve the accuracy, images from the GNHK test set should be binarized using adaptive thresholding, and preprocessed into single-line text images, using the coordinates from the accompanying JSON annotation files in the GNHK dataset. See [preprocess_gnhk.py](./preprocess_gnhk.py).
2222
2323
This model adopts [label error rate](https://dl.acm.org/doi/abs/10.1145/1143844.1143891) as the metric for accuracy.
2424

0 commit comments

Comments
 (0)