Skip to content

Commit ff86c1c

Browse files
authored
Fix TF OOB 200 EfficientDet regression on TFnewAPI (#1066)
1 parent b56b19d commit ff86c1c

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

examples/tensorflow/oob_models/quantization/ptq/model_detail.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,26 @@
364364
'input/item_onehot':np.array([[0] * 3706] * 10, dtype='float32')
365365
},
366366
'output': ['evaluation/TopKV2',]
367-
}
367+
},
368+
# EfficientDet-D2-768x768
369+
{
370+
'model_name': 'EfficientDet-D2-768x768',
371+
'input': {'input': generate_data([768, 768, 3]),},
372+
'output': ['class_net/class-predict_1/BiasAdd', 'class_net/class-predict_2/BiasAdd',
373+
'class_net/class-predict_3/BiasAdd', 'class_net/class-predict_4/BiasAdd', 'box_net/box-predict_1/BiasAdd',
374+
'box_net/box-predict_2/BiasAdd', 'box_net/box-predict_3/BiasAdd', 'box_net/box-predict_4/BiasAdd'],
375+
'low': -1.0,
376+
'high': 1.0
377+
},
378+
# EfficientDet-D4-1024x1024
379+
{
380+
'model_name': 'EfficientDet-D4-1024x1024',
381+
'input': {'input': generate_data([1024, 1024, 3]),},
382+
'output': ['class_net/class-predict_1/BiasAdd', 'class_net/class-predict_2/BiasAdd',
383+
'class_net/class-predict_3/BiasAdd', 'class_net/class-predict_4/BiasAdd', 'box_net/box-predict_1/BiasAdd',
384+
'box_net/box-predict_2/BiasAdd', 'box_net/box-predict_3/BiasAdd', 'box_net/box-predict_4/BiasAdd'],
385+
'low': -1.0,
386+
'high': 1.0
387+
},
368388
]
369389

examples/tensorflow/oob_models/quantization/ptq/run_tuning.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ function set_args {
8181
NeuMF
8282
PRNet
8383
DIEN_Deep-Interest-Evolution-Network
84+
EfficientDet-D2-768x768
85+
EfficientDet-D4-1024x1024
8486
--------
8587
)
8688

examples/tensorflow/oob_models/quantization/ptq/tf_benchmark.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,9 @@ def __iter__(self):
242242
args = parser.parse_args()
243243

244244

245+
# the range of dummy data
246+
low = 1.0
247+
high = 20.0
245248
# benchmark PB model directly
246249
find_graph_def = tf_v1.GraphDef()
247250
if args.model_path and not args.model_name:
@@ -290,6 +293,10 @@ def __iter__(self):
290293
model_detail = model
291294
model_detail['model_dir'] = args.model_path
292295
model_detail['ckpt'] = args.is_meta
296+
if 'low' in model_detail.keys():
297+
low = model_detail['low']
298+
if 'high' in model_detail.keys():
299+
high = model_detail['high']
293300
break
294301
if not model_detail:
295302
logger.error("Model undefined.")
@@ -336,7 +343,7 @@ def __iter__(self):
336343
else:
337344
dataset = quantizer.dataset(dataset_type='dummy',
338345
shape=inputs_shape,
339-
low=1.0, high=20.0,
346+
low=low, high=high,
340347
dtype=inputs_dtype,
341348
label=True)
342349
dataloader_dict = {'wide_deep': WidedeepDataloader}

0 commit comments

Comments
 (0)