Lesson 2 - Official Topic

@rachel can @jeremy explain this RandomResizedCrop on the code plz

A post was merged into an existing topic: Lesson 2 - Non-beginner discussion

How is fastai’s DataBlock different from PyTorch’s DataLoader?

1 Like

We follow the Kaggle convention, where a test set is something you need to predict on. But as Jeremy said, you can have multiple validation sets in fastai if you have a labeled test set.

9 Likes

Is exporting for PyTorch / TensorFlow different than the default export?

Follow on after the reply: If we want to deploy a model outside of a premade webapp (e.g. to a Jetson Nano or a Google Coral), how would we export it for this case?

1 Like

Thank you for another great class!

2 Likes

Very interesting lesson! Thanks Jeremy and Rachel!

Is .predict() the most efficient way to do it? From what I understand in training you process batches of images at the time, there it seems you only process one at a time. I’m thinking about a queue to batch predictions requests

I’ll have a look at the paper. But if that were true, then sneeze and cough droplets would attenuate the virus rather than spread it.

IIRC the default export in FastAI gives you a pickle file whereas a PyTorch/TF model will give you respective weights in their own format

2 Likes

Not if you have many samples. Then get_preds would be ideal as you can run it over many batches of data

4 Likes

Thanks Jeremy and Rachel,
What needs to be installed on the deployment server to make sure our model works?
Do we need a GPU to run our models on the server?

No, you will not. CPU is sufficient.

2 Likes

Life is a Kaggle competition :slight_smile:

1 Like

Again, I am not well-versed in this topic, so I’ll defer to the experts. But in the paper I linked, there was this paragraph:

Finally, environmental conditions may impact transmission through effects on the vehicle itself, the respiratory droplet. The length of time a droplet remains airborne, and therefore available for inhalation, is dependent on its size: droplets of >20 μm in diameter settle out of the air rapidly, whereas those of <5 μm remain airborne for prolonged periods (16). Evaporation of water from respiratory droplets, which occurs more rapidly with declining RH, decreases droplet size and therefore increases the distance and time over which transmission can occur.

Relative humidity (RH) is very different from the moist droplets that are expelled during coughing or sneezing. The paper also notes that

influenza virus stability in an aerosol was shown to vary with RH

So, it’s at least conceivable to me that there are some pretty non-linear and unintuitive effects going on!

3 Likes

It randomly resizes the image and then crops it based on the size you pass it. There are nice visuals in the docs: https://dev.fast.ai/vision.augment#RandomResizedCrop

For the bing api search, can we just try the 7 day trial option?

1 Like

You can just call .predict(x) where x is what you want to run a prediction on which should be sufficient for Jeremy’s deploy to production model. If you want you can create a test set data loader. Here is the reference to the docs on a few ways to do it: http://dev.fast.ai/data.core#Add-test-set-for-inference

2 Likes

Fast.ai will generally always start you off with a pretrained model unless you tell it not to for vision models. For most problems you will want to start off with a pretrained model which is why that is the fast.ai default. If you look at the docs, you will see a parameter in the cnn_learner() function called pretrained. It is set to True by default, but you can optionally set it to False to get randomly initialized weights. Link to docs: http://dev.fast.ai/vision.learner#cnn_learner

1 Like

That’s what I picked and it seems to be working.