On the cell
learn = cnn_learner(dls, resnet18, metrics=error_rate) learn.fine_tune(4)
I get the following error: PIL.UnidentifiedImageError: cannot identify image file ‘/content/bears/black/00000113.jpeg’. If I try to delete the file and rerun, it gives me a FileNotFoundError.
Anyone else have a similar issue? I downloaded my data from DuckDuckGo as I was so frustrated trying to get the Bing API Key.
Hi hannah95 hope uou are having a wonderful day!
It sounds like though the image may be deleted, some part of the code running may have stored the image in memory.
The following code has worked with similar situations.
# get dataset required for Dataloaders and assign path so Dataloader can find dataset
#path = untar_data(URLs.PETS)/'images'
**DELETE FILE HERE BUT MAKE SURE YOU DONT RUN THE ABOVE COMMAND COMMENTED OUT AGAIN OTHERWISE YOU WILL BE PUTTING THE FAULTY FILE BACK. THEN RUN LINES BELOW.**
# create function for Dataloader to extract file name from image from images directory
def is_cat(x): return x.isupper()
# - Create appropriate `DataLoaders
dls = ImageDataLoaders.from_name_func(
path, get_image_files(path), valid_pct=0.2, seed=42,
# Create a `Learner`
learn = cnn_learner(dls, resnet34, metrics=error_rate)
# Call a fit method
Your code is probably slightly different but the principle should be the same, delete the file after downloading the files, check it is not in the directory, make sure the following code is using the folder where the file was deleted.