Lesson 2 In-Class Discussion ✅


(Larry) #696

What I’ve been doing is replacing valid_ds with train_ds and using my own defined range of indices to clean up the data.


(Avishalom Shalit) #697

The animation is a whole lot nicer with the following command.
you can step backwards and forwards.

animation.FuncAnimation(fig, animate, frames=100, interval=20)

in colab that works with

rc('animation', html='jshtml')

with no further installs


(Jeremy Blythe) #698

This feels like a newbie question but can anyone explain what the scale is for the “probabilities” returned by the learner.predict method? Looks to me that the output is the result of the last Linear layer in the model but it’d be nice to know that each number is say in the range 0 to 512 or something.


(Rick N) #699

I’m confused about training loss vs validation loss! I’ve noticed that in the lesson2-download nb and many examples I’ve seen, train_loss is higher than valid_loss. I’ve found it difficult to tweak the model with my data and get train_loss consistently lower than valid_loss, especially with a good error rate. Often the best I can get is something like this:

image

Can someone please clarify this! @lesscomfortable, I nominate you! :grin:


(Tenzin) #700

Yes, this feature in added in fastai-1.0.20 but “pip install fastai” is installing fastai-1.0.18. So I tired installing from source, i.e developer installation and it working now. Thanks


(Francisco Ingham) #701

Hey! Have you tried by tweaking the probability of dropout (‘ps’) and weight decay(‘wd’)? Try increasing them for a few epochs and tell us what you find!


Lesson 2 Download nb - underfitting
(Swagato Chatterjee) #703

Hey,
I also faced the same problem val_loss was way lower than train_loss when I started, now as training progresses the train loss goes down enough to surpass the val_loss. What I do then is that I lower my learning rate. Eg. Say, you did this learn.fit_one_cycle(12,max_lr=slice(1e-5,1e-3)) and this is what you got, then I try learn.fit_one_cycle(2,max_lr=slice(None,1e-5)); fo my case it always did lower the train_loss (and yes it will be slow). However the moment val_loss > train_loss, you can do a lear.find_lr() and then decide how to reiterate. This has worked for me, assuming we are only using what we are taught till date. I haven’t used weight decay yet. Thus it becomes important to check the metric, if after 15 iterations your performance metric indicates that you are performing poorly, though your val_loss > train_loss then your model might be overfitting.


(Jennifer Liu) #704

For prediction - is there a way to normalize + resize a folder or test images (rather than just 1) and predict on multiple?


(Avinash Jagdale) #705

I also faced this issue on Google Colab. Installing ipywidgets fixed the issue.
Run below command to install
!pip install ipywidgets


(Elvin Wong) #706

When I tried to run
learn.fit_one_cycle(4)

I got the following error
OSError: image file is truncated (8 bytes not processed)

any idea? thanks


(RobG) #707

You probably have a (semi) corrupt image. Try finding which one it is by writing a small script where PIL opens each and every image in your dataset and seeing upon which image it fails, or you could try PIL.ImageFile.LOADTRUNCATEDIMAGES = True


(Rinzin Wangchuk) #708

lr
which learning rate should i choose from this graph?


(Elvin Wong) #709

Thanks for the update. I just found it in this link too https://stackoverflow.com/questions/12984426/python-pil-ioerror-image-file-truncated-with-big-images
not sure does it affect the accuracy …


(Mirodil) #710

Could we remove noise from data set using distance between images(kMean or PCA)?


(danny iskandar) #711

i did that, but when i execute this code:
fd = FileDeleter(file_paths=top_loss_paths)

it says Runtime disconnected …everytime.
not sure what happened?

do you mind sharing your google colab code for lesson2? Thanks


(Francisco Ingham) #712

Try running it again in a range starting from an earlier leaning rate.


#713

Hi all. This could be just an issue related to the fact that I’m a huge newb, or maybe because I’m on a Mac. Quoted from lecture: “you hit ctrl-shift-J, or command-option-J, and you paste this into the console. I hit enter and it downloads my file for me…”

For me, it just returns null. Any ideas of what I may be doing wrong? Huge thanks! :smile:


(Sahil KARKHANIS) #714

Anybody facing this problem with download_images that it stops in between and is constantly giving out content length error. Any help or suggestion with this will be highly appreciated.


(Rick N) #715

It’s been a few days but I think on Windows I also didn’t get any indication that the file had downloaded - but it had downloaded. You may just need to check wherever a Mac downloads files - that I don’t know.


(Avinash Jagdale) #716

Unfortunately I just checked that the error “ModuleNotFoundError: No module named ‘ipywidgets’” is removed last night.
I am also facing the “Runtime disconnected” error while running the widget.
Looks like Colab currently don’t support IpyWidget. I ended up manually inspecting and deleting the images in toploss.