File size: 632 Bytes
b452cdf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# Sample inference script
from ultralytics import YOLO
import json
# Load configuration
with open('config.json', 'r') as f:
config = json.load(f)
# Load model
model = YOLO('model.pt')
# Run inference with config parameters
results = model(
'your_image.jpg',
conf=config['confidence_threshold'],
iou=config['iou_threshold'],
imgsz=config['input_size']
)
# Process results
for result in results:
for box in result.boxes:
class_id = int(box.cls)
class_name = config['id2label'][str(class_id)]
confidence = float(box.conf)
print(f"Detected: {class_name} ({confidence:.2%})")
|