{"id":29027635,"url":"https://github.com/defi0x1/build-classifier-logisticregression","last_synced_at":"2026-05-01T17:35:51.197Z","repository":{"id":104636895,"uuid":"188955414","full_name":"defi0x1/Build-Classifier-LogisticRegression","owner":"defi0x1","description":"Classification countryside and metropilitian","archived":false,"fork":false,"pushed_at":"2019-06-01T15:55:28.000Z","size":10368,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-26T06:46:00.322Z","etag":null,"topics":["binary-classification","classification","histogram-of-oriented-gradients","hog-features","kmeans-clustering","logisticsregression","opencv"],"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/defi0x1.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-28T04:44:55.000Z","updated_at":"2019-11-20T04:49:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"5f0c863f-0979-4f0b-b40e-d317e4a0a793","html_url":"https://github.com/defi0x1/Build-Classifier-LogisticRegression","commit_stats":null,"previous_names":["defi0x1/build-classifier-logisticregression"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/defi0x1/Build-Classifier-LogisticRegression","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/defi0x1%2FBuild-Classifier-LogisticRegression","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/defi0x1%2FBuild-Classifier-LogisticRegression/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/defi0x1%2FBuild-Classifier-LogisticRegression/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/defi0x1%2FBuild-Classifier-LogisticRegression/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/defi0x1","download_url":"https://codeload.github.com/defi0x1/Build-Classifier-LogisticRegression/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/defi0x1%2FBuild-Classifier-LogisticRegression/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32390067,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T14:34:11.604Z","status":"ssl_error","status_checked_at":"2026-04-28T14:32:37.009Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["binary-classification","classification","histogram-of-oriented-gradients","hog-features","kmeans-clustering","logisticsregression","opencv"],"created_at":"2025-06-26T06:37:14.428Z","updated_at":"2026-04-28T17:01:30.221Z","avatar_url":"https://github.com/defi0x1.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Classification-With-HOG-K-mean-Logistic\n\n## Intuition\n  - Build a Classifier to classify metropolitian \u0026 countryside\n  - Using:\n      - K-Means clustering, histogram (HOG) for prerocess data and extract features\n      - LogisticsRegression for classify metropolitian and countryside\n  - Data: [metropolitian](https://drive.google.com/open?id=1xjVkboqPbmeEnXPyN7D2tpNRxAOhdhEa) \u0026 [countryside](https://drive.google.com/open?id=1kJjjszN0nv5y2xfn3TWqVMJSu6aAa5K5)\n\n## Architecture\n  - Preprocess Images : Using opencv for imread data with function [load_image](https://github.com/minhhaui/Classification-With-HOG-K-mean-Logistic/blob/master/preprocess_image.py#L8) and resize output image (350,350)\n  \n  - K-Means Clustering : We will extract dominant colors with k = 5 centroid with function [setUPKmean](https://github.com/minhhaui/Classification-With-HOG-K-mean-Logistic/blob/master/preprocess_image.py#L35)\n  \n  - HOG (Histogram Oriented Gradients) : Construct the features vector for each image using 5 clustered RGB colors, sorted by color frequency.\n  \n  - LogisticRegression : We use [Logistic Regression](https://github.com/minhhaui/Classification-With-HOG-K-mean-Logistic/blob/master/setup_model.py#L6) model to classify the feature vectors built from the HOG.\n    Implement the Gradient Descent method to optimize the model.\n       ```\n        batch_size = 32\n        epochs = 10\n        threshold = 0.5\n        learning_rate = 0.001\n        \n       ````\n  - Accuracy: 73.8 % with 1206 samples ( validation set = 20% , training set = 80%)\n  - Output K-means Clustering with centroid = 5:\n  \n     \u003cimg src = \"https://github.com/minhhaui/Classification-With-HOG-K-mean-Logistic/blob/master/resources_data/output_image_test/kmean.png\"\u003e\n   - Vector Histogram:\n   \n     \u003cimg src = \"https://github.com/minhhaui/Build-Classifier-LogisticRegression/blob/master/resources_data/output_image_test/Screenshot%20from%202019-06-01%2022-47-59.png\"\u003e\n   - Ouput HOG:  \n   \n     \u003cimg src = \"https://github.com/minhhaui/Classification-With-HOG-K-mean-Logistic/blob/master/resources_data/output_image_test/hog.png\"\u003e\n     \n  \n# Tree Project\n```\n  Classification/\n                model/\n                      model.sav # model results after training\n                resources_data/\n                        countryside         # contains data of countryside ( have some image for intuition)\n                        metropolitian       # contains data of metropilitian ( have some image for intuition)\n                        image_predict       # contains image for test predict\n                        output_image_test   # some results of k-mean and hog\n                predict.py                  # predict some image from resources_data/image_predict with args pathto model\n                preprocess_image.py         # contains imread data, fit k-mean and hog\n                setup_model.py              # Build LogisicRegression from scatch\n                train.py                    # start training with args path data train\n                      \n```\n\n# USAGE:\n## Requirements\n   ```\n      skimage\n      opencv-python\n      numpy\n      matplotlib\n      sklearn\n   ```\n## Training\n  `python train.py --inputcountry path_to_countrydata/ --inputmetro path_to_metropolitiandata/`\n## prediction\n  `python predict.py --model path_to_model/ --image path_to_image/`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefi0x1%2Fbuild-classifier-logisticregression","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdefi0x1%2Fbuild-classifier-logisticregression","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefi0x1%2Fbuild-classifier-logisticregression/lists"}