{"id":28489758,"url":"https://github.com/mhed89/cat-face-color-detector","last_synced_at":"2026-05-05T09:32:24.777Z","repository":{"id":196799504,"uuid":"697163294","full_name":"mhed89/Cat-Face-Color-Detector","owner":"mhed89","description":"A Python application for detecting cat faces and classifying their colors using OpenCV, Tensorflow, Keras and a pre-trained deep learning model. ","archived":false,"fork":false,"pushed_at":"2023-09-27T16:48:17.000Z","size":67949,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-02T05:36:54.946Z","etag":null,"topics":["cats","keras","opencv","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mhed89.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-09-27T07:22:45.000Z","updated_at":"2023-11-03T09:49:33.000Z","dependencies_parsed_at":"2023-09-27T17:27:13.177Z","dependency_job_id":null,"html_url":"https://github.com/mhed89/Cat-Face-Color-Detector","commit_stats":null,"previous_names":["crispyabsurdist/cat-face-color-detector","mhed89/cat-face-color-detector"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mhed89/Cat-Face-Color-Detector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhed89%2FCat-Face-Color-Detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhed89%2FCat-Face-Color-Detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhed89%2FCat-Face-Color-Detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhed89%2FCat-Face-Color-Detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mhed89","download_url":"https://codeload.github.com/mhed89/Cat-Face-Color-Detector/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhed89%2FCat-Face-Color-Detector/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32643616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"online","status_checked_at":"2026-05-05T02:00:06.033Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cats","keras","opencv","tensorflow"],"created_at":"2025-06-08T07:06:02.921Z","updated_at":"2026-05-05T09:32:24.758Z","avatar_url":"https://github.com/mhed89.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cat Face Color Detector (WIP)\n\nA Python application for detecting cat faces and classifying their colors(black and white for now) using OpenCV and a pre-trained deep learning model. This is a Work In Progress!\nI still need to fine adjust the dataset and also create a larger dataset so that the classification model will get better.\n\n**Having big problems recognizing black cats...**\n\n## Overview\n\nThis project consists of three Python scripts for cat-related tasks:\n\n- **maincoon.py:** Detects cat faces in a live video stream or a video file and classifies their colors using a pre-trained deep learning model.\n- **cat_trainer.py:** Trains a cat color classification model using a custom dataset of black and white cat images.\n- **cat_scraper.py:** Scrapes cat images from Pixabay based on a query and downloads them for building the dataset.\n- **sort_cat_faces.py** This script reads images from a folder, resizes them to a target size, detects cat faces in the images, and moves the images to a folder based on whether the cat face is black or white.\n\n## Installation\n\n### Dependencies\nTo run these scripts, you need Python 3.x installed on your system. Additionally, you'll need the following libraries:\n\n```bash\npip3 install opencv-python-headless tensorflow numpy python-dotenv tqdm requests\n``````\n\n### .env file\nSet up your Pixabay API key and other environment variables by creating a .env file in the project directory with the following content:\n```env\nPIXABAY_API_KEY=your_pixabay_api_key\nURL_ENDPOINT=https://pixabay.com/api/\nTRAIN_PATH=/path/to/training_data\nVALID_PATH=/path/to/validation_data\n```\n\n## Usage\n\n### Dataset\nIf don't want to build a custom dataset, you can use the one at https://www.kaggle.com/datasets/azmeenasiraj/cat-faces-data-set.\n\n### maincoon.py\n\n* Detects cat faces in a live video stream from your default webcam or a specified video file.\n* Classifies the color of each detected cat face as \"Black,\" \"White,\" or \"Unknown.\"\n* Press the 'q' key to exit the script.\n\n```bash\npython3 maincoon.py\n```\n\n### cat_trainer.py\n\n* Trains a cat color classification model using a custom dataset of black and white cat images.\n* The trained model is saved as \"cat_color_model.h5.\"\n\n```bash\npython3 cat_trainer.py\n```\n\n### cat_scraper.py\n\n* You need a Pixabay API key to run this script. You can get one for free by signing up at https://pixabay.com/api/docs/.\n* Scrapes cat images from Pixabay based on a query and downloads them for building the dataset.\n* You need to change the query variable in the script to specify your desired cat type (e.g., \"black,\" \"white,\" etc.).\n\n```bash\npython3 cat_scraper.py\n```\n\n### sort_cat_faces.py\nThe sort_cat_faces.py script is a useful tool for sorting cat images based on the color of the cat's face. It uses the OpenCV library to detect cat faces and the grayscale black-to-white ratio to determine the color of the cat's face.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhed89%2Fcat-face-color-detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmhed89%2Fcat-face-color-detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhed89%2Fcat-face-color-detector/lists"}