vagheshpatel commited on
Commit
043a007
·
verified ·
1 Parent(s): baa49ed

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