Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Regression of ssd_resnet50_v1 Example for TF New API #1283

Merged
merged 1 commit into from
Sep 27, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,29 @@ def main(_):
if args.tune:
from neural_compressor import quantization
from neural_compressor.config import PostTrainingQuantConfig
config = PostTrainingQuantConfig(
inputs=["image_tensor"],
outputs=["num_detections", "detection_boxes", "detection_scores", "detection_classes"],
calibration_sampling_size=[10, 50, 100, 200])
op_name_dict = {
'FeatureExtractor/resnet_v1_50/fpn/bottom_up_block5/Conv2D': {
'activation': {'dtype': ['fp32']},
},
'WeightSharedConvolutionalBoxPredictor_2/BoxPredictionTower/conv2d_0/Conv2D': {
'activation': {'dtype': ['fp32']},
},
'WeightSharedConvolutionalBoxPredictor_2/ClassPredictionTower/conv2d_0/Conv2D': {
'activation': {'dtype': ['fp32']},
},
}
# only for TF newAPI
if tf.version.VERSION in ['2.11.0202242', '2.11.0202250', '2.11.0202317', '2.11.0202323']:
config = PostTrainingQuantConfig(
inputs=["image_tensor"],
outputs=["num_detections", "detection_boxes", "detection_scores", "detection_classes"],
calibration_sampling_size=[10, 50, 100, 200],
op_name_dict=op_name_dict)
else:
config = PostTrainingQuantConfig(
inputs=["image_tensor"],
outputs=["num_detections", "detection_boxes", "detection_scores", "detection_classes"],
calibration_sampling_size=[10, 50, 100, 200])
q_model = quantization.fit(model=args.input_graph, conf=config,
calib_dataloader=calib_dataloader, eval_func=evaluate)
q_model.save(args.output_model)
Expand Down