Lesson 1 official topic

Hi citaconrama! That is explained in the lesson 3 lecture (here’s a link).

2 Likes

Hi there, so I recognize that this might be an obvious question to some, but I am lost on what even the first step to setup is. Do I need to be downloading something/renting a new machine or am I able to complete the entire course with a Kaggle notebook or Jupyter notebooks? If so what are the links to those notebooks.

Welcome. All you need is to run notebooks in Kaggle or Colab.

To get started, follow the videos, look for the lesson links and additional resources at the bottom of each page, that is where you will find additional notes on how to use Kaggle etc.

(No need to setup your own hardware. - you can finish the course without going down that rabbit hole yet)

I need help adding pictures to jupyter notebook.
The “copy paste” instructions do not work.
Drag and drop also does not work.
Is there another way to add local images into the notebook?

Thanks
j

Figured it out.
I was in a Code cell and thus only the file name copied in.
Pasting in a markdown cell works as expected.

j

You migth find the Live Walkthrough useful… Live-coding (aka walk-thrus) ✅

1 Like

Thanks from the live Walkthrough links Ben . The first lesson was very helpful! I have another question. How do I install the fastai library?

2 Likes

Hello,
I just started the 1st FastAI course in conjunction with the recommended book.
The author advises to use tools like Kaggle or Paperspace instead of using the local environment, for practical reasons (GPU in particular)

What do you recommend? Kaggle or PaperSpace?

What is the general process? git clone the fastai github repository onto a Kaggle notebook and then browse each notebook?
Although I did it, I could not navigate, not being too familiar with the Kaggle platform, I see the .ipnyb file names available, but I can’t access each of the cloned notebooks from the notebook.

Sounds like ‘GPU’ is not selected. See this thread for my note on how to select it.

1 Like

Hi Saad,

I haven’t checked out PaperSpace so far, so wouldn’t be able to give a comparison. But here is the process to run the notebooks on other platforms.

If you are looking to run the code in the book then you can use colab: https://colab.research.google.com/

  • What you can do is simply replace github.com to Google Colab and the rest of the address. For example: https:// github.com/ fastai/fastbook/blob/master/01_intro.ipynb can be opened on colab with https:// colab.research.google.com/ github/ fastai/fastbook/blob/master/01_intro.ipynb (Note: I’ve added spaces in the URL as it was turning the URL into a hyperlink and the modification wouldn’t be clear)

  • In order to use GPU on colab, you can “change runtime type” to add a GPU accelerator

In addition to the text book code, the official notebook for this lecture is on Kaggle already: Is it a bird? Creating a model from your own data | Kaggle
So all you have to do is, copy and run it within Kaggle. Then you can modify it according to the problem of your choice!

Hello,
I just completet lesson 1 and tried to alter the official Kaggle notebook. I added a dataset of chess pieces and want to classify them, but I get bad results quite often.

  • Some pieces are classified correctly
  • Some easy looking pieces are classified incorrectly (check link for an example)
  • Kings are always classified incorrectly

Can someone please help me out? I tried a few different things but I just can’t find the reason… https://www.kaggle.com/code/maxwe000/is-it-a-king-creating-a-model-from-your-own-data

Anyone tried toying with image segmentation?

I tried to modify the segmentation code from the textbook so that it could do image segmentation on my choice of images like the streets of Dubai or Paris.

For classification, we do learn.predict() at the end on our choice of input image and it gives the prediction along with the probabilities.

What to do for segmentation? I tried learn.segment() :see_no_evil: :sweat_smile: but there is no such thing as that.

Please help.

Sharing the NB below.

Segmentation as introduced in lession 1 seems to be connected to classification (classifying different pixels). Is there a different term for regression-segmentation (things like heatmaps etc)

You do learn.predict() after training your model to classify (or segment) a new image where you don’t have the correct label or segmentation mask (thats called “inference”). The .predict() method is agnostic to what task you are trying to solve.

Here is the relevant segment of the fast.ai documentation for semantic segmentation, this may nudge you in the right direction: fastai - Computer vision intro

1 Like

You’ve hit the most common issue I’ve seen extrapolating from the bird/forest example…
Where that example was simplified by hardcoding zero in probs[0], you need to use the value ignored by the underscore…

i.e. instead of…

category,_,probs = learn.predict(PILImage.create('king.jpg'))
print(f"This is a: {category}.")
print(f"Probability it's a {category}: {probs[0]:.4f}")

use…

category,index,probs = learn.predict(PILImage.create('king.jpg'))
print(f"This is a: {category}.")
print(f"Probability it's a {category}: {probs[index]:.4f}")
2 Likes

Hi guys, I could use some assistance with the code… I am not using Jupyter Notebook rather I am using PyCharm (free edition without Jupyter Notebook). I am encountering an issue when trying to download the images from this code

searches = 'forest','bird'
path = Path('bird_or_not')
from time import sleep

#for o in searches:
#    dest = (path/o)
#    dest.mkdir(exist_ok=True, parents=True)
#    download_images(dest, urls=search_images(f'{o} photo'))
#    sleep(10)  # Pause between searches to avoid over-loading server
#    download_images(dest, urls=search_images(f'{o} sun photo'))
#    sleep(10)
#    download_images(dest, urls=search_images(f'{o} shade photo'))
#    sleep(10)
#    resize_images(path/o, max_size=400, dest=path/o)

The error that I get is

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\multiprocessing\spawn.py", line 125, in _main
    prepare(preparation_data)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\multiprocessing\spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 288, in run_path
    code, fname = _get_code_from_file(run_name, path_name)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.2544.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 252, in _get_code_from_file
    with io.open_code(decoded_path) as f:
OSError: [Errno 22] Invalid argument:

I cannot for the life of me figure it out so any help would be much appreciated

I can’t see it either. It doesn’t help that you are in the 0.1%** group approaching it like this. I recommend you install WSL Ubuntu on Windows and first get it working with Jupyter the way 99.9%** others do it. Once you are comfortable doing it that way, you will be better positioned to try again on Windows.

**Note, 72% of statistics are made up on the spot…

1 Like

Thanks for the fun stats. The thing is that I want to use PyCharm (free) since that is what I currently use for my job on a company machine with severely draconian restrictions… so Jupyter is a bit of a no go for me…

1 Like

On the “wecome to fastai” page on https://docs.fast.ai/, it is stated that:

You can use fastai without any installation by using Google Colab. In fact, every page of this documentation is also available as an interactive notebook - click “Open in colab” at the top of any page to open it.

Where is this “open in colab” button or link? On the top of the cited page, all I see is “CI failing”, “PyPI”, “Conda (channel only)”, “Build fastai”, and “images docs”. What am I missing?