This project provides an implementation of image classification for multiple datasets using the LeNet architecture. It supports MNIST and Cassava Leaf Disease datasets and includes a Streamlit-based user interface for convenient interaction.
- LeNet Model: Implements two variations of the LeNet architecture for grayscale (MNIST) and RGB (Cassava) images.
- Dataset Support:
- MNIST: Classifies handwritten digits.
- Cassava Leaf Disease: Identifies various diseases in cassava leaves and healthy leaves.
- Streamlit UI: A simple web application to classify uploaded or example images.
Ensure the following are installed:
- Python 3.7+
- Required Python libraries. (in
requirements.txt
) - Pretrained model weights:
- MNIST:
lenet_model_mnist.pt
- Cassava:
lenet_model_cassava.pt
- MNIST:
- Clone the repository:
git clone https://github.com/OxyzGiaHuy/LeNet_Streamlit.git cd LeNet_Streamlit
- Install dependencies:
pip install -r requirements.txt
Start the Streamlit application with the following command:
streamlit run app.py
- Dataset Selection:
- Choose between MNIST and Cassava Leaf Disease in the sidebar.
- Input Options:
- Upload an image file (JPG/PNG).
- Run an example image provided in the repository.
- Output:
- Displays the image.
- Shows the predicted label and confidence percentage.
- Input: Grayscale images (28x28)
- Layers:
- Conv2D (1 -> 6)
- Average Pooling
- Conv2D (6 -> 16)
- Average Pooling
- Fully Connected Layers
- Input: RGB images (150x150)
- Layers:
- Conv2D (3 -> 6)
- Average Pooling
- Conv2D (6 -> 16)
- Average Pooling
- Fully Connected Layers
LeNet_Streamlit/
|-- requirements.txt
|-- app.py # Main application script
|-- model/
| |-- lenet_model_mnist.pt # Pretrained MNIST model
| |-- lenet_model_cassava.pt # Pretrained Cassava model
|-- example/
|-- demo_8.png # Example MNIST image
|-- demo_cbsd.jpg # Example Cassava image
- Support for additional datasets.
- Integration with cloud services for model hosting.