ImageClassifier is a Python project utilizing Convolutional Neural Networks (CNNs) to classify images into ten different categories. This project uses the CIFAR-10 dataset, which includes images of airplanes, cars, birds, cats, deer, dogs, frogs, horses, ships, and trucks. The model is built using TensorFlow and Keras with a simple yet effective architecture to ensure high accuracy and performance.
Before running this project, you'll need to have the following installed:
- Python
- TensorFlow
- OpenCV (cv2)
- NumPy
- Matplotlib
Clone the repository to your local machine:
git clone https://github.com/yourusername/ImageClassifier.gitNavigate to the cloned directory:
cd ImageClassifierInstall the required packages:
pip install -r requirements.txtThe project uses the CIFAR-10 dataset, automatically loaded via TensorFlow's dataset module. It includes 60,000 32x32 color images in 10 different classes, with 6,000 images per class. The dataset is divided into 50,000 training images and 10,000 testing images.
The neural network model consists of three convolutional layers followed by max pooling layers, a flattening layer, and two dense layers. The model uses the ReLU activation function for its hidden layers and softmax for its output layer, optimizing the sparse categorical crossentropy loss function with the Adam optimizer.
The model is trained on a subset of 20,000 images from the training set for efficiency and tested on a subset of 4,000 images from the test set. It undergoes training over 10 epochs to adjust weights for accurate predictions.
The model can classify images into one of the ten CIFAR-10 categories. It preprocesses the images by converting them to RGB, normalizing their pixel values, and resizing them to fit the input shape of the model before making predictions.
To classify your images, place them in the project directory and run the main script:
python image_classifier.pyEnsure your images are named appropriately (e.g., horse.jpg, car.jpg, etc.) as the script includes a predefined list of image filenames to process.
Contributions are welcome! If you'd like to improve the model, add features, or report a bug, please feel free to open an issue or a pull request.