{"id":22197295,"url":"https://github.com/andresmg07/landscape-recognizer","last_synced_at":"2026-02-17T14:01:02.652Z","repository":{"id":226491861,"uuid":"768835922","full_name":"andresmg07/landscape-recognizer","owner":"andresmg07","description":"Supervised ML classification algorithm implemented through pattern recognition techniques and statistical methods.","archived":false,"fork":false,"pushed_at":"2025-03-19T21:45:39.000Z","size":38028,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T01:47:34.718Z","etag":null,"topics":["artificial-intelligence","machine-learning","numpy","opencv","pattern-recognition","python","statistical-methods"],"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/andresmg07.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,"zenodo":null}},"created_at":"2024-03-07T20:30:35.000Z","updated_at":"2025-03-19T21:45:42.000Z","dependencies_parsed_at":"2025-04-11T01:46:16.325Z","dependency_job_id":"3e10c3b9-a4f0-401f-bc9e-338132c11f84","html_url":"https://github.com/andresmg07/landscape-recognizer","commit_stats":null,"previous_names":["andresmg07/landscape-recognizer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andresmg07/landscape-recognizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andresmg07%2Flandscape-recognizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andresmg07%2Flandscape-recognizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andresmg07%2Flandscape-recognizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andresmg07%2Flandscape-recognizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andresmg07","download_url":"https://codeload.github.com/andresmg07/landscape-recognizer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andresmg07%2Flandscape-recognizer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29546746,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T13:00:00.370Z","status":"ssl_error","status_checked_at":"2026-02-17T12:57:14.072Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["artificial-intelligence","machine-learning","numpy","opencv","pattern-recognition","python","statistical-methods"],"created_at":"2024-12-02T14:19:05.316Z","updated_at":"2026-02-17T14:01:02.632Z","avatar_url":"https://github.com/andresmg07.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Landscape recognizer\n \nSupervised ML classification algorithm implemented through pattern recognition techniques and statistical methods.\n\n![Python](https://img.shields.io/badge/python-3670A0?style=flat\u0026logo=python\u0026logoColor=white)\n![OpenCV](https://img.shields.io/badge/opencv-%23white.svg?style=flat\u0026logo=opencv\u0026logoColor=white)\n![NumPy](https://img.shields.io/badge/numpy-%23013243.svg?style=flat\u0026logo=numpy\u0026logoColor=white)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)\n\n## Table of contents\n\n* [Landscape recognizer](#landscape-recognizer)\n  * [Table of contents](#table-of-contents)\n  * [Project description](#project-description)\n    * [Constraints](#constraints)\n  * [Algorithm design and implementation](#algorithm-design-and-implementation)\n    * [Feature vector definition](#feature-vector-definition)\n    * [Pattern recognition and learning algorithm](#pattern-recognition-and-learning-algorithm)\n    * [Implementation](#implementation)\n  * [Resulting model](#resulting-model)\n  * [Testing](#testing)\n    * [Testing results](#testing-results)\n  * [Conclusion](#conclusion)\n  * [Author](#author)\n  * [License](#license)\n\n## Project description\n\nThis project is focused on the design, implementation, and testing of a supervised machine learning algorithm aimed at **detecting urban-natural landscapes**. Leveraging pattern recognition techniques and statistical methods, the algorithm goal is to accurately logit classify images based on their color profile features. By harnessing the power of machine learning, this approach offers the potential to automate the identification process, enabling efficient analysis of large-scale datasets.\n\nAs result, the trained model is expected to be capable of determine with a high level of effectiveness if a given picture is an urban-natural landscape or not.  \n\n### Constraints\n\n1. The model must be trained with a limited dataset (12 samples).\n2. The recognizer must rely on a model comprising only 3 features.\n3. The features constituting the model must be exclusively extracted from the color profile of the images. The use of edge-based features is off the table. \n\n## Algorithm design and implementation\n\n### Feature vector definition\n\nIn order to understand the problem to be solved consider the following definition: A picture catalogued as urban-natural landscapes must fulfill the following criteria:\n\n1. The image depicts clear daytime skies or moderate cloud cover.\n2. The horizon line is visible in the image.\n3. The image portrays solid ground.\n4. Bodies of water may or may not be visible in the image.\n\nWith the characterization provided above the feature vector is defined as follows:\n\n$$ featureVector = (skyIdxArea, greenIdx, blueIdx) $$\n\nWhere each feature is defined down bellow:\n\n* **skyIdxArea:** Compound and area bounded index that measures the sky level in the picture. This feature combines a blue mask (_RGB_ color profile) with a brightness mask (_HSV_ color profile) to discriminate sky color within a limited zone.\n* **greenIdx:** Index that measures the nature level in the picture. This feature uses a green mask (_RGB_ color profile) to discriminate vegetation. \n* **blueIdx:** Index that measures the urban buildings level in the picture. This feature uses a blue mask (_RGB_ color profile) to discriminate urban facades.\n\n### Pattern recognition and learning algorithm\n\nThe structure and data flow of the implemented supervised ML classification algorithm is presented in the diagram down bellow.\n\n![Diagram](diagram.png)\n\nWhen input data enters the classification algorithm it is pre-processed, its features are extracted and lastly the classification model is either trained or used to determine the nature of the given picture. In the recognition process the result is a logit classification.\n\n### Implementation\n\nThis project is implemented using Python 3.11 with openCV and NumPy as supporting libraries to perform image manipulation and matrix operations. Check the code base in the [GitHub repository](https://github.com/andresmg07/landscape-recognizer/).\n\n## Resulting model\n\nAs result of the training stage, two modeling vectors are generated. The first of these vectors: $featureVector$ characterizes the central tendencies of the features extracted, while the second resulting vector: $standardDeviationVector$ reflects their variability across the dataset. The obtained values for each vector are presented down bellow.\n\n$$ trainedFeatureVector \\approx (0.1822, 0.0325, 0.3627) $$\n\n$$ featureStandardDeviationVector \\approx (0.1906, 0.0185, 0.1146) $$\n\nThrough the utilization of these trained model vectors, the algorithm calculates the expected error and gains the capability to make informed decisions regarding the classification of new images.\n\n## Testing\n\nIn order to validate the effectiveness of the resulting model a small testing procedure is conducted. The dataset used for this task comprised 20 samples, where half of it are urban-natural landscape pictures and the remaining half are arbitrary selected images.\n\n### Testing results\n\nAn automated testing module threw the following results from the classification of the above described validation dataset.\n\n| **Truth Value** | **Quantity** |\n|-----------------|--------------|\n| True positive   |      4       |\n| True negative   |      10      |\n| False positive  |      0       |\n| False negative  |      6       |\n\nBased on the results presented in the table, **the effectiveness level of the algorithm is approximately 70%**\n\n## Conclusion\nAs conclusion, while the restrictions imposed on the design of the algorithm present significant challenges, they also foster opportunities for creativity, efficiency, and innovation.  The testing results exhibit a solution with promising performance in detecting urban-natural landscapes, with high precision, strong specificity, and moderate sensitivity. By addressing areas for improvement, the algorithm has the potential to become even more reliable and effective by targeting the source of the false negatives; fine-tuning the algorithm's parameters or incorporating additional features may enhance its sensitivity.\n\n## Author\n\n**Andrés Montero Gamboa**\u003cbr\u003e\nComputing engineer\u003cbr\u003e\nGraduated from Tecnológico de Costa Rica\u003cbr\u003e\n[LinkedIn](https://www.linkedin.com/in/andres-montero-gamboa) | [GitHub](https://github.com/andresmg07)\n\n## License\n\nMIT License\n\nCopyright (c) 2024 Andrés Montero Gamboa\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandresmg07%2Flandscape-recognizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandresmg07%2Flandscape-recognizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandresmg07%2Flandscape-recognizer/lists"}