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