Ejemplo n.º 1
0

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()
    output = model(Variable(image))

    output = write_results(output,
                           confidence,
                           num_classes,