From ff43fc54a12436884301de0d24b9613ff4a6e80b Mon Sep 17 00:00:00 2001 From: Yong Yue Date: Fri, 10 Jul 2026 15:08:38 +0800 Subject: [PATCH] Add zero-shot-object-detection fp32/fp16 recipes for google/owlv2-base-patch16-ensemble Recipe-only contribution. Adds fp32 and fp16 recipe configs for google/owlv2-base-patch16-ensemble (Owlv2ForObjectDetection) on two verified EP/device combinations: cpu/cpu and dml/gpu. Recipes added: - examples/recipes/google_owlv2-base-patch16-ensemble/cpu/cpu/zero-shot-object-detection_fp32_config.json - examples/recipes/google_owlv2-base-patch16-ensemble/cpu/cpu/zero-shot-object-detection_fp16_config.json - examples/recipes/google_owlv2-base-patch16-ensemble/dml/gpu/zero-shot-object-detection_fp32_config.json - examples/recipes/google_owlv2-base-patch16-ensemble/dml/gpu/zero-shot-object-detection_fp16_config.json Goal ladder (verified on local hardware): - L0 (build): PASS on all 4 configs - L1 (perf): - cpu/cpu fp32: 1615ms avg, 0.62 samples/s - cpu/cpu fp16: 1621ms avg, 0.62 samples/s, 293MB (50% size reduction) - dml/gpu fp32: 1088ms avg, 0.92 samples/s (1.5x vs cpu) - dml/gpu fp16: 1103ms avg, 0.91 samples/s --- ...ero-shot-object-detection_fp16_config.json | 74 +++++++++++++++++++ ...ero-shot-object-detection_fp32_config.json | 55 ++++++++++++++ ...ero-shot-object-detection_fp16_config.json | 74 +++++++++++++++++++ ...ero-shot-object-detection_fp32_config.json | 55 ++++++++++++++ 4 files changed, 258 insertions(+) create mode 100644 examples/recipes/google_owlv2-base-patch16-ensemble/cpu/cpu/zero-shot-object-detection_fp16_config.json create mode 100644 examples/recipes/google_owlv2-base-patch16-ensemble/cpu/cpu/zero-shot-object-detection_fp32_config.json create mode 100644 examples/recipes/google_owlv2-base-patch16-ensemble/dml/gpu/zero-shot-object-detection_fp16_config.json create mode 100644 examples/recipes/google_owlv2-base-patch16-ensemble/dml/gpu/zero-shot-object-detection_fp32_config.json diff --git a/examples/recipes/google_owlv2-base-patch16-ensemble/cpu/cpu/zero-shot-object-detection_fp16_config.json b/examples/recipes/google_owlv2-base-patch16-ensemble/cpu/cpu/zero-shot-object-detection_fp16_config.json new file mode 100644 index 000000000..312f5defa --- /dev/null +++ b/examples/recipes/google_owlv2-base-patch16-ensemble/cpu/cpu/zero-shot-object-detection_fp16_config.json @@ -0,0 +1,74 @@ +{ + "export": { + "opset_version": 17, + "batch_size": 1, + "export_params": true, + "do_constant_folding": true, + "verbose": false, + "dynamo": false, + "enable_hierarchy_tags": true, + "clean_onnx": false, + "hierarchy_tag_format": "full", + "input_tensors": [ + { + "name": "pixel_values", + "dtype": "float32", + "shape": [1, 3, 960, 960], + "value_range": [0, 1] + }, + { + "name": "input_ids", + "dtype": "int32", + "shape": [1, 16], + "value_range": [0, 49408] + }, + { + "name": "attention_mask", + "dtype": "int32", + "shape": [1, 16], + "value_range": [0, 2] + } + ], + "output_tensors": [ + { + "name": "logits" + }, + { + "name": "pred_boxes" + }, + { + "name": "text_embeds" + }, + { + "name": "image_embeds" + } + ] + }, + "optim": {}, + "quant": { + "mode": "fp16", + "samples": 10, + "calibration_method": "minmax", + "weight_type": "uint8", + "activation_type": "uint8", + "per_channel": false, + "symmetric": false, + "weight_symmetric": null, + "activation_symmetric": null, + "save_calibration": false, + "distribution": "uniform", + "seed": null, + "calibration_load_path": null, + "calibration_save_path": null, + "op_types_to_quantize": null, + "nodes_to_exclude": null, + "fp16_keep_io_types": true, + "fp16_op_block_list": null + }, + "compile": null, + "loader": { + "task": "zero-shot-object-detection", + "model_class": "AutoModelForZeroShotObjectDetection", + "model_type": "owlv2" + } +} diff --git a/examples/recipes/google_owlv2-base-patch16-ensemble/cpu/cpu/zero-shot-object-detection_fp32_config.json b/examples/recipes/google_owlv2-base-patch16-ensemble/cpu/cpu/zero-shot-object-detection_fp32_config.json new file mode 100644 index 000000000..811bf77c1 --- /dev/null +++ b/examples/recipes/google_owlv2-base-patch16-ensemble/cpu/cpu/zero-shot-object-detection_fp32_config.json @@ -0,0 +1,55 @@ +{ + "export": { + "opset_version": 17, + "batch_size": 1, + "export_params": true, + "do_constant_folding": true, + "verbose": false, + "dynamo": false, + "enable_hierarchy_tags": true, + "clean_onnx": false, + "hierarchy_tag_format": "full", + "input_tensors": [ + { + "name": "pixel_values", + "dtype": "float32", + "shape": [1, 3, 960, 960], + "value_range": [0, 1] + }, + { + "name": "input_ids", + "dtype": "int32", + "shape": [1, 16], + "value_range": [0, 49408] + }, + { + "name": "attention_mask", + "dtype": "int32", + "shape": [1, 16], + "value_range": [0, 2] + } + ], + "output_tensors": [ + { + "name": "logits" + }, + { + "name": "pred_boxes" + }, + { + "name": "text_embeds" + }, + { + "name": "image_embeds" + } + ] + }, + "optim": {}, + "quant": null, + "compile": null, + "loader": { + "task": "zero-shot-object-detection", + "model_class": "AutoModelForZeroShotObjectDetection", + "model_type": "owlv2" + } +} diff --git a/examples/recipes/google_owlv2-base-patch16-ensemble/dml/gpu/zero-shot-object-detection_fp16_config.json b/examples/recipes/google_owlv2-base-patch16-ensemble/dml/gpu/zero-shot-object-detection_fp16_config.json new file mode 100644 index 000000000..312f5defa --- /dev/null +++ b/examples/recipes/google_owlv2-base-patch16-ensemble/dml/gpu/zero-shot-object-detection_fp16_config.json @@ -0,0 +1,74 @@ +{ + "export": { + "opset_version": 17, + "batch_size": 1, + "export_params": true, + "do_constant_folding": true, + "verbose": false, + "dynamo": false, + "enable_hierarchy_tags": true, + "clean_onnx": false, + "hierarchy_tag_format": "full", + "input_tensors": [ + { + "name": "pixel_values", + "dtype": "float32", + "shape": [1, 3, 960, 960], + "value_range": [0, 1] + }, + { + "name": "input_ids", + "dtype": "int32", + "shape": [1, 16], + "value_range": [0, 49408] + }, + { + "name": "attention_mask", + "dtype": "int32", + "shape": [1, 16], + "value_range": [0, 2] + } + ], + "output_tensors": [ + { + "name": "logits" + }, + { + "name": "pred_boxes" + }, + { + "name": "text_embeds" + }, + { + "name": "image_embeds" + } + ] + }, + "optim": {}, + "quant": { + "mode": "fp16", + "samples": 10, + "calibration_method": "minmax", + "weight_type": "uint8", + "activation_type": "uint8", + "per_channel": false, + "symmetric": false, + "weight_symmetric": null, + "activation_symmetric": null, + "save_calibration": false, + "distribution": "uniform", + "seed": null, + "calibration_load_path": null, + "calibration_save_path": null, + "op_types_to_quantize": null, + "nodes_to_exclude": null, + "fp16_keep_io_types": true, + "fp16_op_block_list": null + }, + "compile": null, + "loader": { + "task": "zero-shot-object-detection", + "model_class": "AutoModelForZeroShotObjectDetection", + "model_type": "owlv2" + } +} diff --git a/examples/recipes/google_owlv2-base-patch16-ensemble/dml/gpu/zero-shot-object-detection_fp32_config.json b/examples/recipes/google_owlv2-base-patch16-ensemble/dml/gpu/zero-shot-object-detection_fp32_config.json new file mode 100644 index 000000000..811bf77c1 --- /dev/null +++ b/examples/recipes/google_owlv2-base-patch16-ensemble/dml/gpu/zero-shot-object-detection_fp32_config.json @@ -0,0 +1,55 @@ +{ + "export": { + "opset_version": 17, + "batch_size": 1, + "export_params": true, + "do_constant_folding": true, + "verbose": false, + "dynamo": false, + "enable_hierarchy_tags": true, + "clean_onnx": false, + "hierarchy_tag_format": "full", + "input_tensors": [ + { + "name": "pixel_values", + "dtype": "float32", + "shape": [1, 3, 960, 960], + "value_range": [0, 1] + }, + { + "name": "input_ids", + "dtype": "int32", + "shape": [1, 16], + "value_range": [0, 49408] + }, + { + "name": "attention_mask", + "dtype": "int32", + "shape": [1, 16], + "value_range": [0, 2] + } + ], + "output_tensors": [ + { + "name": "logits" + }, + { + "name": "pred_boxes" + }, + { + "name": "text_embeds" + }, + { + "name": "image_embeds" + } + ] + }, + "optim": {}, + "quant": null, + "compile": null, + "loader": { + "task": "zero-shot-object-detection", + "model_class": "AutoModelForZeroShotObjectDetection", + "model_type": "owlv2" + } +}