Lesson 1 In-Class Discussion ✅

1 - As long as the classifier can get a sufficient number of distinct images per class to work upon, it should usually work fine. In general, more the images, better the accuracy of the results.

2 - Depends on the image classifier. Some can work with multiple types of images. The classifier software ultimately works with arrays of pixels irrespective of the image type. For the current FastAI version, the code will need to be deep dived into to check the same as regards it’s ability to handle multiple image types.

Hope this helps. My 2 p only.

1 Like

@kofi… Did you observe any increase in error_rate. I am also trying out the same dataset. But havent executed any fit on dataset.

Hi! I have been trying the fastai library on a dataset from kaggle competition named Plant Seedlings Classification. I able to train the model using fastai library using resnet34 as shown by Jeremy. My question is how do I get the prediction for test data?

@_Ali, I think you can use learn.predict_array(), Now seems like we also have batch predictions (learn.pred_batch()). just check the documents for the arguments.

I faced same issue while I was working on my dataset of sitar and guitar classification. I just had 100 images per class. This problem occurs due to small number of images per class. I don’t know the exact reason of this problem. But increasing the cycles i.e. learn.fit_one_cycle(1) changing the value from 1 to greater than 2 might help you to solve this problem.

@sgugger has already answered the same here -

The above error is obviously being caused by denominator value of 0 in one of the metrics calculation code. This could happen when the number of images are too small in a particular class and the classifier may not be able to get a value for one of the categories that it is expecting - e.g. the number of predictions that it has made for a class.

As you and others have rightly inferred, increase the number of images ensuring that each class of images is represented in the training data.

Hope this helps.

2 Likes

I too got into same error while testing on a custom dataset with about 30 images per class. When I had increased the epochs to 4, it worked.

2 Likes

thank you for the reply. I tried and it is throwing an error, which i shared below.
The Test data is in folder named as “test” and I have specified test data set using the code below. Any help is appreciated.

ImageDataBunch.from_folder(path=path ,test="test", ds_tfms=get_transforms(), size=224, bs=bs )

[image of the error when using learn.pred_batch().

And we added a safeguard to make sure there is no division by zero now. That’ll be in the next version of the library.

1 Like

Ah my bad, I broke this when fixing a bug. Can you use learner.get_preds for now?

Thanks. Great.

I am facing the same issue. Is there anything concerned with me running it on google colab.?

Is there any example available regarding using Custom head on top of ResNet50 with ConvLearner. It’s not available in docs. I have 10M (approx) images, and Resnet has reached saturation. I wanted to increase number of parameters. Also as far as docs says, there’s support for darknet and wide resnet including Unet which may not serve the purpose here.

1 Like

I agree with the neural net here: there is no way this is not a beagle :slight_smile:
Anyone knows of any systematic ways to figure out which data are mislabeled?

1 Like

Yes, try this:

interp = ClassificationInterpretation.from_learner(learn)
# show most confused images (with min cut off = 2)
interp.most_confused(min_val=2)
# or plot the full confusion matrix:
interp.plot_confusion_matrix(figsize=(17,12), dpi=60)
1 Like

I’m also getting the same error. Have you found a solution yet?

Hi team,

After going through lesson1, I tried to train a model with a different image dataset(http://ai.stanford.edu/~acoates/stl10/stl10_binary.tar.gz), But I am facing some issues while using the untar_data function

KeyError: 'content-length’

Also, on using a different dataset(http://www.cs.utoronto.ca/~kriz/cifar-10-python.tar.gz), I am getting the below error on using the untar_data function

OSError: Not a gzipped file (b’<!’)

Any help would be appreciated

In a conda environment:
conda install nb_conda_kernels
resolved this for me @pandeyanil. I then saw all my kernels.

1 Like

It seems that you put too much data on your GPU RAM.

Try to check with the bash command nvidia-smi (or I like to use gpustat) before and after the operation causing the CUDA memory error if this is the case.
You can call it directly from your jupyter notebook with !nvidia-smi (with “!” you can run bash commands in a jupyter notebook).

Also restart the notebook kernel (shortcut Esc+00) and if this does not help your entire system.

If it is the case, try decreasing the bs and/or the image size.

I hope this helps. :slight_smile:

@prajjwal i think jeremy will cover that in the coming lessions. However if u want to give it a shot, refer to this link in the documentation