'Cannot load my YOLOv3 model into readNetFromDarknet
So I have trained a YOLOv3 model and want to test the accuracy of the model. I am trying to load the model by using the command 'cv2.dnn.readNetFromDarknet'. Every time I try I receive the error
Traceback (most recent call last):
File "C:\Users\Philip\PycharmProjects\Scriptie\venv\tester.py", line 9, in <module>
net = cv2.dnn.readNetFromDarknet(modelConfiguration, modelWeights)
cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\darknet\darknet_io.cpp:660: error: (-215:Assertion failed) separator_index < line.size() in function 'cv::dnn::darknet::ReadDarknetFromCfgStream'
The python code that I am using is shown below:
import cv2
import numpy as np
import matplotlib.pyplot as pl
classes = ['TEETH']
modelConfiguration = r"C:\Users\Philip\PycharmProjects\Scriptie\venv\yolov3_custom.cfg"
modelWeights = r"C:\Users\Philip\PycharmProjects\Scriptie\venv\yolov3_custom_2000.weights"
net = cv2.dnn.readNetFromDarknet(modelConfiguration, modelWeights)
I have tried changing the paths to absolute paths but it didn't work, anyone that can help me with this?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
