Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stanford Car Image Classification #488

Merged
merged 2 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Stanford Car Image Classification/Dataset/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Dataset link: https://www.kaggle.com/datasets/jutrera/stanford-car-dataset-by-classes-folder
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
91 changes: 91 additions & 0 deletions Stanford Car Image Classification/Model/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
**Stanford Car Image Classification**

**GOAL**

This project aims at using the stanford cars data set to build a model that can recognize the type of the car given a picture of it.

**DATASET**

https://www.kaggle.com/datasets/jutrera/stanford-car-dataset-by-classes-folder

**DESCRIPTION**

The project starts with understanding the data and then proceeds to build and evaluate different image classification models.

**WHAT I HAD DONE**

- Importing neccesary libraries

- Reading and understanding the data

- Data transformations

- Creating a validation set

- Training a convolutional neural network model

- Adding Addtional layers and Batch Normalization and Dropout layers to the CNN model

- Fine-tuning resnet34 model

- used data augmentation to imporove the accuracy of the pretrained model

**MODELS USED**

1. Convolutional Neural Network: The state-of-the-art model for image recognition tasks

2. ResNet34: ResNet34 is favored for image classification due to its ability to train very deep networks effectively, mitigating vanishing gradient issues with skip connections, resulting in improved generalization, parameter efficiency, and state-of-the-art performance.


**LIBRARIES NEEDED**

- Pytorch

- Matplotlib


**VISUALIZATION**


Accuracy of CNN model:
<img src="../Images/cnn1 accuracy.png" alt="Accuracy of CNN model" style="width:100%">

Losses of CNN model:
<img src="../Images/cnn2 loss.png" alt="Losses of CNN model" style="width:100%">

Accuracy of CNN model after adding more layers and batch normalization and dropout layers:
<img src="../Images/cnn2 accuracy.png" alt="Accuracy of CNN model after adding more layers and batch normalization and dropout layers" style="width:100%">

Losses of CNN model after adding more layers and batch normalization and dropout layers:
<img src="../Images/cnn2 loss.png" alt="Losses of CNN model after adding more layers and batch normalization and dropout layers" style="width:100%">

Accuracy of fine-tuned ResNet34 model:
<img src="../Images/Accuracy of resnet34.png" alt="Accuracy of fine-tuned ResNet34 model" style="width:100%">

Losses of fine-tuned ResNet34 model:
<img src="../Images/losses of resnet34.png" alt="Losses of fine-tuned ResNet34 model" style="width:100%">

Accuracy of fine-tuned ResNet34 model After data augmentation:
<img src="../Images/Accuracy of data augmented resnet34.png" alt="Accuracy of fine-tuned ResNet34 model After data augmentation" style="width:100%">

Losses of fine-tuned ResNet34 model After data augmentation:
<img src="../Images/losses of data augmented resnet34.png" alt="Losses of fine-tuned ResNet34 model After data augmentation" style="width:100%">


**ACCURACIES**

1. CNN Model: 0.5%

2. CNN model after adding more layers: 0.8%

3. ResNet34: 35%

4. ResNet34 after data augmentation: 69%

**CONCLUSION**

The data augmented ResNet34 is the best model for our project

**Contribution by**

[Ahmed Anwar](https://www.linkedin.com/in/ahmed-anwar-637ab3225/)

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions Stanford Car Image Classification/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- pytorch

- torch vision

- matplotlib

- a GPU (CPU could be used but the code will take much longer to run)