{"id":15132075,"url":"https://github.com/rufilboss/image_classifier","last_synced_at":"2026-01-30T04:21:54.304Z","repository":{"id":257307883,"uuid":"856998527","full_name":"rufilboss/image_classifier","owner":"rufilboss","description":"Image Classifier using CIFAR-10 and TensorFlow/Keras","archived":false,"fork":false,"pushed_at":"2024-09-17T17:17:08.000Z","size":1748,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-12T00:38:16.092Z","etag":null,"topics":["image-classification","kera","keras-classification-models","open-source","opencv","python","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rufilboss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-13T15:55:48.000Z","updated_at":"2024-09-17T21:11:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"db1343dd-0258-4f5d-9c3e-8904fe6f3fa5","html_url":"https://github.com/rufilboss/image_classifier","commit_stats":null,"previous_names":["rufilboss/image_classifier"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rufilboss%2Fimage_classifier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rufilboss%2Fimage_classifier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rufilboss%2Fimage_classifier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rufilboss%2Fimage_classifier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rufilboss","download_url":"https://codeload.github.com/rufilboss/image_classifier/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247399883,"owners_count":20932880,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image-classification","kera","keras-classification-models","open-source","opencv","python","tensorflow"],"created_at":"2024-09-26T04:03:13.869Z","updated_at":"2026-01-30T04:21:49.275Z","avatar_url":"https://github.com/rufilboss.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Image Classifier using CIFAR-10 and TensorFlow/Keras\r\n\r\nThis project is an image classification model built using the CIFAR-10 dataset. It leverages the TensorFlow/Keras library to train a Convolutional Neural Network (CNN) for recognizing images from ten different classes, including planes, cars, birds, cats, and more. The project demonstrates how to preprocess data, train a model, and make predictions on new images.\r\n\r\n## Table of Contents\r\n\r\n- [Overview](#overview)\r\n- [Features](#features)\r\n- [Dataset](#dataset)\r\n- [Installation](#installation)\r\n- [Usage](#usage)\r\n- [Training the Model](#training-the-model)\r\n- [Making Predictions](#making-predictions)\r\n- [Results](#results)\r\n- [Contributing](#contributing)\r\n- [License](#license)\r\n\r\n## Overview\r\n\r\nThe goal of this project is to create a basic image classifier using the CIFAR-10 dataset. The CIFAR-10 dataset contains 60,000 32x32 color images in 10 classes, with 6,000 images per class. The model uses a convolutional neural network (CNN) for classifying the images into one of the ten categories.\r\n\r\nThe project includes the following main steps:\r\n\r\n1. Loading and normalizing the CIFAR-10 dataset.\r\n2. Visualizing a subset of the training data.\r\n3. Training a CNN on the training dataset.\r\n4. Evaluating the model's performance on the test dataset.\r\n5. Using the trained model to make predictions on new images.\r\n\r\n## Features\r\n\r\n- Preprocesses CIFAR-10 images and labels.\r\n- Visualizes sample images from the dataset.\r\n- CNN model with three convolutional layers followed by dense layers for classification.\r\n- Model evaluation and prediction on new images.\r\n\r\n## Dataset\r\n\r\nThe project uses the CIFAR-10 dataset, which contains 60,000 color images in 10 different categories:\r\n\r\n- Airplane\r\n- Car\r\n- Bird\r\n- Cat\r\n- Deer\r\n- Dog\r\n- Frog\r\n- Horse\r\n- Ship\r\n- Truck\r\n\r\nThe dataset is automatically loaded from TensorFlow’s `keras.datasets` module.\r\n\r\n## Installation\r\n\r\nTo run this project, ensure you have Python 3.x installed, along with the following libraries:\r\n\r\n- TensorFlow/Keras\r\n- OpenCV\r\n- NumPy\r\n- Matplotlib\r\n\r\nYou can install the required dependencies using `pip`:\r\n\r\n```bash\r\npip install tensorflow opencv-python-headless numpy matplotlib\r\n```\r\n\r\n## Usage\r\n\r\nTo use this project, follow these steps:\r\n\r\n1. Clone the repository to your local machine:\r\n\r\n   ```bash\r\n   git clone https://github.com/rufilboss/image-classifier.git\r\n   cd image-classifier\r\n   ```\r\n\r\n2. (Optional) Train the model:\r\n   If you want to retrain the model with custom settings, uncomment the training section in the code.\r\n\r\n3. Run the image classifier:\r\n\r\n   ```bash\r\n   python3 main.py\r\n   ```\r\n\r\n4. Make predictions on new images by placing an image named `test.jpg` in the project directory.\r\n\r\n## Training the Model\r\n\r\nThe model is built using TensorFlow/Keras and consists of the following layers:\r\n\r\n- 3 Convolutional layers followed by MaxPooling layers\r\n- 1 Flatten layer to convert the 2D output to 1D\r\n- 2 Dense (fully connected) layers, with the last layer being the output layer with 10 units (one for each class) and a softmax activation function.\r\n\r\nThe model is trained for 10 epochs using the Adam optimizer and sparse categorical cross-entropy as the loss function.\r\n\r\nTo train the model, uncomment the training code in `main.py`:\r\n\r\n```python\r\n# model.fit(training_images, training_labels, epochs=10, validation_data=(testing_images, testing_labels))\r\n```\r\n\r\nAfter training, the model is saved to a file `image_classifier.keras`.\r\n\r\n## Making Predictions\r\n\r\nOnce the model is trained or loaded, you can make predictions on new images. The project demonstrates this by loading an image, resizing it to the required dimensions (32x32), and predicting its class:\r\n\r\n```python\r\nimg = cv.imread('test.jpg')\r\nimg = cv.cvtColor(img, cv.COLOR_BGR2RGB)\r\nimg = resize(img, (32, 32))\r\nimg = img_to_array(img)\r\nprediction = model.predict(np.array([img]) / 255)\r\nindex = np.argmax(prediction)\r\nprint(f\"Prediction is: {class_names[index]}\")\r\n```\r\n\r\nThis code assumes that the image is named `test.jpg` and is located in the project directory.\r\nYou can replace `test.jpg` with any image of your choice.\r\n\r\n## Results\r\n\r\nThe model has a moderate accuracy on the CIFAR-10 test set. With additional tuning or training for more epochs, accuracy could be improved.\r\n\r\nExample prediction:\r\n\r\n```sh\r\nPrediction is: Horse\r\n```\r\n\r\n## Contributing\r\n\r\nContributions to this project are welcome! Feel free to open issues or submit pull requests to enhance the project.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\r\n\r\n```sh\r\nYou can modify and customize this `README.md` to fit additional details or project-specific configurations you want to highlight.\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frufilboss%2Fimage_classifier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frufilboss%2Fimage_classifier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frufilboss%2Fimage_classifier/lists"}