diff --git a/facebook-detr-resnet-50/aitk/README.md b/facebook-detr-resnet-50/aitk/README.md new file mode 100644 index 00000000..3ecf33ae --- /dev/null +++ b/facebook-detr-resnet-50/aitk/README.md @@ -0,0 +1,12 @@ +# detr-resnet-50 Model Optimization + +This repository demonstrates the optimization of the [detr-resnet-50](https://huggingface.co/facebook/detr-resnet-50) model using **post-training quantization (PTQ)** techniques. The optimization process is divided into these workflows: + +- OpenVINO for Intel® NPU + + This process uses OpenVINO specific passes like `OpenVINOOptimumConversion`, `OpenVINOIoUpdate` and `OpenVINOEncapsulation` + +## Intel® Workflows + +These workflows performs quantization with Optimum Intel®. It performs the optimization pipeline: + +- *HuggingFace Model -> Quantized OpenVINO model -> Quantized encapsulated ONNX OpenVINO IR model* diff --git a/facebook-detr-resnet-50/aitk/detr_resnet_50_ov_config.json b/facebook-detr-resnet-50/aitk/detr_resnet_50_ov_config.json new file mode 100644 index 00000000..161de838 --- /dev/null +++ b/facebook-detr-resnet-50/aitk/detr_resnet_50_ov_config.json @@ -0,0 +1,29 @@ +{ + "input_model": { "type": "HfModel", "model_path": "facebook/detr-resnet-50" }, + "systems": { + "local_system": { + "type": "LocalSystem", + "accelerators": [ { "device":"npu","execution_providers": [ "OpenVINOExecutionProvider" ] } ] + } + }, + "passes": { + "optimum_convert": { + "type": "OpenVINOOptimumConversion", + "extra_args": { "device": "npu", "task": "object-detection" }, + "ov_quant_config": { "weight_format": "int8", "group_size": -1, "ratio": 1 } + }, + "io_update": { "type": "OpenVINOIoUpdate", "input_shapes": [ [ 1, 3, 800, 800 ] ], "static": true, "reuse_cache": true }, + "encapsulation": { + "type": "OpenVINOEncapsulation", + "target_device": "npu", + "keep_ov_dynamic_dims": true, + "ov_version": "2025.1", + "reuse_cache": true + } + }, + "search_strategy": false, + "target": "local_system", + "cache_dir": "cache", + "evaluate_input_model": false, + "output_dir": "model/detr_resnet_50" +} diff --git a/facebook-detr-resnet-50/aitk/detr_resnet_50_ov_config.json.config b/facebook-detr-resnet-50/aitk/detr_resnet_50_ov_config.json.config new file mode 100644 index 00000000..d57c255e --- /dev/null +++ b/facebook-detr-resnet-50/aitk/detr_resnet_50_ov_config.json.config @@ -0,0 +1,45 @@ +{ + "name": "Convert to Intel NPU", + "isLLM": false, + "isIntel": true, + "intelRuntimeValues": [ + "npu" + ], + "debugInfo": { + "autoGenerated": true, + "useOpenVINOOptimumConversion": "optimum_convert" + }, + "addCpu": false, + "runtime": { + "autoGenerated": true, + "name": "Evaluate on", + "type": "enum", + "displayNames": [ + "Intel NPU" + ], + "path": "systems.local_system.accelerators.0.device", + "values": [ + "npu" + ], + "readOnly": false + }, + "sections": [ + { + "autoGenerated": true, + "name": "Convert", + "phase": "Conversion", + "parameters": [], + "toggle": { + "autoGenerated": true, + "name": "Convert to ONNX format", + "type": "bool", + "path": "passes.optimum_convert", + "actions": [ + [], + [] + ], + "readOnly": true + } + } + ] +} diff --git a/facebook-detr-resnet-50/aitk/info.yml b/facebook-detr-resnet-50/aitk/info.yml new file mode 100644 index 00000000..afe78d94 --- /dev/null +++ b/facebook-detr-resnet-50/aitk/info.yml @@ -0,0 +1,12 @@ +keywords: + aitk +arch: detr +recipes: + - file: "detr_resnet_50_ov_config.json" + devices: + - npu + ep: OpenVINOExecutionProvider +aitk: + modelInfo: + id: "huggingface/facebook/detr-resnet-50" + version: 1 diff --git a/facebook-detr-resnet-50/aitk/model_project.config b/facebook-detr-resnet-50/aitk/model_project.config new file mode 100644 index 00000000..e9772099 --- /dev/null +++ b/facebook-detr-resnet-50/aitk/model_project.config @@ -0,0 +1,12 @@ +{ + "workflows": [ + { + "file": "detr_resnet_50_ov_config.json", + "templateName": "detr_resnet_50_ov_config" + } + ], + "modelInfo": { + "id": "huggingface/facebook/detr-resnet-50", + "version": 1 + } +} diff --git a/facebook-detr-resnet-50/aitk/requirements.txt b/facebook-detr-resnet-50/aitk/requirements.txt new file mode 100644 index 00000000..ec51ceed --- /dev/null +++ b/facebook-detr-resnet-50/aitk/requirements.txt @@ -0,0 +1,3 @@ +# This file will be installed together with AITK runtime requirements +# For the full requirements, see AITK +datasets