Spaces:
Sleeping
Sleeping
Sreekanth Tangirala
commited on
Commit
·
ed738e7
1
Parent(s):
d42cc33
updated Readme and logs md
Browse files- Readme.md +48 -0
- logs/training_log_20250104_071323.md +21 -51
Readme.md
ADDED
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ResNet50 Model Implementation
|
2 |
+
|
3 |
+
This implementation provides a customizable ResNet50 model for image classification tasks.
|
4 |
+
|
5 |
+
## Model Architecture
|
6 |
+
|
7 |
+
The model uses the ResNet50 architecture, which is a deep convolutional neural network with 50 layers. Key features include:
|
8 |
+
|
9 |
+
- Based on the standard ResNet50 architecture
|
10 |
+
- Customizable number of output classes
|
11 |
+
- Modified final fully connected layer to match the desired number of classes
|
12 |
+
- Initialized from scratch (no pre-training)
|
13 |
+
|
14 |
+
## Functions
|
15 |
+
|
16 |
+
### `get_model(num_classes)`
|
17 |
+
Initializes a new ResNet50 model with a custom number of output classes.
|
18 |
+
- **Input**: Number of classes (integer)
|
19 |
+
- **Output**: Initialized ResNet50 model
|
20 |
+
- **Note**: The model is initialized without pre-trained weights
|
21 |
+
|
22 |
+
### `save_model(model, path)`
|
23 |
+
Saves the model's state dictionary to a specified path.
|
24 |
+
- **Input**:
|
25 |
+
- model: Trained PyTorch model
|
26 |
+
- path: File path for saving the model
|
27 |
+
|
28 |
+
### `load_model(num_classes, path)`
|
29 |
+
Loads a previously saved model.
|
30 |
+
- **Input**:
|
31 |
+
- num_classes: Number of output classes
|
32 |
+
- path: Path to the saved model file
|
33 |
+
- **Output**: Loaded ResNet50 model
|
34 |
+
|
35 |
+
## Usage Example
|
36 |
+
|
37 |
+
```python
|
38 |
+
model = get_model(num_classes=1000)
|
39 |
+
save_model(model, 'model.pth')
|
40 |
+
loaded_model = load_model(num_classes=1000, path='model.pth')
|
41 |
+
```
|
42 |
+
|
43 |
+
#Training Logs
|
44 |
+

|
45 |
+

|
46 |
+

|
47 |
+
|
48 |
+
|
logs/training_log_20250104_071323.md
CHANGED
@@ -1,56 +1,26 @@
|
|
1 |
# Training Log
|
2 |
|
3 |
-
| Epoch | Train Loss | Train Acc | Test Acc | Best Acc |
|
4 |
-
|
5 |
-
| 1 | 2.101 | 21.95% | 29.35% | 0.00% |
|
6 |
-
|
7 |
-
|
8 |
-
|
|
9 |
-
|
10 |
-
|
11 |
-
|
|
12 |
-
|
|
13 |
-
|
14 |
-
|
15 |
-
|
|
16 |
-
|
|
17 |
-
|
18 |
-
|
19 |
-
|
|
20 |
-
|
21 |
-
|
22 |
-
|
|
23 |
-
|
24 |
-
|
25 |
-
| 9 | 1.347 | 51.07% | 53.50% | 51.85% |
|
26 |
-
**New best accuracy achieved at epoch 9**
|
27 |
-
|
28 |
-
| 10 | 1.294 | 53.89% | 55.95% | 53.50% |
|
29 |
-
**New best accuracy achieved at epoch 10**
|
30 |
-
|
31 |
-
| 11 | 1.220 | 56.07% | 55.75% | 55.95% |
|
32 |
-
| 12 | 1.173 | 58.45% | 56.25% | 55.95% |
|
33 |
-
**New best accuracy achieved at epoch 12**
|
34 |
-
|
35 |
-
| 13 | 1.125 | 60.20% | 59.00% | 56.25% |
|
36 |
-
**New best accuracy achieved at epoch 13**
|
37 |
-
|
38 |
-
| 14 | 1.042 | 63.76% | 60.40% | 59.00% |
|
39 |
-
**New best accuracy achieved at epoch 14**
|
40 |
-
|
41 |
-
| 15 | 0.997 | 65.18% | 62.35% | 60.40% |
|
42 |
-
**New best accuracy achieved at epoch 15**
|
43 |
-
|
44 |
-
| 16 | 0.955 | 66.08% | 66.00% | 62.35% |
|
45 |
-
**New best accuracy achieved at epoch 16**
|
46 |
-
|
47 |
-
| 17 | 0.908 | 68.75% | 68.30% | 66.00% |
|
48 |
-
**New best accuracy achieved at epoch 17**
|
49 |
-
|
50 |
-
| 18 | 0.881 | 69.69% | 67.45% | 68.30% |
|
51 |
-
| 19 | 0.844 | 70.84% | 73.30% | 68.30% |
|
52 |
-
**New best accuracy achieved at epoch 19**
|
53 |
-
|
54 |
|
55 |
**Training stopped at epoch 19 after reaching target accuracy of 70%**
|
56 |
|
|
|
1 |
# Training Log
|
2 |
|
3 |
+
| Epoch | Train Loss | Train Acc | Test Acc | Best Acc | Best Epoch |
|
4 |
+
|-------|------------|-----------|-----------|----------|-------------|
|
5 |
+
| 1 | 2.101 | 21.95% | 29.35% | 0.00% | 1 |
|
6 |
+
| 2 | 1.875 | 30.13% | 34.70% | 29.35% | 2 |
|
7 |
+
| 3 | 1.778 | 34.90% | 34.60% | 34.70% | 3 |
|
8 |
+
| 4 | 1.714 | 36.99% | 40.80% | 34.70% | 4 |
|
9 |
+
| 5 | 1.646 | 40.05% | 40.15% | 40.80% | 5 |
|
10 |
+
| 6 | 1.587 | 42.39% | 43.00% | 40.80% | 6 |
|
11 |
+
| 7 | 1.513 | 45.59% | 47.30% | 43.00% | 7 |
|
12 |
+
| 8 | 1.436 | 48.44% | 51.85% | 47.30% | 8 |
|
13 |
+
| 9 | 1.347 | 51.07% | 53.50% | 51.85% | 9 |
|
14 |
+
| 10 | 1.294 | 53.89% | 55.95% | 53.50% | 10 |
|
15 |
+
| 11 | 1.220 | 56.07% | 55.75% | 55.95% | 11 |
|
16 |
+
| 12 | 1.173 | 58.45% | 56.25% | 55.95% | 12 |
|
17 |
+
| 13 | 1.125 | 60.20% | 59.00% | 56.25% | 13 |
|
18 |
+
| 14 | 1.042 | 63.76% | 60.40% | 59.00% | 14 |
|
19 |
+
| 15 | 0.997 | 65.18% | 62.35% | 60.40% | 15 |
|
20 |
+
| 16 | 0.955 | 66.08% | 66.00% | 62.35% | 16 |
|
21 |
+
| 17 | 0.908 | 68.75% | 68.30% | 66.00% | 17 |
|
22 |
+
| 18 | 0.881 | 69.69% | 67.45% | 68.30% | 18 |
|
23 |
+
| 19 | 0.844 | 70.84% | 73.30% | 68.30% | 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
**Training stopped at epoch 19 after reaching target accuracy of 70%**
|
26 |
|