Skip to content

My CPU loaded on 89% but GPU not used #805

@koljanich

Description

@koljanich

Hello! I try to use yolov3.pt tiny-yolov3.pt and retinanet_resnet50_fpn_coco-eeacb38b.pth. But result is same. CPU Usage 89%, GPU on minimal 18%. I use 1660 Super GPU from NVIDIA. Script:
`# -- coding: utf-8 --
import cv2
import os
from imageai.Detection import ObjectDetection

camera = cv2.VideoCapture(1)
execution_path = os.getcwd()

detector = ObjectDetection()
detector.setModelTypeAsTinyYOLOv3()
detector.setModelPath(os.path.join(execution_path, "tiny-yolov3.pt"))
detector.loadModel()

while True:

ret, frame = camera.read()


detections = detector.detectObjectsFromImage(input_image=frame)


for detection in detections:
    print(detection["name"], " : ", detection["percentage_probability"])
    print(detection["box_points"])
    cv2.rectangle(frame, detection["box_points"][0:2], detection["box_points"][2:4], (0, 255, 0), 2)
    cv2.putText(frame, detection["name"], (detection["box_points"][0], detection["box_points"][1] - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 255, 0), 2)

cv2.imshow("Frame", frame)
key = cv2.waitKey(1) & 0xFF


if key == ord("q"):
    break

camera.release()
cv2.destroyAllWindows()`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions