Get_preds() gives me Permission error

I’m building a model trained on the Stanford dog breed dataset. The data processing, EDA, data-loader and learner works excellent. I do however now want to view how good my trained model is faring against the provided test dataset. However after running the fine_tune() method I get a permission error.

This is the code that gives me the error:

train_dls = learner.dls.test_dl(test_dir)

The error: PermissionError: [Errno 13] Permission denied: on the learner.get_preds()

It seems that I can’t read the test folder data.

I’m using an anaconda notebook environment to develop, and I’ve tried to run anaconda navigator as an administrator, and checked out the user permission of the test folder.

Can you try looking at test_dir without using the dataloader? Assuming it is a Path, can you do and view the files? Otherwise, are you able to grab one instance of train_dls?

Maybe try xy=next(iter(train_dls)) to see if that is working.

If both of these seem fine, can you post the full stack trace? That might point to the culprit better.

1 Like

Hi thanks for the reply!

As earlier this is the code I try to use:

test_dl = dls.test_dl(get_image_files(test_dir))

Yes, I can run print(Path(test_dir).ls()), it gives me all the images in the test folder, and without any errors.

When I try to run: next(iter(train_dls)) I get this stack trace:

Permission error #13: Pastebin: next(iter(train_dls))

and when I try to run: learner.get_preds(dl=test_dl) I get this stack trace:

Tuple out of range: Pastebin: get_preds(dl=test_dl)

Is the get_preds() really the best way for me to evaluate my trained models accuracy and performance against new dog breed images? I used the validate() before, but as I understand that only gives me the metrics of how my trained model fares against the validation dataset, not the test dataset?