Skip to content

Commit 6774d7b

Browse files
authored
Merge pull request #92 from CortexFoundation/zh
8.16
2 parents d2f5922 + 10fff0e commit 6774d7b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+153
-17
lines changed

docs/deep_dive/mrt.rst

Lines changed: 63 additions & 0 deletions

docs/index.rst

Lines changed: 1 addition & 0 deletions

docs/mrt/model.md

Lines changed: 75 additions & 8 deletions

python/mrt/V3/evaluate.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from yacs.config import CfgNode as CN
99
import logging
10+
import time
1011

1112
import mxnet as mx
1213
from mxnet import gluon, ndarray as nd
@@ -132,8 +133,10 @@ def get_evaluation_info(cm_cfg, pass_cfg, logger=None):
132133
def evalfunc(data, label):
133134
# outs = forward(graph, data, ctx=ctx)
134135
outs = forward(graph, data, ctx, baxis, olen)
136+
start = time.time()
135137
acc = dataset.validate(metric, outs, label)
136-
return acc
138+
end = time.time()
139+
return acc, int((end-start)*1e3)
137140

138141
# forward function for the quantized model
139142
if conf_map.get("split_keys", "") != "":
@@ -161,8 +164,10 @@ def quantize(data, label):
161164
outs = forward(qgraph, data, ctx, baxis, olen)
162165
outs = outs / oscales[0] if olen == 1 \
163166
else [(t / oscales[i]) for i, t in enumerate(outs)]
167+
start = time.time()
164168
acc = dataset.validate(qmetric, outs, label)
165-
return acc
169+
end = time.time()
170+
return acc, int((end-start)*1e3)
166171

167172
return evalfunc, data_iter_func, quantize
168173

python/mrt/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,17 +188,17 @@ def multi_validate(base_func, data_iter, *comp_funcs,
188188
log_str = "Iteration: {:3d} | " + base_func.__name__ + ": {} | "
189189
for func in comp_funcs:
190190
log_str += func.__name__ + ": {} | "
191-
log_str += "Total Sample: {:5d}"
191+
log_str += "time: {}ms {}ms | Total Sample: {:5d}"
192192

193193
total = 0
194194
for i in range(iter_num):
195195
data, label = data_iter()
196-
base_acc = base_func(data, label)
196+
base_acc, base_time = base_func(data, label)
197197
comp_acc = [func(data, label) for func in comp_funcs]
198198
total += batch_size
199-
200-
msg = log_str.format(i, base_acc, *comp_acc, total)
199+
msg = log_str.format(i, base_acc, comp_acc[0][0], base_time, comp_acc[0][1], total)
201200
logger.info(msg)
201+
202202

203203
def multi_eval_accuracy(base_func, data_iter_func, *comp_funcs,
204204
iter_num=10, logger=logging):
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/mrt/model_zoo/cifar10/cifar_resnet110_v2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
COMMON:
2-
MODEL_NAME: cifar_resnet20_v2
2+
MODEL_NAME: cifar_resnet110_v2
33
PREPARE:
44
INPUT_SHAPE: [-1,3,32,32]
55
CALIBRATE:

tests/mrt/model_zoo/imagenet/mobilenet1_0.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
COMMON:
2-
MODEL_NAME: mobilenet1_0
2+
MODEL_NAME: mobilenet1.0
33
CALIBRATE:
44
NUM_CALIB: 1
55
DATASET_NAME: imagenet

tests/mrt/model_zoo/imagenet/resnet152_v2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
COMMON:
2-
MODEL_NAME: resnet152_v1
2+
MODEL_NAME: resnet152_v2
33
VERBOSITY: debug
44
RUN_EVALUATE: True
55
CALIBRATE:

0 commit comments

Comments
 (0)