MeghanaVP commited on
Commit
2bbf85c
Β·
verified Β·
1 Parent(s): da60172

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +109 -0
README.md ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # πŸš— Car Classification Model (196 Classes)
2
+
3
+ ## πŸ“Œ Overview
4
+
5
+ This project implements a deep learning model for **fine-grained car classification** across **196 categories** using **TensorFlow/Keras** and an **EfficientNetB3 backbone**.
6
+
7
+ The model uses custom preprocessing, advanced pooling (GeM), and strong data augmentation to improve performance.
8
+
9
+ ---
10
+
11
+ ## 🧠 Model Architecture
12
+
13
+ * Backbone: **EfficientNetB3**
14
+ * Input Shape: `(224, 224, 3)`
15
+ * Output: `196 classes (softmax)`
16
+ * Total Parameters: **11,755,251**
17
+
18
+ ### Key Components:
19
+
20
+ * Custom Layers:
21
+
22
+ * `CastToFloat32`
23
+ * `EfficientNetPreprocess`
24
+ * `GeMPooling`
25
+ * Data Augmentation:
26
+
27
+ * Random Flip
28
+ * Rotation
29
+ * Zoom
30
+ * Brightness & Contrast adjustment
31
+ * Translation
32
+ * Fully Connected Head:
33
+
34
+ * Dense β†’ BatchNorm β†’ ReLU β†’ Dropout
35
+ * Final Softmax layer
36
+
37
+ ---
38
+
39
+ ## πŸ“Š Performance
40
+
41
+ * **Accuracy: 80%**
42
+
43
+ ---
44
+
45
+ ## πŸ“‚ Model Details
46
+
47
+ * Weights file: `final_cars.keras`
48
+ * Model is reconstructed programmatically and **weights are loaded separately** to avoid serialization issues with Lambda layers.
49
+
50
+ ---
51
+
52
+ ## βš™οΈ Usage
53
+
54
+ ### 1. Load Model
55
+
56
+ ```python
57
+ from tensorflow.keras.models import load_model
58
+
59
+ # Use the provided architecture code
60
+ model.load_weights("final_cars.keras")
61
+ ```
62
+
63
+ ---
64
+
65
+ ### 2. Inference Example
66
+
67
+ ```python
68
+ import numpy as np
69
+ from tensorflow.keras.preprocessing import image
70
+
71
+ img = image.load_img("test.jpg", target_size=(224,224))
72
+ img = image.img_to_array(img)
73
+ img = np.expand_dims(img, axis=0)
74
+
75
+ predictions = model.predict(img)
76
+ print(predictions)
77
+ ```
78
+
79
+ ---
80
+
81
+ ## πŸ—οΈ How It Works
82
+
83
+ 1. Input image is augmented
84
+ 2. Converted to float32
85
+ 3. Preprocessed using EfficientNet preprocessing
86
+ 4. Passed through EfficientNetB3 backbone
87
+ 5. Features pooled using **GeM pooling**
88
+ 6. Fully connected layers perform classification
89
+
90
+ ---
91
+
92
+ ## πŸ’‘ Highlights
93
+
94
+ * Avoids Lambda layer serialization issues using **custom registered layers**
95
+ * Uses **GeM pooling** instead of traditional average pooling
96
+ * Strong augmentation pipeline improves generalization
97
+
98
+ ---
99
+
100
+ ## πŸ“Œ Notes
101
+
102
+ * Ensure TensorFlow version compatibility when loading weights
103
+ * Model expects input images resized to **224Γ—224**
104
+
105
+ ---
106
+
107
+ ## πŸ‘€ Author
108
+
109
+ Meghana Poojary