vagheshpatel commited on
Commit
4b1d2b9
·
verified ·
1 Parent(s): 64f1534

Sync catalog updates from GitHub (ec63768)

Browse files
Files changed (2) hide show
  1. README.md +1 -0
  2. export_and_quantize.sh +7 -2
README.md CHANGED
@@ -101,6 +101,7 @@ source .venv/bin/activate
101
  Run the provided script to download, export to OpenVINO IR, and optionally quantize:
102
 
103
  ```bash
 
104
  chmod +x export_and_quantize.sh
105
  ./export_and_quantize.sh
106
  ```
 
101
  Run the provided script to download, export to OpenVINO IR, and optionally quantize:
102
 
103
  ```bash
104
+ wget https://huggingface.co/Intel/perimeter-breach-detection/resolve/main/export_and_quantize.sh
105
  chmod +x export_and_quantize.sh
106
  ./export_and_quantize.sh
107
  ```
export_and_quantize.sh CHANGED
@@ -124,13 +124,18 @@ from pathlib import Path
124
  import openvino as ov
125
  import torch
126
  import yaml
127
- from transformers import DetrForObjectDetection
128
 
129
  model_name, half_flag, size = sys.argv[1], sys.argv[2] == "True", int(sys.argv[3])
130
  model_id = f"facebook/{model_name}"
131
 
132
  # The "no_timm" revision uses the transformers ResNet backbone (no timm dependency).
133
- detr = DetrForObjectDetection.from_pretrained(model_id, revision="no_timm").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).
 
124
  import openvino as ov
125
  import torch
126
  import yaml
127
+ from transformers import DetrConfig, DetrForObjectDetection
128
 
129
  model_name, half_flag, size = sys.argv[1], sys.argv[2] == "True", int(sys.argv[3])
130
  model_id = f"facebook/{model_name}"
131
 
132
  # The "no_timm" revision uses the transformers ResNet backbone (no timm dependency).
133
+ config_dict, _ = DetrConfig.get_config_dict(model_id, revision="no_timm")
134
+ # Older no_timm configs serialize the standard non-dilated backbone as null.
135
+ if config_dict.get("dilation") is None:
136
+ config_dict["dilation"] = False
137
+ config = DetrConfig.from_dict(config_dict)
138
+ detr = DetrForObjectDetection.from_pretrained(model_id, revision="no_timm", config=config).eval()
139
  id2label = detr.config.id2label
140
  # DETR predicts 91 COCO category ids (with "N/A" gaps) plus a no-object class.
141
  # Keep the 80 real categories so class ids match YOLO26 (person = 0).