Ejemplo n.º 1
0
    cv2.rectangle(img, c1, c2, color, -1)
    cv2.putText(img, label, (c1[0], c1[1] + t_size[1] + 4),
                cv2.FONT_HERSHEY_PLAIN, 1, [225, 255, 255], 1)

    return img


num_classes = 80
classes = loadClasses("data/coco.names")
confidence = 0.5
nms_thresh = 0.4
dimension = 416

print("loading network")
model = NeuralNet("yolov3.cfg")
model.loadWeights("yolov3.weights")
print("network loaded")

model.networkInfo["height"] = 416
model.cuda()
model.eval()

camera = cv2.VideoCapture(0)

while True:
    ret, frame = camera.read()
    image, orig_im = preprocess(frame, 416)

    image = image.cuda()

    start = time.time()