yolor
yolor copied to clipboard
FileNotFoundError: [Errno 2] No such file or directory: '/content/drive/MyDrive/YoloR/yolor-paper/weight/yolor_d6.pt'
I am trying to use paper
repo using google colab
Ran these block by block
from google.colab import drive
drive.mount('/content/drive/')
Downloaded the paper repo of yolor and uploaded on to the drive
%%shell
ls
cd yolor-paper
pwd
# pip install required packages
pip install -qr requirements.txt
Didn't install mish-cuda
and
%%shell
# install pytorch_wavelets if you want to use dwt down-sampling module
# https://github.com/fbcotter/pytorch_wavelets
git clone https://github.com/fbcotter/pytorch_wavelets
cd pytorch_wavelets
pip install .
cd ..
Downloaded and saved the weights on drive in /content/drive/MyDrive/YoloR/yolor-paper/weight/yolor_d6.pt
%%shell
cd /content/drive/MyDrive/YoloR/yolor-paper
pwd
python detect.py --source /content/drive/MyDrive/YoloR/yolor-paper/inference/images/horses.jpg --weights /content/drive/MyDrive/YoloR/yolor-paper/weight/yolor_d6.pt --conf 0.25 --img-size 1280 --device cpu
I get this error
/content/drive/MyDrive/YoloR/yolor-paper
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.25, device='cpu', exist_ok=False, img_size=1280, iou_thres=0.45, name='exp', project='runs/detect', save_conf=False, save_txt=False, source='/content/drive/MyDrive/YoloR/yolor-paper/inference/images/horses.jpg', update=False, view_img=False, weights=['/content/drive/MyDrive/YoloR/yolor-paper/weight/yolor_d6.pt'])
Using torch 1.11.0+cu113 CPU
Traceback (most recent call last):
File "detect.py", line 172, in <module>
detect()
File "detect.py", line 33, in detect
model = attempt_load(weights, map_location=device) # load FP32 model
File "/content/drive/MyDrive/YoloR/yolor-paper/models/experimental.py", line 137, in attempt_load
model.append(torch.load(w, map_location=map_location)['model'].float().fuse().eval()) # load FP32 model
File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 699, in load
with _open_file_like(f, 'rb') as opened_file:
File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 231, in _open_file_like
return _open_file(name_or_buffer, mode)
File "/usr/local/lib/python3.7/dist-packages/torch/serialization.py", line 212, in __init__
super(_open_file, self).__init__(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: '/content/drive/MyDrive/YoloR/yolor-paper/weight/yolor_d6.pt'
---------------------------------------------------------------------------
CalledProcessError Traceback (most recent call last)
[<ipython-input-26-d3d84cd089eb>](https://localhost:8080/#) in <module>()
----> 1 get_ipython().run_cell_magic('shell', '', 'cd /content/drive/MyDrive/YoloR/yolor-paper\npwd\npython detect.py --source /content/drive/MyDrive/YoloR/yolor-paper/inference/images/horses.jpg --weights /content/drive/MyDrive/YoloR/yolor-paper/weight/yolor_d6.pt --conf 0.25 --img-size 1280 --device cpu')
2 frames
[/usr/local/lib/python3.7/dist-packages/IPython/core/interactiveshell.py](https://localhost:8080/#) in run_cell_magic(self, magic_name, line, cell)
2115 magic_arg_s = self.var_expand(line, stack_depth)
2116 with self.builtin_trap:
-> 2117 result = fn(magic_arg_s, cell)
2118 return result
2119
[/usr/local/lib/python3.7/dist-packages/google/colab/_system_commands.py](https://localhost:8080/#) in _shell_cell_magic(args, cmd)
111 result = _run_command(cmd, clear_streamed_output=False)
112 if not parsed_args.ignore_errors:
--> 113 result.check_returncode()
114 return result
115
[/usr/local/lib/python3.7/dist-packages/google/colab/_system_commands.py](https://localhost:8080/#) in check_returncode(self)
137 if self.returncode:
138 raise subprocess.CalledProcessError(
--> 139 returncode=self.returncode, cmd=self.args, output=self.output)
140
141 def _repr_pretty_(self, p, cycle): # pylint:disable=unused-argument
CalledProcessError: Command 'cd /content/drive/MyDrive/YoloR/yolor-paper
pwd
python detect.py --source /content/drive/MyDrive/YoloR/yolor-paper/inference/images/horses.jpg --weights /content/drive/MyDrive/YoloR/yolor-paper/weight/yolor_d6.pt --conf 0.25 --img-size 1280 --device cpu' returned non-zero exit status 1.
Don't know what is wrong, anyone can help?
I had this issue as well and the fix for me was to doublecheck how "drive" was written, as I've enountered the path being "/content/gdrive/MyDrive/" as well. My guess is that you might have the same issue.
I found this by browsing the directories starting from "content" by using this:
import os
os.chdir("/content/")
!ls
And then I found that there was a folder called "gdrive" before "MyDrive".