inference.py
Opened this issue · 0 comments
image 1/1 /path/train_275.png: 640x640 1 eye, 109.0ms
Speed: 4.5ms preprocess, 109.0ms inference, 749.6ms postprocess per image at shape (1, 3, 640, 640)
when i run the inference code i get the above
below is my code
from ultralytics import YOLO
import cv2
model_path = '/weights/last.pt'
image_path = '/test/train_275.png'
img = cv2.imread(image_path)
model = YOLO(model_path)
results = model(image_path)[0]
for result in results:
for keypoint_indx, keypoint in enumerate(result.keypoints.data.tolist()[0]):
for keypoint_indx, keypoint in enumerate(result.keypoints.tolist()):
cv2.putText(img, str(keypoint_indx), (int(keypoint[0]), int(keypoint[1])),
cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)
cv2.imshow('img', img)
cv2.waitKey(0)
but im unable to view the image this happens on video feed as well, the webcam light powers on but the feed does not show why is the image not being shown?
i have tested the video feed to check if it's any dependency issue as below which works well
import cv2
def main():
cap = cv2.VideoCapture(0)
if not cap.isOpened():
print("Error: Could not open camera")
return
while cap.isOpened():
ret, frame = cap.read()
if ret:
cv2.imshow('frame', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
cap.release()
cv2.destroyAllWindows()
if name == "main":
main()