# 🚗 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 Poojary