Sync catalog updates from GitHub (ec63768)
Browse files- README.md +1 -0
- export_and_quantize.sh +7 -2
README.md
CHANGED
|
@@ -104,6 +104,7 @@ source .venv/bin/activate
|
|
| 104 |
Run the provided script to download, export to OpenVINO IR, and optionally quantize:
|
| 105 |
|
| 106 |
```bash
|
|
|
|
| 107 |
chmod +x export_and_quantize.sh
|
| 108 |
./export_and_quantize.sh
|
| 109 |
```
|
|
|
|
| 104 |
Run the provided script to download, export to OpenVINO IR, and optionally quantize:
|
| 105 |
|
| 106 |
```bash
|
| 107 |
+
wget https://huggingface.co/Intel/object-counting/resolve/main/export_and_quantize.sh
|
| 108 |
chmod +x export_and_quantize.sh
|
| 109 |
./export_and_quantize.sh
|
| 110 |
```
|
export_and_quantize.sh
CHANGED
|
@@ -131,13 +131,18 @@ from pathlib import Path
|
|
| 131 |
import openvino as ov
|
| 132 |
import torch
|
| 133 |
import yaml
|
| 134 |
-
from transformers import DetrForObjectDetection
|
| 135 |
|
| 136 |
model_name, half_flag, size = sys.argv[1], sys.argv[2] == "True", int(sys.argv[3])
|
| 137 |
model_id = f"facebook/{model_name}"
|
| 138 |
|
| 139 |
# The "no_timm" revision uses the transformers ResNet backbone (no timm dependency).
|
| 140 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 141 |
id2label = detr.config.id2label
|
| 142 |
# DETR predicts 91 COCO category ids (with "N/A" gaps) plus a no-object class.
|
| 143 |
# Keep the 80 real categories so class ids match YOLO26 (person = 0).
|
|
|
|
| 131 |
import openvino as ov
|
| 132 |
import torch
|
| 133 |
import yaml
|
| 134 |
+
from transformers import DetrConfig, DetrForObjectDetection
|
| 135 |
|
| 136 |
model_name, half_flag, size = sys.argv[1], sys.argv[2] == "True", int(sys.argv[3])
|
| 137 |
model_id = f"facebook/{model_name}"
|
| 138 |
|
| 139 |
# The "no_timm" revision uses the transformers ResNet backbone (no timm dependency).
|
| 140 |
+
config_dict, _ = DetrConfig.get_config_dict(model_id, revision="no_timm")
|
| 141 |
+
# Older no_timm configs serialize the standard non-dilated backbone as null.
|
| 142 |
+
if config_dict.get("dilation") is None:
|
| 143 |
+
config_dict["dilation"] = False
|
| 144 |
+
config = DetrConfig.from_dict(config_dict)
|
| 145 |
+
detr = DetrForObjectDetection.from_pretrained(model_id, revision="no_timm", config=config).eval()
|
| 146 |
id2label = detr.config.id2label
|
| 147 |
# DETR predicts 91 COCO category ids (with "N/A" gaps) plus a no-object class.
|
| 148 |
# Keep the 80 real categories so class ids match YOLO26 (person = 0).
|