Sync catalog updates from GitHub (ec63768)
Browse files- README.md +1 -0
- export_and_quantize.sh +7 -2
README.md
CHANGED
|
@@ -110,6 +110,7 @@ source .venv/bin/activate
|
|
| 110 |
Run the provided script to download, export to OpenVINO IR, and optionally quantize:
|
| 111 |
|
| 112 |
```bash
|
|
|
|
| 113 |
chmod +x export_and_quantize.sh
|
| 114 |
./export_and_quantize.sh
|
| 115 |
```
|
|
|
|
| 110 |
Run the provided script to download, export to OpenVINO IR, and optionally quantize:
|
| 111 |
|
| 112 |
```bash
|
| 113 |
+
wget https://huggingface.co/Intel/heatmap-generation/resolve/main/export_and_quantize.sh
|
| 114 |
chmod +x export_and_quantize.sh
|
| 115 |
./export_and_quantize.sh
|
| 116 |
```
|
export_and_quantize.sh
CHANGED
|
@@ -119,13 +119,18 @@ from pathlib import Path
|
|
| 119 |
import openvino as ov
|
| 120 |
import torch
|
| 121 |
import yaml
|
| 122 |
-
from transformers import DetrForObjectDetection
|
| 123 |
|
| 124 |
model_name, half_flag, size = sys.argv[1], sys.argv[2] == "True", int(sys.argv[3])
|
| 125 |
model_id = f"facebook/{model_name}"
|
| 126 |
|
| 127 |
# The "no_timm" revision uses the transformers ResNet backbone (no timm dependency).
|
| 128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
id2label = detr.config.id2label
|
| 130 |
# DETR predicts 91 COCO category ids (with "N/A" gaps) plus a no-object class.
|
| 131 |
# Keep the 80 real categories so class ids match YOLO26 (person = 0).
|
|
|
|
| 119 |
import openvino as ov
|
| 120 |
import torch
|
| 121 |
import yaml
|
| 122 |
+
from transformers import DetrConfig, DetrForObjectDetection
|
| 123 |
|
| 124 |
model_name, half_flag, size = sys.argv[1], sys.argv[2] == "True", int(sys.argv[3])
|
| 125 |
model_id = f"facebook/{model_name}"
|
| 126 |
|
| 127 |
# The "no_timm" revision uses the transformers ResNet backbone (no timm dependency).
|
| 128 |
+
config_dict, _ = DetrConfig.get_config_dict(model_id, revision="no_timm")
|
| 129 |
+
# Older no_timm configs serialize the standard non-dilated backbone as null.
|
| 130 |
+
if config_dict.get("dilation") is None:
|
| 131 |
+
config_dict["dilation"] = False
|
| 132 |
+
config = DetrConfig.from_dict(config_dict)
|
| 133 |
+
detr = DetrForObjectDetection.from_pretrained(model_id, revision="no_timm", config=config).eval()
|
| 134 |
id2label = detr.config.id2label
|
| 135 |
# DETR predicts 91 COCO category ids (with "N/A" gaps) plus a no-object class.
|
| 136 |
# Keep the 80 real categories so class ids match YOLO26 (person = 0).
|