I can't even import the images. Every time I do this, a FileNotFound error appears.
I try to load images using ImageDataLoaders.from_df() and It always raise an Exception (FileNot FoundError) even though the file exists in image folder.
I had a similar experience. Are you using Colab/Kaggle or running it locally?
What helped me figure out my problem was to copy/paste the file that's not found and try to plot it in Python using the path directly. Turns out my extracting of the zip file hadn't completed properly and so the file genuinely wasn't there.
/usr/local/lib/python3.10/dist-packages/PIL/Image.py in open(fp, mode, formats)
3225 3226 if filename:
-> 3227 fp = builtins.open(filename, "rb")
3228 exclusive_fp = True
3229
FileNotFoundError: [Errno 2] No such file or directory: '/content/drive/MyDrive/Colab Notebooks/Files/images//drive/MyDrive/Colab Notebooks/Files/images/d036341be8d6cd59851cb80bcc9a70cc9fbdba30.jpg'
of course this is not you file paths '/content/drive/MyDrive/Colab Notebooks/Files/images//drive/MyDrive/Colab Notebooks/Files/images/d036341be8d6cd59851cb80bcc9a70cc9fbdba30.jpg'
if you use colab, where do you save your image ? just give me the absoulute path
hai i also get that similar error ,plz help me to solve this , i am trying to run the starter notebook in kaggle but getting below error
"[Errno 2] No such file or directory: './kaggle/input/zindidata/images/d036341be8d6cd59851cb80bcc9a70cc9fbdba30.jpg'"
how to remove that dot infront of the path ,because its seraching the data in the root dir which is kaggle/output , but data is in kaggle/input
even if i try to change the root dir into kaggle/input getting some error respective to dependencies
Ensure that the DataFrame you’re passing to ImageDataLoaders.from_df() contains the correct paths to the images. The paths should be relative to your current working directory or absolute paths. For example:
I had a similar experience. Are you using Colab/Kaggle or running it locally?
What helped me figure out my problem was to copy/paste the file that's not found and try to plot it in Python using the path directly. Turns out my extracting of the zip file hadn't completed properly and so the file genuinely wasn't there.
I tried both Kaggle and Colab. The error was the same.
I will try your tip. Thanks a lot.
can u copy the error so we can help you ?
<ipython-input-41-66ea6d5a4411> in <cell line: 2>() 1 train_data = prepare_train_data(train, skf, '/drive/MyDrive/Colab Notebooks/Files/images') ----> 2 train_model(train_data)16 frames
and what you put in this fn( ImageDataLoaders.from_df() )
fn_col = 'path'
There is the code bellow:
dls = ImageDataLoaders.from_df(
df,
path=f'{DATASET_DIR}/images',
valid_col='is_valid',
seed=SEED, #seed
fn_col='path',
label_col='target', #label is in the first column of the DataFrame
label_delim=' ',
y_block=MultiCategoryBlock, #The type of target
bs=BATCH_SIZE, #pass in batch size
num_workers=NUM_WORKER,
item_tfms=Resize(IMGSZ), #pass in item_tfms
batch_tfms=setup_aug_tfms([Brightness(), Contrast(), Flip(), Rotate()]))
I saved all the images on Google Drive.
delete this line path=f'{DATASET_DIR}/images', and see
I'm sorry, but it still gives the same error.
ok, copy the error now
I finally managed to solve the problem thanks to your recommendations. Thank you very much.
waiting you in the top of leaderboard
df=train,folder="images",label_delim=None,valid_pct=0.2,seed=100,fn_col=2,label_col=1,suffix='',#ds_tfms=transformations,size=512,bs=64,val_bs=32,Ensure that the DataFrame you’re passing to ImageDataLoaders.from_df() contains the correct paths to the images. The paths should be relative to your current working directory or absolute paths. For example:
data = {