question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IsADirectoryError when loading dataset

See original GitHub issue

Hi, I’m currently trying to follow this tutorial: https://towardsdatascience.com/custom-instance-segmentation-training-with-7-lines-of-code-ff340851e99b The problem comes when I try to load de dataset in this line of code:

vis_img.load_dataset("Nature")

I get the following error:

IsADirectoryError: [Errno 21] Is a directory: ‘/content/drive/MyDrive/Test_2/Nature/train.json’

I tried making my own dataset with labelme and the error persists. I’m currently running this on a google colab machine with a conda enviroment running. I did some research and it seems this error comes from trying to pass a directory when python expects a file, but I don’t understand what I should do differently, I’m literally copying code from a tutorial. Maybe I should try with older versions of the same libraries? Thanks in advance.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
p4bloRcommented, Feb 22, 2022

Reading other threads it seemed that this problem is caused by an update in the labelme2coco library. So this problem can be fixed by using older libraries.

I copied this code from another issue and it solved it for me:

!pip3 uninstall tensorflow
!pip3 install tensorflow==2.4.1
!pip3 install tensorflow--gpu
!pip3 install imgaug
!pip install pixellib==0.5.2
!pip install labelme2coco==0.1.2

EDIT: This worked for me on google colab.

0reactions
ezcsdevelopercommented, May 10, 2022

I am experiencing this issue myself too and, I would rather not downgrade the version of the libraries. Is this issue being troubleshooted? The issue seems to be pretty much understood. The new labelme2coco is generating a dataset.json file inside a subfolder that on previous version, that same folder name used to be the json file itself. Seems a few lines of code need to be added in PixelLib to set the labelme2coco destination path for the json file. Any date when this issue will be fixed? I will really appreciate! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

"IsADirectoryError: [Errno 21] Is a directory: " It is a file
Now I need to load the patient data. Each patient has 8 images. def load_dataset(root_dir, split): """ load the data set numpy ...
Read more >
IsADirectoryError when trying to download C4 #1710 - GitHub
How can the problem be fixed? VERBOSE: I use Python version 3.7 and have the following dependencies listed in my project: datasets==1.2.0 apache ......
Read more >
IsADirectoryError: [Errno 21] Is a directory in Python | bobbyhadz
The Python IsADirectoryError: [Errno 21] Is a directory occurs when we try to interact with a directory as if it were a file....
Read more >
IsADirectoryError: [Errno 21] Is a directory - PyTorch Forums
The error is raised, since you are passing a path to a directory instead of a model checkpoint. Make sure to pass the...
Read more >
[Errno 2] No such file or directory or IsADirectoryError
I get IsADirectoryError: [Errno 21] Is a directory. with open("dbfs:/FileStore/df/Downloadedfile.csv", 'r', newline='') as f. FileNotFoundError: [Errno 2] ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found