From b1e4b4f153271ff0e868b19599bddd950383b9d2 Mon Sep 17 00:00:00 2001 From: gaotingquan Date: Tue, 1 Nov 2022 13:32:58 +0000 Subject: [PATCH] docs: update demo result --- docs/en/models/PP-HGNet_en.md | 9 ++++++++- docs/en/models/PP-LCNet_en.md | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/en/models/PP-HGNet_en.md b/docs/en/models/PP-HGNet_en.md index 3c664351..0184e158 100644 --- a/docs/en/models/PP-HGNet_en.md +++ b/docs/en/models/PP-HGNet_en.md @@ -148,11 +148,18 @@ Predict complete! ```python from paddleclas import PaddleClas clas = PaddleClas(model_name='PPHGNet_small') -infer_imgs = 'docs/images/deployment/whl_demo.jpg' +infer_imgs = 'docs/images/inference_deployment/whl_demo.jpg' result = clas.predict(infer_imgs) print(next(result)) ``` +The result of demo above: + +``` +>>> result +[{'class_ids': [8, 7, 86, 82, 81], 'scores': [0.77132, 0.05122, 0.00755, 0.00199, 0.00115], 'label_names': ['hen', 'cock', 'partridge', 'ruffed grouse, partridge, Bonasa umbellus', 'ptarmigan'], 'filename': 'docs/images/inference_deployment/whl_demo.jpg'}] +``` + **Note**: The result returned by model.predict() is a `generator`, so you need to use the `next()` function to call it or `for loop` to loop it. And it will predict with batch_size size batch and return the prediction results when called. The default batch_size is 1, and you also specify the batch_size when instantiating, such as `model = paddleclas.PaddleClas(model_name="PPHGNet_small", batch_size=2)`. diff --git a/docs/en/models/PP-LCNet_en.md b/docs/en/models/PP-LCNet_en.md index 652af892..d5786996 100644 --- a/docs/en/models/PP-LCNet_en.md +++ b/docs/en/models/PP-LCNet_en.md @@ -198,11 +198,18 @@ Predict complete! ```python from paddleclas import PaddleClas clas = PaddleClas(model_name='PPLCNet_x1_0') -infer_imgs = 'docs/images/deployment/whl_demo.jpg' +infer_imgs = 'docs/images/inference_deployment/whl_demo.jpg' result = clas.predict(infer_imgs) print(next(result)) ``` +The result of demo above: + +``` +>>> result +[{'class_ids': [8, 7, 86, 81, 85], 'scores': [0.91347, 0.03779, 0.0036, 0.00117, 0.00112], 'label_names': ['hen', 'cock', 'partridge', 'ptarmigan', 'quail'], 'filename': 'docs/images/inference_deployment/whl_demo.jpg'}] +``` + **Note**: The result returned by model.predict() is a `generator`, so you need to use the `next()` function to call it or `for loop` to loop it. And it will predict with batch_size size batch and return the prediction results when called. The default batch_size is 1, and you also specify the batch_size when instantiating, such as `model = paddleclas.PaddleClas(model_name="PPLCNet_x1_0", batch_size=2)`. -- GitLab