Skip to content

Commit 97f758e

Browse files
committed
Added setup for publishing
1 parent 2d81980 commit 97f758e

File tree

3 files changed

+99
-0
lines changed

3 files changed

+99
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# py-image-comparer
2+
Compares two images using [Siamese Network](https://www.cs.cmu.edu/~rsalakhu/papers/oneshot1.pdf) trained from a [Pytorch Implementation](https://github.com/joeyism/siamese-pytorch)
23

34
## Installation
45
To install, run

README.rst

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
2+
py-image-comparer
3+
=================
4+
5+
Installation
6+
------------
7+
8+
To install, run
9+
10+
.. code-block:: bash
11+
12+
pip install image-comparer
13+
14+
Usage
15+
-----
16+
17+
CLI
18+
^^^
19+
20+
.. code-block:: bash
21+
22+
image-compare
23+
24+
which wil show the follow help screen
25+
26+
.. code-block::
27+
28+
usage: image-compare [-h] [--threshold THRESHOLD] Image1-Path Image2-Path
29+
30+
For example, you can compare two images with
31+
32+
.. code-block:: bash
33+
34+
image-compare tests/images/kobe.jpg tests/images/kobe2.jpg
35+
36+
which gives the result
37+
38+
.. code-block::
39+
40+
kobe.jpg and kobe2.jpg are not similar
41+
42+
Programmatically
43+
^^^^^^^^^^^^^^^^
44+
45+
With PIL
46+
47+
.. code-block:: python
48+
49+
import image_comparer
50+
from PIL import Image
51+
52+
image = Image.open("test/kobe.jpg")
53+
image2 = Image.open("test/kobe2.jpg")
54+
image_comparer.is_similar(image, image2, threshold=0.5)
55+
56+
or with OpenCV
57+
58+
.. code-block:: python
59+
60+
import image_comparer
61+
import cv2
62+
63+
image = cv2.imread("test/kobe.jpg")
64+
image2 = cv2.imread("test/kobe2.jpg")
65+
image_comparer.is_similar(image, image2, threshold=0.5)
66+
67+
Development
68+
-----------
69+
70+
Installation
71+
^^^^^^^^^^^^
72+
73+
.. code-block:: bash
74+
75+
pip install -r requirements-test.txt
76+
77+
Tests
78+
^^^^^
79+
80+
To run tests, run
81+
82+
.. code-block:: bash
83+
84+
pytest

setup.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,24 @@
33
PACKAGE_NAME = "image-comparer"
44
PACKAGE_NAME_UNDERLINE = PACKAGE_NAME.replace("-", "_")
55

6+
version = re.search(
7+
'^__version__\s*=\s*"(.*)"',
8+
open(f'{PACKAGE_NAME_UNDERLINE}/__init__.py').read(),
9+
re.M
10+
).group(1)
11+
612
setup(
713
name=PACKAGE_NAME,
814
packages=find_packages(exclude=["tests"]),
15+
version=version,
16+
description='Compares two images using siamese networks',
17+
long_description=open("README.md", "r").read(),
18+
long_description_content_type='text/markdown',
19+
author='joeyism',
20+
url='https://github.com/joeyism/py-image-comparer',
21+
download_url='https://github.com/joeyism/py-image-comparer/archive/{}.tar.gz'.format(version),
922
install_requires=[package for package in open("requirements.txt").read().split("\n")],
23+
keywords=["pytorch", "torch", "machine", "learning", "image", "compare", "comparer", "siamese", "network", "networks"],
1024
entry_points={
1125
"console_scripts": [
1226
f"image-compare = {PACKAGE_NAME_UNDERLINE}.cli:cli",

0 commit comments

Comments
 (0)