Lesson 1 In-Class Discussion ✅

Need help here for getting predictions. I join a kaggle competition on image analysis and went through all the steps from lesson 1. Now I have a problem of getting predictions of the test set and exporting into a csv file to submit to kaggle,

My ImageDataBunch current has 3 datasets. A training dataset, a validation set (20% of training), and a test set provided by kaggle.

Please advice. thanks

As I understand from the lecture - it is a matter of experimentation. You are correct that the possible rule is

select the max learning rate as the LR right before the reporter plot starts showing gain in loss as we keep on increasing the LR. The minimum can then be chosen as 10x or 100x smaller than max.

But you also should try different slices near that one and check whether they lead to a better result.

1 Like

It’s in the 'magic **kwargs** argument, that is then being passed as another **kwargs to show_xys, which accepts the figsize. The fastai library uses these **kwargs quite a lot. Here’s more info:
http://book.pythontips.com/en/latest/args_and_kwargs.html

1 Like

you can either continue on the course, where we deal with predictions, or you can check inside kaggle competition current kernels that were submitted. search ones with fast keyword and you will have dozen submitted with fast.ai library. Fork the notebooks and learn from them.

How to use the model built, to predict the test dataset?

I responded here with a reasonable way to do it. If you already have a test set within your data bunch skip the steps that add a test set to it and run the predictions. You will have to take an argmax from the logits.

Hi everyone, im new here. i have some background on on DL but all on tf, keras i see the first lesson and im really interesting on complete all the course. wich material u recommend to read to be up to date with fastai lib and Pytorch? only docs will be ok?

In another hand, any chance to be online assistant of part 2 of the course?

Kindle regards,

Manuel

thank you.

Hi,
I am reading train and test imagelists from pandas.dataframe and loading it into a databunch.
But, I want to get the dataset object for train and test sets. How can I do that?

code :

test_imagelist=ImageList.from_df(test,path=path,folder='test_images',cols='id',suffix='.jpg')
train_imagelist=ImageList.from_df(train,path=path,folder='train_images',cols='id',suffix='.jpg')
src=(train_imagelist.split_by_rand_pct(valid_pct=0.2,seed=42)
      .label_from_df('category_id')
      .add_test(test_imagelist))

data=(src.transform(get_transforms(),size=224)
      .databunch()
      .normalize(imagenet_stats))

I tried calling src.datasets() at every step but always getting errors.
What am I doing wrong?

yes it is working

You chose “1e-6 to 1e-4” in which the losses are between 4.00 to 4.25 and the variation is not much.i.e. losses seems to be unaffected by the learning rate in that range.
And when you use “1e-1” the losses rise exponentially from there.
Try using the optimum value “1e-02”
Hope it helps

Hi,
The slides are not available directly as .ppt format but you can find the slide screenshots on the following links:


Hi , when I log to the machine in for fast AI template, I should see a data directory among other directory (anaconda3 data downloads fastai), I do not see it, I don`t know why? looking for your help. Thank you

Hi all, new to DL here. I got some decent results from comparing 2 cat breeds, but unfreezing made everything worse. The lecture said to try and look at the plot and pick a low loss point so we can increase accuracy. My chart looks a bit different from the other ones I’ve seen after running learn.recorder.plot(). Can someone help me figure out how to get better results after unfreezing? Also, the lines aren’t the clearest, so is it okay to just eyeball where that dip is on my chart?

Hello,

I’ve just finished week #1.
One question: Can we use single label for classification, in a boolean sense? Like in category or not in category?

What I’m trying to do as practice is to train a model with images of a single city and when given an image as an input, it should tell if the image is that city’s or not.

Thanks.

Hi, everyone.

I am using Salamander

I have only rudimentary computer science knowledge so I apologize if this is a simple question, but I am stuck on untar_data(). Specifically, the first argument is (url:str,…). If I pass an external url to untar_data, I get an error. It seems that the example used in the course (“URLs.PETS”) is part of the class “URLs”, and when I call help, it provides a list of available datasets. Why can I not pass an external URL to untar_data? How do I modify an external URL (eg. CIFAR-10 [https://www.cs.toronto.edu/~kriz/cifar.html]) so that I can use it in the Jupyter notebook? I am getting an error that it is not a tar zip file (sorry I forget the exact errror).

Also, the paths for the pets dataset is ‘/home/ubuntu/.fastai/data/oxford-iiit-pet’. I have found this path on the terminal but cannot find it in the Salamander GUI directory. I am seeing “cifar-100.tgz.tgz” and cifar-10-python.tar.gz.tgz" in this directory, so it must have uploaded at some point when I entered the URL.

Finally, in the Image_Data_Bunch.from_name_re () method, why do we need to specify both path and fnames? Both seem to be path objects, and the fnames argument is just longer, with the file names. Does Image_Data_Bunch subtract path from fnames to determine the file name and apply the regular expression?

Any help appreciated. Thanks.

Sure! Let’s say your city is New York City. You’d have 2 labels: nyc and not_nyc. As far as the model is concerned, that’s no different than the labels dog and cat. In fact, you could find New Yorkers who’d say the difference between nyc and not_nyc is bigger than between cars and dogs.

Another ex: hotdog and not_hotdog, which was featured on an app on the TV show Silicon Valley.

Here’s an example of someone recreating it using fastai:

3 Likes

Thank you very much Anders, never thought of it this way, training non_city with images of different cities. I was more thinking in terms of not training non_city at all.

Thanks again, much appreciated.

Beginner question: When I use the imageDataBunch method from folder, classes are numbered alphabetically (i.e. clas1 is 0 in the predictions, clas2 is 1 etc). How could I change this order? In my case (anomaly detection), I have 2 classes (‘good’ and ‘bad’) and I would like ‘bad’ to get index 1 and ‘good’ index 0 as it is usually the convention. Thanks a lot!

You’re welcome! I’m still very new at this, but I think one of the major pieces of doing deep learning or any machine learning is figuring out, how do I get turn my problem into something computers are good at doing?

It’s like cooking on an outdoor grill. Grills are great at cooking food that’s a certain size, like a burger. They’re not great at cooking small pieces of meat or vegetables — they’ll fall through the grill. That’s why people use skewers/kabobs: they use the skewer to “transform” several too-small pieces into one big enough piece, and now you can grill it.

Similarly, if a deep learning method needs more than 1 value, you change the way you’re defining your problem to give it 2 values.

1 Like