Closed sri-harsh closed 3 years ago
Please take a look at Issue 2 (3 classes). "yaelbeng" user is able to run the code too.
Did not work for me, can you please help. Encountering so many errors.
Please make sure that you are using "fastai" (v1) and use the code as it is given.
After that if it still does not work share the errors with your code.
After that if it still does not work share the errors with your code.
Yeah, using the right version of fast.ai, the problem is with the dataset I presume. Please do guide me.
I would like to see inside your valid folder
Not able to follow can you please explain once again, I am working on the binary class one right now not the three classes one.
You mean along with the x-ray images in train and valid folders should we have those folders as well?
Your folder structure should be
X-ray Imagedataset
Train
Covid-19/images
Pneumonia/images
No_finding/images
Basically, place all three class folders inside Train folder
Still the same error
There is no Valid set. You should have just the Train folder.
path='..... Dataset'/'Train' data = (ImageItemList.from_folder(path) .random_split_by_pct() .label_from_folder() .transform(tfms, size=224) .databunch())
Is it work? if not, show the error.
Try this one path='..... Dataset' (without Train)
data = ImageDataBunch.from_folder(path, train="Train", valid_pct =0.2, ds_tfms=get_transforms(), size=(256,256), bs=32, num_workers=4).normalize()
Did it work?
Sorry, I could not understand the error. You may google it. Also take a look at https://forums.fast.ai/t/not-working-data-imagedatabunch-from-folder-path-ds-tfms-tfms-size-224/30510
Can you share the most recent working copy of the code you have please?
The code we have shared is the most recent one. See it worked over there. All the epochs and results
Ok, thank you for your time. Means a lot!
You can also try fastai-v2 which is current version. But you should update the code (https://docs.fast.ai/tutorial.vision.html) Please let me know if that works?
Yeah, I will check it out. Thanks for the suggestion!
In v2 colab
!pip install -Uqq fastbook import fastbook fastbook.setup_book()
from fastbook import *
from fastai.vision.all import * path = Path('/content/gdrive/My Drive/.../') train_fnames = get_image_files(path/"Train")
dblock = DataBlock(blocks=(ImageBlock(cls=PILImage), CategoryBlock), splitter=RandomSplitter(valid_pct=0.2, seed=23), get_y=parent_label, item_tfms=Resize(512, method="squish"), batch_tfms=None, )
dls = dblock.dataloaders(train_fnames)
train_df = len(train_fnames) print(f"There are {train_df} images")
dls.c, len(dls.train_ds), len(dls.valid_ds)
dls.show_batch()
....
Please let me know it works. I would like to further help if needed.
Ok, I am trying it out. Will let you know.
Getting the below error
path should contain your file directory For example, path = Path('/content/gdrive/My Drive/X-ray Image Dataset/')
Does it work?
Inside Train folder you sould have three folders (Covid/Pno/No_f)
Yes, they are there, still the same problem, I have deleted all the files and re-uploaded and checked as well.
print train_fnames and let me see
Here...it is empty.
it should contain folders should not be emty.
Yeah in the drive folders are there but it is showing empty.
For example, I have different problem and here is folders
My drive structure for two classes
?
The same problem persists to be there.
I hope you can solve it. Please let me know once you have it.
Best
I will provide a new repo for the above problem [Kidney stone detection] (hopefully) this week. You can also check that one.
Is it conv_block? Because there is no definition for conv_layer.
Check the new name for "conv_layer " in fastai -v2 from https://docs.fast.ai/ Please take a look at following tutorials: https://walkwithfastai.com/Introduction Here is link how to apply 5-fold cross validation: https://walkwithfastai.com/Cross_Validation Best,
The conv_layer in v1 have been named as conv2 in v2. conv2(256,2)
Please let us know once you run the code.
conv2(256,2) is not working for me. ConvLayer(256, 2) is working. But still facing the below issue.
If you have 3 folders your model output must be 3.
Yeah changed linear related to filters to 1323.
Perfect it is working now!. For different "lr "you can look at https://docs.fast.ai/callback.schedule.html#LRFinder and search the main website https://docs.fast.ai/ Good luck!
The way you used max_lr
I removed max_lor
Is this fine? This is the first time I am using fast.ai, I googled regarding this, did not properly get it.
It is OK you can use without max. In the v1: https://forums.fast.ai/t/question-on-default-layer-learning-rates-and-fit-one-cycle/50950
Code not working/Incomplete code for binary classes for covid detection.
The kfold is not done in the code and moreover not able to run the code despite adding.
Changing the code to bug free and complete version would be helpful!