{"id":21301328,"url":"https://github.com/sajalkmr/imageclassification","last_synced_at":"2026-04-05T20:41:01.366Z","repository":{"id":117935718,"uuid":"586587172","full_name":"sajalkmr/ImageClassification","owner":"sajalkmr","description":"Build a CNN Image classifier model using your own images with Tensorflow","archived":false,"fork":false,"pushed_at":"2023-03-09T09:41:58.000Z","size":105986,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-22T08:12:43.837Z","etag":null,"topics":["cnn","cnn-classification","cnn-keras","cnn-model","deep-learning","image-classification","jupyter-notebook","keras","machine-learning","opencv","python","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/sajalkmr.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":"2023-01-08T16:56:40.000Z","updated_at":"2024-08-11T09:17:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"197bfe7a-5c27-4f09-8951-a931b723b306","html_url":"https://github.com/sajalkmr/ImageClassification","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sajalkmr%2FImageClassification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sajalkmr%2FImageClassification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sajalkmr%2FImageClassification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sajalkmr%2FImageClassification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sajalkmr","download_url":"https://codeload.github.com/sajalkmr/ImageClassification/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243772087,"owners_count":20345580,"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":["cnn","cnn-classification","cnn-keras","cnn-model","deep-learning","image-classification","jupyter-notebook","keras","machine-learning","opencv","python","tensorflow"],"created_at":"2024-11-21T15:45:05.852Z","updated_at":"2025-12-31T00:21:36.031Z","avatar_url":"https://github.com/sajalkmr.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n\u003ch1\u003eImage Classifier\u003c/h1\u003e\n\u003cp\u003eThis project provides a script to train a convolutional neural network (CNN) on a dataset of images. The script is written in Python and uses TensorFlow and OpenCV. The model can classify images into different classes based on the dataset provided.\u003c/p\u003e\n\n\u003ch2\u003eRequirements\u003c/h2\u003e\n\u003cul\u003e\n  \u003cli\u003eTensorflow\u003c/li\u003e\n  \u003cli\u003eTensorflow-gpu\u003c/li\u003e\n  \u003cli\u003eOpenCV-python\u003c/li\u003e\n  \u003cli\u003eMatplotlib\u003c/li\u003e\n\u003c/ul\u003e\n\n\u003ch2\u003eUsage\u003c/h2\u003e\n\u003col\u003e\n  \u003cli\u003eClone or download the repository.\u003c/li\u003e\n  \u003cli\u003eMake sure that you have the required libraries installed.\u003c/li\u003e\n  \u003cli\u003ePlace your dataset in a directory called 'training_data'\u003c/li\u003e\n  \u003cli\u003eOpen the Jupyter notebook by running the command \"jupyter notebook\" in your terminal in the directory.\u003c/li\u003e\n  \u003cli\u003eLocate and open the training_model.ipynb notebook\u003c/li\u003e\n\n  \u003cli\u003eMake sure that the kernel for the notebook is set to Python 3.\u003c/li\u003e\n  \u003cli\u003eRun the cells in the notebook to train the model on your dataset.\u003c/li\u003e\n  \u003cli\u003eThe script will create a unique folder with the current date and time in the format dd.mm.yyyy hhmmss-train_results for storing the model files and training results.\u003c/li\u003e\n  \u003cli\u003eTo use this script, you will need to place your dataset of images in a directory called 'training_data'. The script expects the images to be organized into different subfolders within the 'training_data' directory, one for each class. For example, if you have two classes, \"class1\" and \"class2\", you should create two subfolders within the 'training_data' directory named \"class1\" and \"class2\" and place the corresponding images in each folder. Make sure that the images are in jpeg, jpg, bmp, or png format.\u003c/li\u003e\n  \u003cbr\u003e\n  \u003c/ol\u003e\n  \u003ch2\u003eExample file structure:\u003c/h2\u003e\n  \u003col\u003e\n\u003cpre\u003e\ntraining_data/\n    class1/\n        image1.jpg\n        image2.jpg\n        ...\n    class2/\n        image1.jpg\n        image2.jpg\n        ...\n\u003c/pre\u003e\n\u003c/ol\u003e\n\n\u003ch2\u003eModel architecture\u003c/h2\u003e\n\u003cp\u003eThe model architecture is a convolutional neural network (CNN) with the following layers:\u003c/p\u003e\n\u003cul\u003e\n  \u003cli\u003eConv2D with 16 filters of size (3,3), stride of 1, and ReLU activation\u003c/li\u003e\n  \u003cli\u003eMaxPooling2D\u003c/li\u003e\n  \u003cli\u003eConv2D with 32 filters of size (3,3), stride of 1, and ReLU activation\u003c/li\u003e\n  \u003cli\u003eMaxPooling2D\u003c/li\u003e\n  \u003cli\u003eConv2D with 16 filters of size (3,3), stride of 1, and ReLU activation\u003c/li\u003e\n  \u003cli\u003eMaxPooling2D\u003c/li\u003e\n  \u003cli\u003eFlatten layer\u003c/li\u003e\n  \u003cli\u003eDense layer with 128 units and ReLU activation\u003c/li\u003e\n  \u003cli\u003eDense layer with the number of units equal to the number of classes in the dataset and softmax activation\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eYou can change the architecture of the model, training parameters, and data set path accordingly.\u003c/p\u003e\n\n  \n\u003ch2\u003eFiles saved after training\u003c/h2\u003e\n\u003cp\u003eThe script will save the following files in the unique folder created after training:\u003c/p\u003e\n\u003cul\u003e\n  \u003cli\u003eThe trained model file in the format model.h5\u003c/li\u003e\n  \u003cli\u003eA plot figure of a batch of the training images and their labels in the format batch_result.jpg\u003c/li\u003e\n  \u003cli\u003eAn Accuracy and a Loss chart as accuracy_chart.jpg and loss_chart.jpg\u003c/li\u003e\n \n  \u003cli\u003eA file with the training and validation accuracy and loss values in the format histroy.json\u003c/li\u003e\n   \u003cli\u003eFinal summary and result as .txt\u003c/li\u003e\n\u003c/ul\u003e\n  \n \u003ch2\u003eTraining Results\u003c/h2\u003e\n\u003cp\u003eThe following images are examples of the results generated by the script after training.\u003c/p\u003e\n\n\u003cdiv\u003e\n    \u003cimg src=\"09.03.2023 005034-train_results/batch_result.jpg\" width=\"23%\" style=\"display:inline-block;\"\u003e\n    \u003cimg src=\"09.03.2023 005034-train_results/accuracy_chart.jpg\" width=\"30%\" style=\"display:inline-block;\"\u003e\n    \u003cimg src=\"09.03.2023 005034-train_results/loss_chart.jpg\" width=\"30%\" style=\"display:inline-block;\"\u003e\n\u003c/div\u003e\n\n\n  \n\u003c/ol\u003e\n\n  \n  \n  \n\u003ch2\u003eNote\u003c/h2\u003e\n\u003cul\u003e\n  \u003cli\u003eThis script is set to work with images of size 256x256, you can change the image size accordingly.\u003c/li\u003e\n  \u003cli\u003eThe script automatically loads the images and splits them into train, validation, and test sets.\u003c/li\u003e\n  \n\n\u003c/ul\u003e\n  \n  \n\u003ch2\u003eContributing\u003c/h2\u003e\n\u003cp\u003eIf you want to contribute to this project, please feel free to submit a pull request.\u003c/p\u003e\n  \n  \n  \n\u003ch2\u003eLicence\u003c/h2\u003e\n\u003cp\u003eThis project is licensed under the MIT License - see the LICENSE.md file for details.\u003c/p\u003e\n\n\u003ch2\u003eReferences\u003c/h2\u003e\n\n  \u003cp\u003eThe code for this project is greatly inspired by \u003ca href=\"https://github.com/nicknochnack\"\u003eNicholas Renotte\u003c/a\u003e.\u003c/p\u003e\n\n\n\n\u003ch2\u003eExamples\u003c/h2\u003e\n\u003cp\u003eYou can find an example of a pre-trained model in the model folder, which was trained to classify images as notes and non-notes from WhatsApp images. You can use this pre-trained model as a starting point for fine-tuning on your own dataset or as a reference for comparison to your own model's performance. The model is trained using two classes (notes and non-notes) and is available in this repository \u003ca href=\"https://github.com/sajalkmr/NotesSeparator\"\u003eNotesSeparator\u003c/a\u003e.\u003c/p\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsajalkmr%2Fimageclassification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsajalkmr%2Fimageclassification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsajalkmr%2Fimageclassification/lists"}