Hey! Thanks for the comment and feedback!
My model is based on what I have learned so far from Chapter 2 of the fastai course, which is why I jumped to ResNet 101
. I did it incrementally, though. I started with ResNet18 then ResNet24 and so on till ResNet 101. With ResNet18, I had an error rate of about 24.4%. Not a substantial improvement.
I’m not able to share the dataset since it is large in size, but if you want to try to dabble in the same vein, you could also scrape images of DuckDuckGo. You can view the code at the bottom of this reply. I should remember for next time to link the code as well.
I classified the following car brands:
- Mercedez Benz
- Audi
- Aston Martin
- Ford
- Lamborghini
- Ferrari
- Chevrolet
- Alfa Romeo
- Renault
- Jaguar
That’s a good approach for error analysis: look through the photos with the highest loss and see what’s common in them. I’ll keep that in mind for next time.
I thought that the model would overfit by focusing on the car logos! But that was not the case. However, I don’t quite think that creating a model that recognizes car brands based on the logo would be a good idea as the model would not be able to generalize to the same car differently positioned. For example, the side profile of a car would not have the logo visible.
Is GradCam easy to use? I have not delved too deep into creating models yet, but I could give it a shot if it is simple enough and I’ve got the time.
Relevant portions of model Code:
# Datablock.
cars = DataBlock(
blocks=(ImageBlock, CategoryBlock),
get_items=get_image_files,
splitter=RandomSplitter(valid_pct=0.2, seed=42),
get_y=parent_label,
item_tfms=RandomResizedCrop(224, min_scale=0.5),
batch_tfms=aug_transforms(),
)
# Dataloaders.
dataloaders = cars.dataloaders(path, bs=32)
# Learner.
learn = cnn_learner(dataloaders, resnet101, metrics=error_rate)
learn.fine_tune(20)