A walk with fastai2 - Vision - Study Group and Online Lectures Megathread

Please I want to watch the lesson 2 video as I was not able to join the live stream. But it seems that the video is no longer available.

@muellerzr

@kofi thanks! I put the right one up there

What is the error? I ran it that day so that should all work

Thanks…
I also have some question from the first lesson:

  1. In the first video, when we were using ImageDataBunch.from_name_re(), we didn’t specify how the data was going to be split but we did that when we were using the DataBlock api.
  2. Also when i try to use shuffle =True i get this errror

Always check the source code :wink: (part of why I’m doing this study group is to get you guys more comfortable with it, hence why the end of the last lesson we went over it)

Take a look here and your questions will be answered:

A few hints if you’re struggling a bit following that:

cls.myFunc() means we’re running another function that is of that type. In this case, it goes from from_name_re -> from_name_func -> from_path_func

Let me know if you still have questions afterwards @kofi :slight_smile: and report back what you find!

Oh I get it now, it was using it by default. thanks @muellerzr .
What of the second question?

The second comes from the fact it’s not an available parameter, and has a default set in place for it instead that is always used. If you want to get that specific you’d be better using the mid-level or low-level DataBlock api :slight_smile:

So weird ran the exact same notebook now and no error.
I was getting the following error - NameError: name 'Cuda' is not defined
All works now. Thank you

1 Like

One possibility is I believe that in a future update they are getting rid of it, and you may have installed the dev version or something :slight_smile: (once it’s live I’ll update the notebooks with this change)

1 Like

Well so how do you do that. I am looking at the prototype for the DataBlock api and I can’t see how you would specify that.

ok… thanks

If you check further it can be seen in a call to .databunch (not in that particular notebook/file)

So after you make your block, when you do .databunch you can pass in shuffle=False. This is really more of a lower level API deal, where we create two data loaders and then pass them to DataBunch

Has anyone tried fastapi instead of Starlette? It is built on top of Starlette, and therefore you can do everything that Starlette supports quickly. It even generates docs automatically.

2 Likes

FastAPI is a great library IMO, deploying an API has gone from difficult to too-easy. :100:
(this is a good resource if anyone is interested https://www.youtube.com/watch?v=mkDxuRvKUL8)

1 Like

Hi vijayabhaskar

Yes its great, it also uses Pydantic, so you can specify your own data types, includes testing tools as well. https://fastapi.tiangolo.com/

cheers mrfabulous1 :smiley::smiley:

2 Likes

Thanks! I took a look at it and this helped me a lot. I will post my solution since I believe it is a common problems that would help others.

imgs = L()
path_train = path/'train'
imgs = verify_images(path_train.ls())
hashed_ids = [os.path.splitext(os.path.basename(im))[0] for im in imgs] 

This returns from a full path in an L() the desired hashed.

[‘a2b380442e’, ‘fff4c5a0f8’, ‘9e8dc3116f’, ‘0ddbf46844’, ‘edd73511dc’, ‘4045344683’, ‘fc03d4a895’, ‘4b00fd9217’, ‘41c740d0cc’, ‘c60d3022aa’]

These hashes can be then used to filter in the csv as follows:

df = pd.read_csv(path/'train_labels.csv')
df_filtered = df[df['hashed_id'].map(lambda x: x not in hashed_ids)] 

This df_filtered can then be safely used to create the datablock. :wink:

1 Like

I am running into some weird behavior. I am resizing my images to be 224*224 but somehow this is not having any effect :face_with_raised_eyebrow:
Anyone knows what is up here?

@mgloria remember item transforms are happening first, then batch transforms are performed each time a batch is called (they’re done on the fly). Try calling dbunch.one_batch() and you should get an error :wink:

(You should resize all your images in the item_tfm first if they are different sizes)

1 Like

Has anyone actually managed to go through the 01_Custom notebook to train a model? I am struggling a bit with something else and would love to use the approach @muellerzr took. But the fact that the livestream only shows what he would do rather than it acually working is not helpful.

Btw, great work @muellerzr but I would advise that showing your work would be greatly appreciated by many :slight_smile: