[Python] error: (-215:Assertion failed) separator_index < line.size() in function...

Discussão em 'Python' iniciado por Stack, Setembro 27, 2024.

  1. Stack

    Stack Membro Participativo

    I am getting this error while running the code for object detection

    File "/Users/adarsh/DEV/PycharmProjects/CMS/camera.py", line 22, in record
    bbox, labels, conf = cvlib.detect_common_objects(frame)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/adarsh/DEV/PycharmProjects/CMS/.venv/lib/python3.12/site-packages/cvlib/object_detection.py", line 125, in detect_common_objects
    net = cv2.dnn.readNet(weights_file_abs_path, config_file_abs_path)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    cv2.error: OpenCV(4.10.0) /Users/runner/work/opencv-python/opencv-python/opencv/modules/dnn/src/darknet/darknet_io.cpp:705: error: (-215:Assertion failed) separator_index < line.size() in function 'ReadDarknetFromCfgStream'


    Following is the code

    cap = cv2.VideoCapture(0)

    items = []
    while cap.isOpened():
    ret, frame = cap.read()

    bbox, labels, conf = cvlib.detect_common_objects(frame)
    output = draw_bbox(frame, bbox, labels, conf)
    cv2.imshow('LIVE FOOTAGE', output)

    for label in labels:
    if label in items:
    pass
    else:
    items.append(label)

    if cv2.waitKey(1) == ord('q'):
    break


    I have tried restarting the computer as someone said it might be a kernel issue, but that did not work for me.

    Continue reading...

Compartilhe esta Página