Closed joaopalma5 closed 5 years ago
Did you set the number of anchors to 6?. Tiny yolo uses 6 anchors instead of 9 anchors in case of normal Yolo here
I have set it to 6 and yet i get the error !, how can i resolve this?
Though i tried anchor values to be 6 and 9 still it is not working, the same error is being show ...kindly help me out @tahaemara
Hi, if you are using mac I found that if you use the textEdit.app, it adds a few lines at the top(you can't see them unless you use another editor) that are causing an issue, simply remove them and it will be fine.
I have set following in yolov3-tiny.cfg
[yolo] mask = 3,4,5 anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319 classes=4 num=6 jitter=.3 ignore_thresh = .7 truth_thresh = 1 random=1
[yolo] mask = 0,1,2 anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319 classes=4 num=6 jitter=.3 ignore_thresh = .7 truth_thresh = 1 random=1
still I get the error:
Traceback (most recent call last):
File "yolo_opencv.py", line 49, in
I have also checked whether any extra line is added. I am on Ubuntu 16.04 Suggest me what shall I do next?
Though i tried anchor values to be 6 and 9 still it is not working, the same error is being show ...kindly help me out @tahaemara
Did you able to solve the problem?
Did you set the number of anchors to 6?. Tiny yolo uses 6 anchors instead of 9 anchors in case of normal Yolo here
This issue shall be reopened.
I have the same problem
net = cv2.dnn.readNetFromDarknet(_net_weights_path, _net_cfg_path) cv2.error: OpenCV(3.4.2) /opt/concourse/worker/volumes/live/9523d527-1b9e-48e0-7ed0-a36adde286f0/volume/opencv-suite_1535558719691/work/modules/dnn/src/darknet/darknet_io.cpp:511: error: (-215:Assertion failed) separator_index < line.size() in function 'ReadDarknetFromCfgFile'
Have any idea?
Please tell me more
@gmatesunny did you check what I said before, do that if you are using mac
@gmatesunny did you check what I said before, do that if you are using mac
HI. I am using Mac and I have checked your suggestion but i can not see the xtra lines.
I have run my program on Vstudio
Another suggestion ?
@ADLTU : I checked and it doesn't have extra lines. I am using vscode as editor.
Please do this and send a screenshot.
Hi.
I am using the yolov3.cfg
Hi it won’t appear there, I had the same problem open the file in terminal and you’ll see.
Hadi On Wed, 8 Jan 2020 at 19:40, DocGrenas notifications@github.com wrote:
Hi.
I am using the yolov3.cfg
[image: Screen Shot 2020-01-08 at 1 38 38 PM] https://user-images.githubusercontent.com/59627002/72009887-600a9200-321c-11ea-9b20-fe0a7e4f0772.png
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tahaemara/yolo-custom-object-detector/issues/1?email_source=notifications&email_token=AIDB4NK4YSFKN5COW5M7WN3Q4YTZVA5CNFSM4GOOIKB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEINXJSI#issuecomment-572224713, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIDB4NKTU3DUV2NFSLFUJ3TQ4YTZVANCNFSM4GOOIKBQ .
@DocGrenas Facing the exact same problem as this:
net = cv2.dnn.readNetFromDarknet(_net_weights_path, _net_cfg_path) cv2.error: OpenCV(3.4.2) /opt/concourse/worker/volumes/live/9523d527-1b9e-48e0-7ed0-a36adde286f0/volume/opencv-suite_1535558719691/work/modules/dnn/src/darknet/darknet_io.cpp:511: error: (-215:Assertion failed) separator_index < line.size() in function 'ReadDarknetFromCfgFile'
Have you managed to solve it? Thanks!
net = cv2.dnn.readNetFromDarknet("/home/babu/darknet/cfg/yolov3-tiny.cfg","/home/babu/darknet/yolov3-tiny.weights")
img = cv2.imread("/home/babu/darknet/data/dog.jpg")
@MorshedBabu
Use absolute path, it would work. For example,
For Loading Yolo
net = cv2.dnn.readNetFromDarknet("/home/babu/darknet/cfg/yolov3-tiny.cfg","/home/babu/darknet/yolov3-tiny.weights")
For Loading image
img = cv2.imread("/home/babu/darknet/data/dog.jpg")
I get this
Failed to parse NetParameter file: ~/docker/tiny_yolo_dark/yolov2-tiny.cfg in function 'readNetFromDarknet'
Use absolute path, it would work. For example,
For Loading Yolo
net = cv2.dnn.readNetFromDarknet("/home/babu/darknet/cfg/yolov3-tiny.cfg","/home/babu/darknet/yolov3-tiny.weights")
For Loading image
img = cv2.imread("/home/babu/darknet/data/dog.jpg")
I did this but still getting the same error...
config_path = '/home/rozer/dev/ML Projects/YOLO_Object_Detection/yolov3.cfg'
weight_path = '/home/rozer/dev/ML Projects/YOLO_Object_Detection/yolov3.weights'
net = cv2.dnn.readNetFromDarknet(config_path, weight_path)
cv2.error: OpenCV(4.4.0) /tmp/pip-install-t2n0bol9/opencv-python/opencv/modules/dnn/src/darknet/darknet_io.cpp:628: error: (-215:Assertion failed) separator_index < line.size() in function 'ReadDarknetFromCfgStream'
I tried all above steps, but nothing worked, can anyone help me with this... Thank You!
Try using this yolov3.cfg file. You will have to unzip it first.
Try using this yolov3.cfg file. You will have to unzip it first.
Thank You it works
Even i'm getting same error while performing prediction on trained YOLOv3 Tiny. I i have checked number of anchor are 6 only.
Could someone help me on this please .
I have trained model in my virtual machine Ubuntu 20.04
Command darknet$ python3 yolo_opencv.py -c /home/ai/darknet/training/yolov3-tiny.cfg -w /home/ai/darknet/backup/yolov3-tiny_60000.weights -cl /home/ai/darknet/training/objects.names
Error
Traceback (most recent call last):
File "yolo_opencv.py", line 47, in
Try with this yolov3-tiny.cfg file: yolov3-tiny.zip
Thannks @fadeos your cfg file worked...for me... i read the original cfg file downloaded from darknet website and it was a html file.....
Great! I hope you can move on and complete your project.
the Original file that is on pjreddie's repo has been corrupted, please refer this one yolov3.cfg.
Just check up your .cfg file carefully. In my case, I accidentally removed # before word Testing. When transfer configuration file from training mode to testing one, we can do very simple error inadvertently.
I get the same error but I am using yolov4 model. Any suggestions please?
I had the same issue and even trying with the new .cfg file did not work. Have a look at the order of the argument You are providing!
OpenCv in its documentation states that the order of model and config arguments does not matter, HOWEVER in my case it did matter. First config file and then weights (for DarkNet).
This works for me: Net net = readNetFromDarknet(modelConf, modelWeig);
I think this is due to a few #
in the cfg file that you need to remove,
and try again,
it worked for me.
I think the problem is that some of us are downloading the "PAGE OF FILE". not the file itself! I mean, for downloading the cfg file, don't use this link: https://github.com/pjreddie/darknet/blob/master/cfg/yolov3.cfg Instead, use this link (The exact same file. but its file address. not page address): https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/yolov3.cfg Hope it works for you.
Try with this yolov3-tiny.cfg file: yolov3-tiny.zip
ya that error gone but a new error came
cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\darknet\darknet_io.cpp:933: error: (-213:The function/feature is not implemented) Transpose the weights (except for convolutional) is not implemented in function 'cv::dnn::darknet::ReadDarknetFromWeightsStream'
Hi ,
I tried this method and this solved my problem but I want to talk about another solution. Configs are not broken. This is my idea. Just change your anchors from from your .cfg file. I put COCO anchors from yolov3-tiny.cfg to my cfg and it worked for me. You can try this options:
Try with this yolov3-tiny.cfg file: yolov3-tiny.zip
python3 yolo_opencv.py -c custom/yolov3-tiny.cfg -w backup/yolov3-tiny_120000.weights -cl custom/objects.names ['bola'] Traceback (most recent call last): File "yolo_opencv.py", line 47, in
net = cv2.dnn.readNet(args.weights,args.config)
cv2.error: OpenCV(3.4.5) /io/opencv/modules/dnn/src/darknet/darknet_io.cpp:507: error: (-215:Assertion failed) separator_index < line.size() in function 'ReadDarknetFromCfgStream'
I have this error on try your code... In darknet we can Run inference, and get results. You know the reason?