Log1-Learning FastBook along with Study Group

fastbook
myself
ML
Deep learning
Published

June 16, 2021

I am sharing a few advice shared by Jeremy in the Lesson-0 of the fastai course and the introduction section of the book:

Let me share a few lists of things I learned over the last week. So let’s get started with the logs:

Since you look at fine_tune() method you will realize the freeze_epochs is set as one by defaults, and epochs you passed in this case is set as zero

image

From my understanding - in this example, we are defining a pre-trained cnn learner (which is resnet34), and then calling fine_tune() on that model (with pre-trained weights). The. .fine_tune() takes in a few params, the first being number of epochs. So in your code above, we are explicitly saying to run through each item in the dataset once. Interestingly enough, the fine_tune actually re-uses .fit_one_cycle (which is super cool in it of itself) in addition to some unfreezing and freezing of weights. (thread discussing the difference here)

image

image

image

On using more features, I was able to get better accuracy than the example provided in the book:

image

AttributeError                            Traceback (most recent call last)
<ipython-input-10-fcb0d9b3a15b> in <module>()
----> 1 urls = search_images_ddg('grizzly bear')
      2 len(urls),urls[0]
/usr/local/lib/python3.7/dist-packages/fastbook/__init__.py in search_images_ddg(term, max_images)
     55     assert max_images<1000
     56     url = 'https://duckduckgo.com/'
---> 57     res = urlread(url,data={'q':term}).decode()
     58     searchObj = re.search(r'vqd=([\d-]+)\&', res)
     59     assert searchObj
AttributeError: 'str' object has no attribute 'decode'

The error can be easily solved by remove decode() function in line no 57. Since the PR for that changes has not yet been merged in fastai repo, I used DuckDuckGoImages package for downloading images with the below code:

image

Relevant links for this week ➡️: