Error: OpenCV(4.8.0) /io/opencv/modules/dnn/src/darknet/darknet_io.cpp:660: error: (-215:Assertion failed) separator_index < line.size() in function 'ReadDarknetFromCfgStream'

error usually means, that the .cfg file for your darknet model is broken

unfortunately, your code snippet is useless here (as it’s incomplete, not reproducable, noone here knows what ‘cv’ is)

please:

  • check the .cfg file used, show us.
  • link us to where you copypasted that code & got that model