This project uses PyTorch to create, train, and evaluate a convolutional neural network (CNN) for image classification. The dataset is split into training (80%) and testing (20%) sets, and metrics such as loss and accuracy are tracked to analyze the model's performance.
Data Splitting : Splitting the dataset into training (80%) and testing (20%) sets using split.py
script.
- CNN Model : Construction of a network with convolutional layers, normalization, activation (ReLU), pooling, and a fully connected layer for classification.
- Advanced Optimization : Implementation of the SGD (Stochastic Gradient Descent) algorithm with hyperparameter tuning such as learning rate and momentum.
- Performance Analysis : Tracking metrics across epochs, including loss and accuracy.
- Visualization : Generation of a graph illustrating loss and accuracy over epochs, saved as a PDF.
The dataset contains the following classes:
- Annual Crop
- Forest
- River
- Sea Lake
- Highway
- Industrial
- Pasture
- Permanent Crop
- Residential
- Herbaceous Vegetation
Ensure the following libraries are installed:
- Python 3.x
- PyTorch
- Matplotlib
- Scikit-learn
- MySQL (if additional storage is needed)
The split.py
script in the other
directory splits the dataset into training and testing sets:
```python
from sklearn.model_selection import train_test_split
An example of usage is included in the script.
. Training Phase : Adjusting weights through backpropagation.
.Testing Phase : Evaluating the model's ability to generalize.
.Final Accuracy : 85% (training), 81% (testing).
.Observed Trends : Progressive decrease in loss, consistent increase in accuracy.
A graph illustrating loss and accuracy across epochs is generated and saved as a PDF.