The Image-Classifier-Neural-Network is designed to recognize handwritten numbers from an image using the MNIST dataset.
This repository contains code for an image classifier built using PyTorch. The classifier is trained on the MNIST dataset and is capable of predicting digits in images. The provided neural network architecture employs Convolutional Neural Networks (CNNs) to effectively identify and classify hand-written digits.
- Python 3.1x
- PyTorch
- OpenCV (cv2)
- NumPy
- Matplotlib
- Pillow (PIL)
-
Clone the repository:
git clone https://github.com/lemeBurns/your-repository.git
-
Install the required dependencies:
pip install -r requirements.txt
-
Download the MNIST dataset using the provided script or manually by running the Jupyter Notebook.
To run the image classifier:
- Ensure you have the required dependencies installed.
- Execute the Jupyter Notebook or Python script.
- The code trains a convolutional neural network on the MNIST dataset.
- After training, the model is saved as
model_state.pt
. - Test the model by loading the trained model and making predictions on new images. Provide image paths for testing.
The code trains an image classifier using the MNIST dataset. Adjust the number of epochs or other hyperparameters in the provided code snippet in the Jupyter Notebook or Python script.
#Training flow
for epoch in range(10): # train for 10 epochs
for batch in dataset:
# ... (rest of the training code)
To test the trained model on new images, use the code snippet provided in the Jupyter Notebook or Python script. Update the image paths to test the classifier on different images.
# Testing
img1 = Image.open('img_1.jpg')
# ... (rest of the testing code)