Lesson 2 In-Class Discussion ✅

Looking at the Teddy, Grizzly, Black Bear classification problem, what can I do If I have pictures with another animal, e.g. a Zebra, but no Zebra training data? Is there an option to say “other” in general in classification?

4 Likes

@SF-Study-Group - would it be possible to show the actual class above the image in FileDeleter? I’m guessing it would be super helpful.

Hey my " ```
urls = Array.from(document.querySelectorAll(’.rg_di .rg_meta’)).map(el=>JSON.parse(el.textContent).ou);
window.open(‘data:text/csv;charset=utf-8,’ + escape(urls.join(’\n’)));
``

is not opening a new window, the new window open for a sec then gets destroyed. No download option. I am using chrome on Mac. Any help pls?

2 Likes

Surely would have a low probability for all classes

My understanding is that .save(...) saves the weights for the model but not the model itself. We use create_cnn to create the model architecture, then we load in the saved weights with learn.load(...).

4 Likes

Wont deleting the photos reduce the efficiency of the model?

I’m so impressed by that project that figured out the hairiest dogs and baldest cats: https://rensdimmendaal.com/posts/feature-interpretation-for-breed-classifier/

The way it figures out the features in the model that were most distinctive (and then determines that they were hairyness / baldness) is brilliant. I don’t fully understand how it works - certainly not once it gets into sklearn.decomposition.PCA and LogisticRegression. Really hope we dive into this kind of thing more deeply in the rest of the course.

8 Likes

makes sense

Might it be good to have class labels listed on deleter as well, in case things belong to one of the classes, but the wrong class?

Isn’t it important that you keep the aspect ratio of images when scaling?

correct, it only saves the weights. I use torch.save(…) to save the whole thing (architecture and weights)

I think it would be nice if FileDeleter could display the label as well.

25 Likes

I had this problem and just switched from safari to Chrome for the image search to get the download to pop up

1 Like

fixed

This makes more sense in the context of valid, train and test folders that are usually present in a dataset. path would be the root of your dataset.

path
|-- train
    |-- img_trn_01.jpg
|-- test
    |-- img_tst_01.jpg
|-- valid
    |--- you get the idea
|-- etc...

You’d use train='.' if you don’t have separate folders inside your dataset. Just make sure to set the valid_pct as mentioned in the lecture, so you get a holdout validation set.

path
|-- img_01.jpg
|-- img_02.jpg
|-- img_03.jpg

Once again, I’m assuming this, so I’d like to be corrected if this is wrong.

But mine is getting saved as csv

Oh cool - could you provide a full example of saving a model with torch.save() and then loading it again with torch.load() and then using it for inference against a new piece of data? That would be really useful for serving models in production.

1 Like

Only deleting the ones that were complete mistakes to include (i.e. here we are looking at bears, so you would remove a picture of a bird since that won’t help classify types of bears), so won’t reduce the efficiency of the model.

Is there a way to move the files instead of hard deleting them with FileDeleter?

1 Like

So looking at Jeremy’s FileDeleter output, it seems that the size=224 parameter to ImageDataBunch rescales the images to 224, rather than cropping them to that size.

Is that correct, or does this depend entirely on the output of get_transforms()?

(And what’s the default if ds_tfms=None?)