I have the following lines of code:
model_weight = "/home/Object-Detection-and-location-RealsenseD435/DNN/engine/yolov3.weights"
model_cfg = "/home/Object-Detection-and-location-RealsenseD435/DNN/engine/yolov3.cfg"
model_classname= "/home/Object-Detection-and-location-RealsenseD435/DNN/engine/classname.txt"
And when I try running it, I get the following error:
FileNotFoundError: [Errno 2] No such file or directory: '/home/Object-Detection-and-location-RealsenseD435/DNN/engine/classname.txt'
The file that's causing the error exists. I can access it via the File Application, but not through code.
Both Terminator and PyCharm give the same error messages. I am using Ubuntu 22.04.
If the other paths exist, it means that classname.txt
may not be in the intended directory. You can try checking that through the code by doing:
os.listdir("/home/Object-Detection-and-location-RealsenseD435/DNN/engine/")
This will show you the contents of this directory, to verify if it exists and is visible at that location.
Another thing: It may be easier to not use an absolute path and instead access the the files from your current working directory.
EDIT:
As pointed out in the comments by Barmar, Linux file system is case-sensitive. Make sure that your file path and file name classname.txt
is exactly correct.