31 lines
633 B
Python
31 lines
633 B
Python
#!/usr/bin/env python3
|
|
import cv2
|
|
import numpy as np
|
|
from ultralytics import YOLO
|
|
from paths import *
|
|
|
|
|
|
def main():
|
|
model = YOLO(model_path)
|
|
|
|
# Load image
|
|
image = cv2.imread(img_path)
|
|
if image is None:
|
|
print(f"Failed to read {img_path}")
|
|
return
|
|
|
|
height, width = image.shape[:2]
|
|
|
|
warped = image # For now assume top-down view
|
|
|
|
# Run YOLO detection
|
|
results = model(warped)
|
|
res = results[0]
|
|
|
|
debug_img = res.plot() # draws boxes around detected objects
|
|
cv2.imshow("Detections", debug_img)
|
|
cv2.waitKey(0)
|
|
cv2.destroyAllWindows()
|
|
|
|
if __name__ == "__main__":
|
|
main() |