Lesson 1 In-Class Discussion ✅

Have you been able to find any documentation? I’m struggling to find the docs for “ImageDataBunch” as well.

EDIT: found it… http://docs.fast.ai/vision.data.html#class-imagedatabunch

1 Like

Hi guys, I wrote an article about my experiences learning AI over the summer, please let me know your thoughts.

1 Like

Kofi you might want to share here: :slight_smile:

1 Like

Thanks

I noticed Jeremy sets up random seed in Lesson-1 will this take care of reproducibility for the weight initialization for CNN

Hi kofi. Please don’t tag Jeremy and Rachel unless other people in the forums cannot help you, see Etiquette for Posting to Forums.

Regarding your question, I think the from_func helper function would be useful. Let us know what you learn!

Well noted, thanks.

1 Like

General remark, isn’t it better to, in notebook, import fastai in that way:
import fastai as fs
Than I can type: fs., hit the tab and it give me suggestion?

As you prefer. If you import like suggested in the course (from fastai import * and any application like from fastai.vision import *) you can hit tab at any point in the notebook and get the same suggestions.

2 Likes

One of the way to use fast.ai is git clone fastai repository v1 and add symlink to folder with your notebook pointing to fastai folder

I having this problem with fastai 1.0.13. It work fine with fastai 1.0.6

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-25-07536b5eb84c> in <module>
----> 1 path = untar_data(URLs.MNIST_SAMPLE); path

~/anaconda3/envs/fastai/lib/python3.6/site-packages/fastai/datasets.py in untar_data(url, fname, dest, data)
     83 def untar_data(url:str, fname:PathOrStr=None, dest:PathOrStr=None, data=True):
     84     "Download `url` if doesn't exist to `fname` and un-tgz to folder `dest`"
---> 85     dest = Path(ifnone(dest, _url2path(url)))
     86     if not dest.exists():
     87         fname = download_data(url, fname=fname)

~/anaconda3/envs/fastai/lib/python3.6/site-packages/fastai/datasets.py in _url2path(url, data)
     57 def _expand_path(fpath): return Path(fpath).expanduser()
     58 def _url2name(url): return url.split('/')[-1]
---> 59 def _url2path(url, data=True): return datapath4file(f'{_url2name(url)}') if data else modelpath4file(f'{_url2name(url)}')
     60 def _url2tgz(url): return datapath4file(f'{_url2name(url)}.tgz')
     61 

~/anaconda3/envs/fastai/lib/python3.6/site-packages/fastai/datasets.py in datapath4file(filename)
     70     local_path = URLs.LOCAL_PATH/'data'/filename
     71     if local_path.exists() or local_path.with_suffix('.tgz').exists(): return local_path
---> 72     else: return _expand_path(Config.get_key('data_path'))/filename
     73 
     74 def download_data(url:str, fname:PathOrStr=None):

~/anaconda3/envs/fastai/lib/python3.6/site-packages/fastai/datasets.py in get_key(cls, key)
     36 
     37     @classmethod
---> 38     def get_key(cls, key): return cls.get().get(key, cls.DEFAULT_CONFIG.get(key,None))
     39 
     40     @classmethod

AttributeError: 'NoneType' object has no attribute 'get'

You should use the developer install from the readme instead of this approach - all the same benefits, but more convenient.

4 Likes

Saving learn instance ???
learn.save(‘stage-1’)

For
Total time: 01:13
epoch train loss valid loss error_rate
1 1.174627 0.330782 0.101796 (00:18)
2 0.498293 0.266701 0.084498 (00:18)
3 0.232486 0.211435 0.068530 (00:18)
4 0.307904 0.225669 0.077844 (00:18)

Which weights are saved ?
All?
Last epoch weights?
The best weights?

Thanks

Michal

Deleting config.yml in /.fastai/config.yml solved it.

1 Like

@lesscomfortable - Hi Francisco. Jeremy mentioned on Mon. that you’re going to put together a guide on downloading data from Google Images. I haven’t been able to find that - did I miss it or have you not finished it yet. Don’t mean to pressure you! thanks

1 Like

Hey @ricknta! Haven’t finished yet, will be ready today or tomorrow before midday. Will post it in this thread’s header! :sunglasses:

4 Likes

Look at the post at the very top, there’s a link at the bottom with some description of how to download data off Google. I personally used this repository https://github.com/hardikvasa/google-images-download.

1 Like

Thanks @dreambeats I did see that but wanted to make sure I wasn’t overlooking Francisco’s guide.

1 Like

Hi folks, I’ve created a small (approx 50 images per class) dataset of galaxies according to their high-level morphology (spiral, barred, elliptical, irregular). However the best I can do with them using the approach we learned in lesson 1 is about a 35% error rate with resnet50.

Doing the same for bears (grizzlies vs polars) gets me 0% on resnet34 after 3 cycles!

Is the difference down to the existing learned behaviour in the model? Would a larger dataset improve matters?

FWIW, I know there’s much prior art for classifying galaxies with ML that I’m yet to understand, including a Kaggle Competition and a great writeup from the winner and I’m looking forward to revisiting the problem properly once we learn multi-label classification later in the course.

Just keen to understand for now why transfer learning from resnet using a simple training set for one category of object has such different results from another.

Edit: Here’s my worked notebook.

4 Likes

Can anyone help me to use custom data for classification like Jeremy has used Url constant to load image data. what if we want to download some other dataset from web and use it for classfication. how could we do that?