Lesson 3 - Official Topic

This is a good question. I think it’s helpful to be even more specific about your audience-- not just beginners, but say, beginners with X particular background or Y previous experience. The more specific you can be about your audience the better. It’s also helpful to think about what specific things were missing or difficult for you 6 months ago. Was there a topic or concept that you couldn’t find an explanation that really made sense (even if there were plenty of posts about it)? An alternate way of approaching this is to spend time answering questions for others (potentially here on the forums) to see what is missing in the way of learning materials

10 Likes

I don’t know if anyone has noticed that the fileupload widget is in version 7.5.0 of ipywidgets. I can’t seem to find it in newer versions.

No, it’s where it should be in TfmdDL.show_batch. Note that dls.train is a TfmdDL.

2 Likes

Yes, you need to pin that version.

2 Likes

On a CPU also, Is a PyTorch tensor more efficient than a numpy array for mathematical computations?

How can we display the number of pixels in our image?

On most functions, it’s the same speed.

1 Like

tensor.shape usually gives you that. Multiply the dimensions to get the number of pixels.

3 Likes

A tensor has a shape (that will give you height x width) or a numel (which will give you the number of elements).

2 Likes

Can we do with PIL before converting to a tensor?

In that case, when then would it be more useful to use array over tensors? :sweat_smile:

A PILImage has a size attributes.
In general, in a notebook, type dir(object) and you will see all the available attributes of that object.

2 Likes

One thing PyTorch Tensors do not support are “jagged arrays” with arrays of variable size arrays (discussed in book). Numpy does…

1 Like

Only if your function does not exist in PyTorch yet (there are a few left). fastai2 only uses numpy arrays to patch the brigde with scikit-learn, which is a library that has lots of interesting metrics.

1 Like

Ah! I’m assuming this is done in fastaiv2 to integrate the ensembling, gradient boosting tree models etc. using scikit-learn…

and it is divided by 255 because uint8 from 0 to 255?

ahh I forgot to look at the type of dls.train instead of dls

Exactly

1 Like

Not only that, but also metrics, losses… All that fun sklearn stuff

1 Like

Black and white can be between 0 and 1, how are color images interpreted in this format?