data/coco.names
unable to open coco.names file if there is any solution for it then resolve this please.
When I execute the following command, I have the same problem. ./darknet detect cfg/yolov3.cfg weight/yolov3.weights data/dog.jpg Couldn't open file: data/coco.names
Did anyone find out the solution to this problem?
At first I also encountered this problem. But, I download the darknet again, compiled, there is no this problem.
maybe because of line break.I download zip file,and unzip,compile(on windows). there is no this problem.
Thank you. Downloading zip file solved this problem
Thank you. Downloading zip file solved this problem
What is the zip file? I have met the same question.
I happened to have same problem but the cause was that I prepared cfg/obj.data on windows machine but was run on linux machine.
When I converted file
dos2unix cfg/obj.data
everything started to work
I am facing the same issue:
Couldn't open file: /data/coco.names
I did even download the zipped file again but facing the same error. Could you please help
Hello, This problem can be solved by changing the path of coco.names file in coco.data file.
classes= 80 train = /home/pjreddie/data/coco/trainvalno5k.txt valid = coco_testdev #valid = data/coco_val_5k.list names = ../data/coco.names backup = /home/pjreddie/backup/ eval=coco
Thanks
I use Windows Subsystem For Linux on Windows 10. In my case I cloned repo in Windows but tried to run darknet in Linux. It fails due to different format of line endings (CRLF in Win and LF in Linux).
So I just forcibly checked out it again in bash: git checkout --force. Be warned that this will revert your config changes if any.
hi guys you should download zip file or immediately use git clone in ubuntu os . You shouldn't paste the file from windows to ubuntu os,for the file will become txt file.
hi guys you should download zip file or immediately use git clone in ubuntu os . You shouldn't paste the file from windows to ubuntu os,for the file will become txt file.
I copy the project from windows to ubuntu os, then this question occured!Change the the path of coco.names file can not solve it. But use git clone in ubuntu os without this problem!So weird!
@tuuzhang, follow instruction from @himanshu9345, edit the coco.data files. you will find the names variable that you need to change.
change it to your coco.names folder and file exists in my case: names= D:/core/darknetAB/data/coco.names
@wahyubram82 ok, got it, thanks for your reply!
You can bring darknet.py in darknet/python into directory darknet/ to solve it. Before, you changed absolute path for libdarknet.so, load_net, load_meta, detect (also add b"path")
This solution worked for me: https://github.com/pjreddie/darknet/issues/147#issue-251128346
If you are using Windows, the dos2unix.exe is found in your Git's directory: usr/bin Run that dos2unix.exe in cmd and use it to convert the files in the link I attached.
Then, go to darknet folder, delete the darknet.exe and run the command make again (in what ever way you did this). This generates a new darknet.exe file
Open cmd as administrator, then put the following command:
C:\[directory of your darknet folder]> .\darknet.exe detect cfg/yolov3.cfg yolov3.weights data/dog.jpg
Hello, This problem can be solved by changing the path of coco.names file in coco.data file.
classes= 80 train = /home/pjreddie/data/coco/trainvalno5k.txt valid = coco_testdev #valid = data/coco_val_5k.list names = ../data/coco.names backup = /home/pjreddie/backup/ eval=cocoThanks
That really makes sense.
I happened to have same problem but the cause was that I prepared cfg/obj.data on windows machine but was run on linux machine.
When I converted file
dos2unix cfg/obj.dataeverything started to work
Can do this
dos2unix cfg/coco.data
dos2unix data/coco.names
That really makes sense.
I have solved this issue as below: 1: cd to "darknet" folder. >> cd darknet 2. allow full permission for all file in the darknet folder. >> sudo chmod -R 777 *
Hope this help.
Git clone it in ubuntu os. This question will not occur.
Hello, This problem can be solved by changing the path of coco.names file in coco.data file.
classes= 80 train = /home/pjreddie/data/coco/trainvalno5k.txt valid = coco_testdev #valid = data/coco_val_5k.list names = ../data/coco.names backup = /home/pjreddie/backup/ eval=cocoThanks
For me, this file was inside /darknet/cfg/coco.data instead of the path listed above. It seems that pjreddie's personal path is harcoded into the coco.data file (or maybe I made a mistake somewhere). Changing it through this directory solved the problem for me.
The reason for that is the path to coco.names is not mentioned in the misc.py file.
In your darkflow directory, navigate to the following file:
\darkflow\darkflow\net\yolo\misc.py
You can open and edit the .py file with IDLE

Change the file path. Save the misc.py and run your program again!
Hello, This problem can be solved by changing the path of coco.names file in coco.data file.
classes= 80 train = /home/pjreddie/data/coco/trainvalno5k.txt valid = coco_testdev #valid = data/coco_val_5k.list names = ../data/coco.names backup = /home/pjreddie/backup/ eval=cocoThanks
Even with these modifications I still get the same error "Couldn't open file: ../data/coco.names"
Nevermind, my project directory had spaces, so this was solved by removing them 😛
I had the same issue as to OP for FreeBSD. I have compiled a GitHub project which implements darknet yolo for AMD GPUs: https://github.com/sowson/darknet
Which is a fork for this repo.
I followed the solution provided from: himanshu9345
In which I appended the ../ prefix notation at the beginning for: names = data/coco.names.
I edited the coco.data file located at:
/usr/home/user/darknet/cfg/coco.data
From:
classes= 80
train = /home/pjreddie/data/coco/trainvalno5k.txt
valid = coco_testdev
#valid = data/coco_val_5k.list
names = data/coco.names
backup = /home/pjreddie/backup/
eval=coco
To:
classes= 80
train = /home/pjreddie/data/coco/trainvalno5k.txt
valid = coco_testdev
#valid = data/coco_val_5k.list
names = ../data/coco.names
backup = /home/pjreddie/backup/
eval=coco
Would also like to point out that for me, I need to provide full paths when running darknet for the .data, .cfg, .weights and .jpg files:
$ ./darknet detect /usr/home/user/darknet/cfg/coco.data /usr/home/user/darknet/cfg/yolov3.cfg /usr/home/user/darknet/weights/yolov3.weights /home/user/darknet/data/dog.jpg
If I do not use full paths, I get errors.
This solved for me.
Thanks.
I had the same issue. Please add the extension .txt
open(r'C:\Users........\coco.names.txt', "r")