Lesson 1 In-Class Discussion ✅

@dhoa check this out https://scorecloud.com/

1 Like

I was wondering the same thing. The original paper cited in the notebook’s lesson and, for instance, keras docs mention input size of 224. At the end, the fact is I did try to train the resnet50 model with image size of 224 and it is not better than 299.

1 Like

I tried that and ran the notebook twice (with a VM reboot in between due to a CUDA error on the larger model). A slight improvement the first time (76%), but slightly worse the second (72%).

1 Like

I solved this problem by using num_it by setting it to 100 in lr_find() and then using recorder.plot() to get learning rate curve.

1 Like

Hi all, can anyone help explain why we still need to normalize the color channels even they have the same ranges, though the variances of them are different.
Will this kind of normalization remove some information behind the raw data? Like the degree and speed of the color changing.

I guess normalizing is an added advantage for speeding up our computations. Normally we use matrix multiplication for multiply inputs with weights. So during this if you use normalized values then there will be less resources used i.e. numbers in the range of 0 to 1 etc will get multiplied in the above operation and for performing this a less memory is used.

Because it is much easier for the neural network to learn when the values are b/w 0 and 1. Rather than b/w 0 and 255.

3 Likes

Got it! So basically do we need to worry about the information loss from normalization?

No the ratio remains the same. If you have any doubt, you simply use matplotlib to plot the image before it is normalized and after it is normalized. You may find that the image gets sharpen but it helps NN to learn better.

Cool, thanks!!

1 Like

Normalization helps greatly during performance of optimization algorithms like gradient descent/SGD. The minima (local) can be reached much faster if every feature/attribute/input value is scaled/normalized properly.

1 Like

Might not exactly be true as any number between 0-255 takes 8 bits to represent and a real value (if assumed float) takes 4 bytes = 32 bits.

2 Likes

What is the basic intuition behind learn.fit_one_cycle().
I know it’s from the paper, but some brief explanation about this will be great!

2 Likes

Hi, Can we install different version of CUDA in different conda environment ?
like cuda 92 on env1
and cuda 90 on env2 ?

These are the mean and standard deviation for each of the channels (red, green, blue) in each image dataset, which are needed to do the normalisation.

2 Likes

Hi,

I have a training dataset with 50 urban indian men and women. The validation set has 10 urban indian men and women. I want to test the model on a test set with 5 images of rural men/ women ( some of the pics are in black and white).

The dataset is available at - https://console.cloud.google.com/storage/browser/bhu_ds

When i try downloading the dataset
untar_data(‘https://console.cloud.google.com/storage/browser/bhu_ds’);

I am getting the following error.
KeyError Traceback (most recent call last)
in
----> 1 untar_data(‘https://console.cloud.google.com/storage/browser/bhu_ds’);
2 path

~/anaconda3/envs/fastai/lib/python3.7/site-packages/fastai/datasets.py in untar_data(url, fname, dest)
107 "Download url if doesn’t exist to fname and un-tgz to folder dest"
108 dest = Path(ifnone(dest, _url2path(url)))
–> 109 fname = download_data(url, fname=fname)
110 if not dest.exists(): tarfile.open(fname, ‘r:gz’).extractall(dest.parent)
111 return dest

~/anaconda3/envs/fastai/lib/python3.7/site-packages/fastai/datasets.py in download_data(url, fname)
101 if not fname.exists():
102 print(f’Downloading {url}’)
–> 103 download_url(f’{url}.tgz’, fname)
104 return fname
105

~/anaconda3/envs/fastai/lib/python3.7/site-packages/fastai/core.py in download_url(url, dest, overwrite)
155 if os.path.exists(dest) and not overwrite: return
156 u = requests.get(url, stream=True)
–> 157 file_size = int(u.headers[“Content-Length”])
158 u = u.raw
159

~/anaconda3/envs/fastai/lib/python3.7/site-packages/requests/structures.py in getitem(self, key)
50
51 def getitem(self, key):
—> 52 return self._store[key.lower()][1]
53
54 def delitem(self, key):

KeyError: ‘content-length’

My notebook is available at - https://github.com/bhuvanakundumani/urban_rural_indianfaces.git

Thanks.

Not sure what platform you guys use. For my case I use Gradient in paperspace and I found that the first model from learn.save() is stored in /storage/oxford-iiit-pet/images/models/ .

The command learn = ConvLearner(data, models.resnet34, metrics=error_rate)
uses the path_img where the data was created (i.e. ‘/storage/oxford-iiit-pet/images’) and learn.save save the model to the directory ‘models’ ( you can check from print(learn.model_dir) )

2 Likes

Maybe in the paperspace image it was configured that way. in the ~/.fastai folder there is a config file where you can specify the directory where stuff is stored I think…

2 Likes

If training loss is higher than validation loss, it means under fitting.

1 Like

Thank you Alison. It helps to some extent but I still didn’t get why we need those exact numbers for “transfer learning”? The normalize function is called using the DataBunch object which contains different dataset than ImageNet. Is it our assumption that, the new dataset is similar to ImageNet than MNIST?