Run this model with HF Jobs
Run MeghanaVP/car-subtype-classifier on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/MeghanaVP/car-subtype-classifier. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/MeghanaVP/car-subtype-classifier on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use MeghanaVP/car-subtype-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use MeghanaVP/car-subtype-classifier with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://MeghanaVP/car-subtype-classifier") - Notebooks
- Google Colab
- Kaggle
Upload README.md
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109# π Car Classification Model (196 Classes)
## π Overview
This project implements a deep learning model for **fine-grained car classification** across **196 categories** using **TensorFlow/Keras** and an **EfficientNetB3 backbone**.
The model uses custom preprocessing, advanced pooling (GeM), and strong data augmentation to improve performance.
---
## π§ Model Architecture
* Backbone: **EfficientNetB3**
* Input Shape: `(224, 224, 3)`
* Output: `196 classes (softmax)`
* Total Parameters: **11,755,251**
### Key Components:
* Custom Layers:
* `CastToFloat32`
* `EfficientNetPreprocess`
* `GeMPooling`
* Data Augmentation:
* Random Flip
* Rotation
* Zoom
* Brightness & Contrast adjustment
* Translation
* Fully Connected Head:
* Dense β BatchNorm β ReLU β Dropout
* Final Softmax layer
---
## π Performance
* **Accuracy: 80%**
---
## π Model Details
* Weights file: `final_cars.keras`
* Model is reconstructed programmatically and **weights are loaded separately** to avoid serialization issues with Lambda layers.
---
## βοΈ Usage
### 1. Load Model
```python
from tensorflow.keras.models import load_model
# Use the provided architecture code
model.load_weights("final_cars.keras")
```
---
### 2. Inference Example
```python
import numpy as np
from tensorflow.keras.preprocessing import image
img = image.load_img("test.jpg", target_size=(224,224))
img = image.img_to_array(img)
img = np.expand_dims(img, axis=0)
predictions = model.predict(img)
print(predictions)
```
---
## ποΈ How It Works
1. Input image is augmented
2. Converted to float32
3. Preprocessed using EfficientNet preprocessing
4. Passed through EfficientNetB3 backbone
5. Features pooled using **GeM pooling**
6. Fully connected layers perform classification
---
## π‘ Highlights
* Avoids Lambda layer serialization issues using **custom registered layers**
* Uses **GeM pooling** instead of traditional average pooling
* Strong augmentation pipeline improves generalization
---
## π Notes
* Ensure TensorFlow version compatibility when loading weights
* Model expects input images resized to **224Γ224**
---
## π€ Author
Meghana PoojaryREADME.mdAdded+109