Cv2 error drarknet error i think, code not compiling

Hey guys im trying to learn some computer vision but im stuck with errors that ive spent a great amount of hours and cant seem to find a solution, hope you can help me out here. thanks

some details
Im using windows as its the only thing ive got
im using Microsoft visual studio code
Im using python version 3.11.0

here is the code

import cv2
import cvlib as cv
from cvlib.object_detection import draw_bbox
from gtts import gTTS
from playsound import playsound


video = cv2.VideoCapture(1)

while True:
    ret, frame = video.read()
    bbox, label, conf = cv.detect_common_objects(frame)
    output_image = draw_bbox(frame, bbox, label, conf)

    cv2.imshow("object detection", output_image)

    if cv2.waitKey(1) & 0xFF == ord("q"):
        break

Here is the terminal output

 [INFO] [DSH]  python.exe
 [INFO] [DSH]  Creating WndMsg Listener Window
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Performing initializing sequence
 [INFO] [DSH]  Get MessageBus interface succeeded
 [WARN] [DSH]  MessageBus perform initialize in progress
 [WARN] [DSH]  MessageBus perform start in progress
 [INFO] [MBHB] Updating MB Status
 [INFO] [MBHB] Previous marked bus status : Reserved : 0 | Core : 0 | NvContainer Plugin : 0 | DShow Filter : 0 | Camera UI Backend : 0 | Audio UI Backend : 0 | 
 [INFO] [MBHB] Bus connected. (5) peers connected : Audio UI Backend, Core, DShow Filter, NvContainer Plugin, Camera UI Backend
 [INFO] [MBHB] Marked joined / connected for module (1) Core
 [INFO] [MBHB] Marked joined / connected for module (2) NvContainer Plugin
 [INFO] [MBHB] Marked joined / connected for module (3) DShow Filter
 [INFO] [DSH]  Self joined the MessageBus
 [INFO] [MBHB] Marked joined / connected for module (4) Camera UI Backend
 [INFO] [MBHB] Marked joined / connected for module (5) Audio UI Backend
 [INFO] [DSH]  Request to get container state
 [INFO] [MBHB] Updated marked bus status  : Reserved : 0 | Core : 1 | NvContainer Plugin : 1 | DShow Filter : 1 | Camera UI Backend : 1 | Audio UI Backend : 1 |
 [INFO] [DSH]  Successfully fetched the GPU details
 [INFO] [DSH]  Released Adapter
 [INFO] [DSH]  Found matching GPU for CUDA and D3D
 [INFO] [DSH]  Chosen GPU for D3D: (1) NVIDIA GeForce RTX 4080 Laptop GPU : 81920, 0
 [INFO] [DSH]  Request to start core exe
 [INFO] [DSH]  Core reported already running -- Verifying
 [INFO] [DSH]  Verified core exe started
 [INFO] [DSH]  Request to wait for core launch init
 [INFO] [DSH]  Core launch init is done
 [INFO] [DSH]  Request to post cmd for core init
 [INFO] [DSH]  Core initializing now
 [INFO] [DSH]  Initializing streaming output
 [INFO] [DSH]  Request query output resolution
 [INFO] [DSH]  Querying stream output successful. Params: 1280x720@30/1
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  fmt:2 bpp:24 :640x480
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  Requested to perform initializing sequence
 [INFO] [DSH]  Already initialized
 [INFO] [DSH]  On Thread Create
 [INFO] [DSH]  Request to start core exe
 [INFO] [DSH]  Core reported already running -- Verifying
 [INFO] [DSH]  Verified core exe started
 [INFO] [DSH]  Request core to start streaming
 [INFO] [DSH]  Fill buffer started
 [INFO] [DSH]  Initializing image blit data
 [INFO] [DSH]  jpeg exif orientation property not found
 [INFO] [DSH]  image size acquired successfully. src: 1920x1080
 [INFO] [DSH]  image scaler initialized successfully. dst: 1280x720
 [INFO] [DSH]  Flip/Rotation Options: 16
 [INFO] [DSH]  flip rotator initialized successfully
 [INFO] [DSH]  Successfully copied image pixels
 [INFO] [DSH]  Verify core stream readiness before the first frame (sh)
 [INFO] [UIB]  Request to wait for core output stream readiness
 [INFO] [UIB]  Core output stream is ready
 [INFO] [DSH]  Request query surf
Traceback (most recent call last):
  File "c:\Users\emile\OneDrive\Desktop\Projects\Python\Test.py", line 13, in <module>
    bbox, label, conf = cv.detect_common_objects(frame)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\emile\pyproj\my_env2\Lib\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.9.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\darknet\darknet_io.cpp:705: error: (-215:Assertion failed) separator_index < line.size() in function 'cv::dnn::darknet::ReadDarknetFromCfgStream'

 [INFO] [DSH]  On Destroy Create
 [INFO] [DSH]  Request core to stop streaming
 [WARN] [DSH]  MessageBus perform stop in progress
 [INFO] [MBHB] Force marking all NBX MB modules as disconnected
 [INFO] [MBHB] Previous marked bus status : Reserved : 0 | Core : 1 | NvContainer Plugin : 1 | DShow Filter : 1 | Camera UI Backend : 1 | Audio UI Backend : 1 |
 [INFO] [MBHB] Marked left / disconnected for module (0) Reserved
 [INFO] [MBHB] Marked left / disconnected for module (1) Core
 [INFO] [MBHB] Marked left / disconnected for module (2) NvContainer Plugin
 [INFO] [MBHB] Marked left / disconnected for module (3) DShow Filter
 [INFO] [MBHB] Marked left / disconnected for module (4) Camera UI Backend
 [INFO] [MBHB] Marked left / disconnected for module (5) Audio UI Backend
 [INFO] [MBHB] Updated marked bus status  : Reserved : 0 | Core : 0 | NvContainer Plugin : 0 | DShow Filter : 0 | Camera UI Backend : 0 | Audio UI Backend : 0 |
 [INFO] [DSH]  Destroying parent object
 [INFO] [DSH]  Destroying D3D SH Object
 [INFO] [DSH]  Released FiltShSurf
 [INFO] [DSH]  Released FiltStgRes
 [INFO] [DSH]  Released ImmCtx
 [INFO] [DSH]  Released D3D Device
 [INFO] [DSH]  Released Adapter
 [INFO] [DSH]  Released DXGI Factory
 [INFO] [DSH]  Destroying WndMsg Listener Window
 [INFO] [DSH]  Destroyed window
 [INFO] [DSH]  Unregistered window class

you try to load a broken cfg file (dl error ? truncated ? edited ?)
please check it against the website contents

please also note, that we cannot help much with 3rd party code like cvlib.

1 Like