Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Update imagenet quantization script for MKL-DNN #14407

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 6 additions & 2 deletions example/quantization/imagenet_gen_qsym_mkldnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,15 @@ def save_params(fname, arg_params, aux_params, logger=None):
if args.model == 'imagenet1k-resnet-152':
rgb_mean = '0,0,0'
rgb_std = '1,1,1'
excluded_sym_names += ['flatten0']
# TODO, fc1 will be enabled after MKL-DNN 0.18
excluded_sym_names += ['flatten0', 'fc1']
if exclude_first_conv:
excluded_sym_names += ['conv0']
elif args.model == 'imagenet1k-inception-bn':
rgb_mean = '123.68,116.779,103.939'
rgb_std = '1,1,1'
excluded_sym_names += ['flatten']
# TODO, fc1 will be enabled after MKL-DNN 0.18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v0.18 will be available soon. @TaoLv is WIP for the upgrading.
Could we wait several days for v0.18?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now, these three examples will fail due to limitation of quantized FullyConnected (as it's enabled in current script).
If v0.18 will be merged into master in a short time, then this would be fine.

excluded_sym_names += ['flatten', 'fc1']
if exclude_first_conv:
excluded_sym_names += ['conv_1']
elif args.model in ['resnet50_v1', 'resnet101_v1']:
Expand All @@ -231,7 +233,9 @@ def save_params(fname, arg_params, aux_params, logger=None):
elif args.model == 'mobilenet1.0':
rgb_mean = '123.68,116.779,103.939'
rgb_std = '58.393, 57.12, 57.375'
# TODO, mobilenet0_dense0_fwd will be enabled after MKL-DNN 0.18
excluded_sym_names += ['mobilenet0_flatten0_flatten0',
'mobilenet0_dense0_fwd',
'mobilenet0_pool0_fwd']
if exclude_first_conv:
excluded_sym_names += ['mobilenet0_conv0_fwd']
Expand Down