{"id":18754174,"url":"https://github.com/joeyism/py-image-comparer","last_synced_at":"2025-04-13T00:32:02.285Z","repository":{"id":62570511,"uuid":"384781345","full_name":"joeyism/py-image-comparer","owner":"joeyism","description":"Compares two images using Siamese Network (machine learning) trained from a Pytorch Implementation","archived":false,"fork":false,"pushed_at":"2021-07-27T13:48:17.000Z","size":202,"stargazers_count":9,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T18:57:27.148Z","etag":null,"topics":["compare","images","network","pytorch","siamese","siamese-network","torch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joeyism.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}},"created_at":"2021-07-10T20:09:43.000Z","updated_at":"2024-10-04T08:04:57.000Z","dependencies_parsed_at":"2022-11-03T17:15:39.159Z","dependency_job_id":null,"html_url":"https://github.com/joeyism/py-image-comparer","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeyism%2Fpy-image-comparer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeyism%2Fpy-image-comparer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeyism%2Fpy-image-comparer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joeyism%2Fpy-image-comparer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joeyism","download_url":"https://codeload.github.com/joeyism/py-image-comparer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650590,"owners_count":21139670,"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":["compare","images","network","pytorch","siamese","siamese-network","torch"],"created_at":"2024-11-07T17:28:12.108Z","updated_at":"2025-04-13T00:32:01.606Z","avatar_url":"https://github.com/joeyism.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# py-image-comparer\nCompares two images using [Siamese Network](https://www.cs.cmu.edu/~rsalakhu/papers/oneshot1.pdf) (Machine Learning) trained from a [Pytorch Implementation](https://github.com/joeyism/siamese-pytorch)\n\n## Installation\nTo install, run\n\n```bash\npip install image-comparer\n```\n\n## Usage\n\n### CLI\n```bash\nimage-compare\n```\nwhich wil show the follow help screen\n```\nusage: image-compare [-h] [--threshold THRESHOLD] Image1-Path Image2-Path\n```\n\nFor example, you can compare two images with\n```bash\nimage-compare tests/images/kobe.jpg tests/images/kobe2.jpg \n```\nwhich gives the result\n```\nkobe.jpg and kobe2.jpg are not similar\n```\n\n### Programmatically\nWith PIL\n\n```python\nimport image_comparer\nfrom PIL import Image\n\nimage = Image.open(\"test/kobe.jpg\")\nimage2 = Image.open(\"test/kobe2.jpg\")\nimage_comparer.is_similar(image, image2, threshold=0.5)\n```\nor with OpenCV\n\n```python\nimport image_comparer\nimport cv2\n\nimage = cv2.imread(\"test/kobe.jpg\")\nimage2 = cv2.imread(\"test/kobe2.jpg\")\nimage_comparer.is_similar(image, image2, threshold=0.5)\n```\n\n## API\n\n### Methods\n\n`is_similar(image1: Union[Image.Image, np.ndarray], image2: Union[Image.Image, np.ndarray], threshold=0.5)`: Checks if the two images are similar based on the reshold passed\n\n\n`calculate_score(image1: Union[Image.Image, np.ndarray], image2: Union[Image.Image, np.ndarray])`: Calculates the score between the two images. The higher the score, the more closely the two images are related.\n\n\n## Development\n\n### Installation\n```bash\npip install -r requirements-test.txt\n```\n\n### Tests\nTo run tests, run\n```bash\npytest\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoeyism%2Fpy-image-comparer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoeyism%2Fpy-image-comparer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoeyism%2Fpy-image-comparer/lists"}