You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by la...@apache.org on 2021/02/08 13:32:04 UTC
[incubator-mxnet] branch master updated: [EXAMPLE] Fix quantization
example to be path independent (#19840)
This is an automated email from the ASF dual-hosted git repository.
lausen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new bca8de8 [EXAMPLE] Fix quantization example to be path independent (#19840)
bca8de8 is described below
commit bca8de85c6011d145e52ae06639fb2ae129d0480
Author: bgawrych <ba...@intel.com>
AuthorDate: Mon Feb 8 14:29:41 2021 +0100
[EXAMPLE] Fix quantization example to be path independent (#19840)
---
example/quantization/imagenet_gen_qsym_onednn.py | 3 ++-
example/quantization/imagenet_inference.py | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/example/quantization/imagenet_gen_qsym_onednn.py b/example/quantization/imagenet_gen_qsym_onednn.py
index bb75a05..060709c 100644
--- a/example/quantization/imagenet_gen_qsym_onednn.py
+++ b/example/quantization/imagenet_gen_qsym_onednn.py
@@ -29,7 +29,8 @@ from mxnet.gluon.data import DataLoader
from mxnet.gluon.data.vision import transforms
from mxnet.gluon.model_zoo.vision import get_model
-sys.path.append('../..')
+SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
+sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, '..', '..')))
from tools.rec2idx import IndexCreator
diff --git a/example/quantization/imagenet_inference.py b/example/quantization/imagenet_inference.py
index fae4ab9..f361f00 100644
--- a/example/quantization/imagenet_inference.py
+++ b/example/quantization/imagenet_inference.py
@@ -33,7 +33,7 @@ def download_dataset(dataset_url, dataset_dir, logger=None):
def score(symblock, data, ctx, max_num_examples, skip_num_batches, logger=None):
- metrics = [gluon.metric.create('acc')],
+ metrics = [gluon.metric.create('acc'),
gluon.metric.create('top_k_accuracy', top_k=5)]
# make sure that fp32 inference works on the same images as calibrated quantized model