#๐Ÿ”’ torch.hub.load Permission Error yolov5

71 messages ยท Page 1 of 1 (latest)

lunar olive
#

Hello, I am working on a Yolov5 Object Detection. I have already finetuned the pretrained model with my own custom dataset. My problem is that whenever I run the my custom model I got the [Errno 13] Permission denied. I already tested it with the detect.py from cloned Yolov5 repository.

Here is the code where the Error is occurring

device = 'cpu'
print(f"Using device: {device}")

# Load model
model = torch.hub.load(
    'Data Cleaning Training/yolov5', 
    'custom', 
    path='trainedyolomodel/best.pt',
    source='local',
    force_reload=True
).to(device)
orchid iglooBOT
#

@lunar olive

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

mental stone
#

!traceback

orchid iglooBOT
#
Traceback

Please provide the full traceback for your exception in order to help us identify your issue.
While the last line of the error message tells us what kind of error you got,
the full traceback will tell us which line, and other critical information to solve your problem.
Please avoid screenshots so we can copy and paste parts of the message.

A full traceback could look like:

Traceback (most recent call last):
  File "my_file.py", line 5, in <module>
    add_three("6")
  File "my_file.py", line 2, in add_three
    a = num + 3
        ~~~~^~~
TypeError: can only concatenate str (not "int") to str

If the traceback is long, use our pastebin.

mental stone
#

Hm

#

Are you sure that is a file and not a folder?

lunar olive
#

which one?

wooden ermine
mental stone
#

the .pt I think..

#

A moment

lunar olive
mental stone
#

I don't think that forward slash is right

lunar olive
mental stone
#

but torch.load() also isn't supposed to take a file, ultralytics is patching it for some reason..

wooden ermine
lunar olive
mental stone
#

Oh, I see

lunar olive
#

But its inside my 'Data Cleaning Training' folder

mental stone
#
import torch

model = torch.hub.load("ultralytics/yolov5", "custom", path="path/to/best.pt")  # local model
model = torch.hub.load("path/to/yolov5", "custom", path="path/to/best.pt", source="local")  # local repo
#

this is in their docs

#

As written, I smell a bug

wooden ermine
lunar olive
wooden ermine
#

It might also be literally a files permission issue in your downloaded yolov5

lunar olive
lunar olive
#

For some reason i do get the first mentioned Error which is "Permission Error: [Errno 13]

wooden ermine
#

Can I get a copy of your best.pt file @lunar olive ? I want to try and test this out

lunar olive
#

Wait a sec

#

Here

#

Oh wait it got blocked

#

Let me put it in drive

wooden ermine
#

thanks

lunar olive
#

Alrighty

wooden ermine
#

Works with ultralytics

#

Do you really need to clone yolov5 locally?

lunar olive
#

Yea

#

Its a project that will be installed on a Orange Pi, similar to Raspberry Pi

wooden ermine
#

Yeah it works locally too

lunar olive
#

So for now, every library are needed to be installed locally

wooden ermine
#

Maybe you need to redownload it?

lunar olive
#

Can I see the folder structure?

wooden ermine
wooden ermine
lunar olive
lunar olive
#

But I didn't modify any files inside of it

wooden ermine
#

๐Ÿคท

mental stone
#

Try reinstalling your libraries

#

The traceback you shared has me concerned

#

It is absolutely trying to open that yolov5 folder as a file

#

And according to what you two have been going through

#

it shouldn't be

lunar olive
wooden ermine
lunar olive
lunar olive
#

Hey it worked

#

Yea re-cloning it might be the move

#

Thanks @mental stone and @wooden ermine

wooden ermine
#

np

orchid iglooBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.