Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
## 🧠 Models Included
|
| 6 |
+
|
| 7 |
+
This repository provides three different trained PyTorch models for vehicle image classification:
|
| 8 |
+
|
| 9 |
+
| File Name | Type | Description |
|
| 10 |
+
| ----------------------------------------- | --------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
| 11 |
+
| `best_model_finetuned_full.pt` | PyTorch `.pt` | Xception model with **two-phase transfer learning**, fine-tuned on the full dataset. Best generalization and accuracy. |
|
| 12 |
+
| `cnn_model_statedict_20260226_034332.pth` | PyTorch `.pth` | **Custom CNN** trained from scratch. Baseline performance, high variance on unseen data. |
|
| 13 |
+
| `model.safetensors` | PyTorch `safetensors` | Lightweight **unified CNN model**, faster loading and inference, safe for sharing and reproducible deployment. |
|
| 14 |
+
|
| 15 |
+
### 🔗 How to Load
|
| 16 |
+
|
| 17 |
+
**PyTorch `.pt` or `.pth`:**
|
| 18 |
+
|
| 19 |
+
```python
|
| 20 |
+
import torch
|
| 21 |
+
|
| 22 |
+
# Load full model
|
| 23 |
+
model = torch.load("best_model_finetuned_full.pt")
|
| 24 |
+
model.eval()
|
| 25 |
+
|
| 26 |
+
# Or load CNN state dict
|
| 27 |
+
cnn_model = CustomCNN(num_classes=7)
|
| 28 |
+
cnn_model.load_state_dict(torch.load("cnn_model_statedict_20260226_034332.pth"))
|
| 29 |
+
cnn_model.eval()
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
**Safetensors:**
|
| 33 |
+
|
| 34 |
+
```python
|
| 35 |
+
from safetensors.torch import load_file
|
| 36 |
+
|
| 37 |
+
state_dict = load_file("model.safetensors")
|
| 38 |
+
model.load_state_dict(state_dict)
|
| 39 |
+
model.eval()
|
| 40 |
+
```
|