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

Only one. And yes, this is due to memory constraints (due to the fact our image goes full size)

1 Like

In the CrossValidation nb and with the stratified K Fold code
I am running the nb:
and getting the following error:

ValueError: Found input variables with inconsistent numbers of samples: [9025, 7220]

Error makes sense for the following line:
for _, val_idx in kf.split(np.array(train_imgs), train_labels):
uses the entire train_imgs which is 9025 elements long whereas we only have train_labels for
the training set part of the training data which would mean we need to provide
train_imgs[:7220] to that line of cod AND
with that change my nb is running.

Am I doing something screwy or how was this worked around in the nb I downloaded a couple of days back which had the StratifiedKfold code I am using.

One more issue I found in that nb is that while skf is defined the actual use is of kf which is defined earlier in the nb.
skf is skf = StratifiedKFold(n_splits=10, shuffle=True)
while earlier in nb
kf is kf = StratifiedKFold(n_splits=5, shuffle=True)

and it so happens that nb uses kf as below in the CV loop
for _, val_idx in kf.split(np.array(train_imgs), train_labels)
but what we want to use is
for _, val_idx in skf.split(np.array(train_imgs[:7220]), train_labels)

to get 10 splits rather than 5 splits.

@Srinivas originally it was regular KFold and then someone implemented Stratified. I must not have updated the whole thing in the function.

I would love to see the Efficientnet example on image classification. Plus I heard the bigger version of it it is quite hard to train. Any recommendations for Pytorch courses?

1 Like

Hi,

I am trying to use the Migrating notebook from fastai2 to try to use some PyTorch code in fastai2.

It seems that everything work until I tried to fit_one_cycle when I got an error about pbar. Disable it does not seem to solve the issue. Here is the code with the error.

Any ideas how to solve the problem? Thanks

P.S.: Since is only kind of related, should I open a new post?

@Joan did you install the most recent version of fastprogress?

I think so:

fastprogress.__version__
ā€˜0.2.2ā€™

Unsure, I think this would be better as a separate forum post :slight_smile:

1 Like

I was looking today at how to run models with multiple data types (e.g. in my case, tabular and image). I finally managed to find this awesome blog post. It is for fastaiv1 but I will be exploring whereas it works for v2 also or could be easily adapted and update you all. I am sharing the link to it since I believe it could be of your interest at some point of your career!

2 Likes

@mgloria IIRC I believe someone was working on that as we speak (may help you get started) Follow the discussion here:

The hardest part was dealing with the tabular data itself (mixed image and text shouldnā€™t be hard since they have DataBlock's for them)

2 Likes

Iā€™ve never done a PyTorch course so I have none for you Iā€™m afraid :slight_smile:

A small suggestion @muellerzr , Since you mute some part of the video during the live stream, viewers who view the video after the live stream has to skip them manually, I found this project https://github.com/carykh/jumpcutter which will speed up those segments with no audio, save both your time and the viewers.
I tested it on one of your videos with default parameters and it converted 1h 15mins video down to 48mins video! Saved 17mins!!
I suggest you upload a copy of these edited videos for after stream viewers. :slightly_smiling_face:

5 Likes

@vijayabhaskar great find!!! Iā€™ll definitely do that :slight_smile:

3 Likes

I found this article recently, https://www.techrepublic.com/article/how-to-learn-pytorch-a-resources-guide-for-developers/ which has a list of good resources to learn pytorch, Iā€™m currently going through this https://notebooks.azure.com/pytorch/projects/tutorials which I got to know from the first link, So far I find those notebooks really useful. I also recommend you to look at https://github.com/rasbt/deeplearning-models which is a goldmine!

2 Likes

OK Thanks. Got it to work with Stratified-K Fold with a couple of small changes

1 Like

If you wanted to, you could PR it to the study group repo :wink:

Sorry. Too many other comments, what ifs and other unrelated changes that I made in the nb so I better understand how to work with various concepts so prob best to leave your nb alone.

On top of Gloriaā€™s mods to support Stratified-K Fold that are already incorporated in the nb,
the only two other things changes are:

  1. Use defined skf instead of kf in the loop:
    for _, val_idx in skf.split(np.array(train_imgs[:7220]), train_labels):
  2. as shown on the line above pass in np.arrary(train_imgs[:7220]) instead of np.array(train_imgs) as first parameter to skf.split.

That is it .

I am printing the summary of a datablock
auds.summary(data_p)

But I am getting the following error. I am very new to fastai2, how should I debug it?

Setting-up type transforms pipelines
Collecting items from /content/clips3
Found 2000 items
2 datasets of sizes 1600,400
Setting up Pipeline: (#2) [Transform: True (object,object) -> noop ,Transform: True (object,object) -> create ]
Setting up Pipeline: (#2) [Transform: True (object,object) -> create_label ,Categorize: True (object,object) -> encodes (object,object) -> decodes]

Building one sample
Pipeline: (#2) [Transform: True (object,object) -> noop ,Transform: True (object,object) -> create ]
starting from
/content/clips3/2019-11-14-03-49-41-693116.wav


AttributeError Traceback (most recent call last)
in ()
----> 1 auds.summary(data_p)

1 frames
/usr/local/lib/python3.6/dist-packages/fastai2/data/block.py in _apply_pipeline(p, x)
109 print(f" {p}\n starting from\n {_short_repr(x)}")
110 for f in p.fs:
ā€“> 111 name = f.name
112 try:
113 x = f(x)

AttributeError: ā€˜Transformā€™ object has no attribute ā€˜nameā€™

@shruti_01 It looks like possibly you may be using a custom transform? You should give it a .name property for summary to pick up what to call it

Otherwise not much we can do without seeing how the datablock was formed :slight_smile: