Upload 4 files
Browse files- EfficientNet.json +15 -0
- EfficientNetREADME.md +57 -0
- best_model.pth +3 -0
- efficientnet_results.txt +8 -0
EfficientNet.json
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"model_architecture": "efficientnet_b0",
|
3 |
+
"input_size": [3, 224, 224],
|
4 |
+
"num_classes": 10,
|
5 |
+
"dataset": "Custom Dataset",
|
6 |
+
"loss_function": "CrossEntropyLoss",
|
7 |
+
"optimizer": "AdamW",
|
8 |
+
"learning_rate": 0.001,
|
9 |
+
"epochs": 3,
|
10 |
+
"batch_size": 32,
|
11 |
+
"validation_accuracy": 85.3,
|
12 |
+
"class_to_idx": {"class_0": 0, "class_1": 1, "class_2": 2, "class_3": 3, "class_4": 4, "class_5": 5, "class_6": 6, "class_7": 7, "class_8": 8, "class_9": 9},
|
13 |
+
"device": "cuda",
|
14 |
+
"description": "This is an EfficientNet-B0 model trained on a custom dataset for image classification tasks."
|
15 |
+
}
|
EfficientNetREADME.md
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# EfficientNet-B0 Model for Image Classification
|
2 |
+
|
3 |
+
This repository contains an EfficientNet-B0 model trained on a custom dataset for image classification tasks.
|
4 |
+
|
5 |
+
## Model Details
|
6 |
+
|
7 |
+
- **Architecture**: EfficientNet-B0
|
8 |
+
- **Input Size**: 224x224 RGB images
|
9 |
+
- **Number of Classes**: 10
|
10 |
+
- **Dataset**: Custom dataset with 10 categories
|
11 |
+
- **Optimizer**: AdamW
|
12 |
+
- **Loss Function**: CrossEntropyLoss
|
13 |
+
- **Validation Accuracy**: 85.3%
|
14 |
+
- **Device Used for Training**: CUDA (GPU)
|
15 |
+
|
16 |
+
## Usage
|
17 |
+
|
18 |
+
### Load the Model
|
19 |
+
To load the model, use the following code:
|
20 |
+
|
21 |
+
```python
|
22 |
+
import torch
|
23 |
+
|
24 |
+
# Load model and metadata
|
25 |
+
model = torch.load("efficientnet-results-and-model.pth", map_location="cpu")
|
26 |
+
|
27 |
+
# Access class-to-index mapping
|
28 |
+
class_to_idx = model['class_to_idx']
|
29 |
+
|
30 |
+
# Load the state dictionary
|
31 |
+
state_dict = model['model_state_dict']
|
32 |
+
|
33 |
+
# Reconstruct EfficientNet-B0
|
34 |
+
from torchvision.models import efficientnet_b0
|
35 |
+
model = efficientnet_b0(weights=None)
|
36 |
+
model.classifier[1] = torch.nn.Linear(model.classifier[1].in_features, len(class_to_idx))
|
37 |
+
model.load_state_dict(state_dict)
|
38 |
+
model.eval()
|
39 |
+
|
40 |
+
print("Model successfully loaded!")
|
41 |
+
Training Details
|
42 |
+
Learning Rate: 0.001
|
43 |
+
Batch Size: 32
|
44 |
+
Epochs: 3
|
45 |
+
Augmentations:
|
46 |
+
Random Resized Crop
|
47 |
+
Horizontal Flip
|
48 |
+
Color Jitter
|
49 |
+
Normalization (mean: [0.485, 0.456, 0.406], std: [0.229, 0.224, 0.225])
|
50 |
+
Files in this Repository
|
51 |
+
efficientnet-results-and-model.pth: Trained model weights
|
52 |
+
efficientnet-config.json: Model configuration file
|
53 |
+
efficientnet-README.md: Documentation for this model
|
54 |
+
Acknowledgments
|
55 |
+
Framework: PyTorch
|
56 |
+
Pretrained Weights: TorchVision
|
57 |
+
Training: Mixed precision using torch.cuda.amp for efficient training on GPU.
|
best_model.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:48f6d560a736d516aa22f49f2dd388285a91ae42ab00679de29b09d216df7616
|
3 |
+
size 50127726
|
efficientnet_results.txt
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Using device: cpu
|
2 |
+
Epoch 1/3 - Loss: 354.2215, Accuracy: 59.81%
|
3 |
+
Validation Accuracy: 91.69%
|
4 |
+
Epoch 2/3 - Loss: 138.5075, Accuracy: 82.07%
|
5 |
+
Validation Accuracy: 93.89%
|
6 |
+
Epoch 3/3 - Loss: 102.8507, Accuracy: 86.63%
|
7 |
+
Validation Accuracy: 95.23%
|
8 |
+
Training complete. Best validation accuracy: 95.23%
|