forked from idealo/imagededup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
130 lines (118 loc) Β· 4.32 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
import sys
from setuptools import setup, find_packages, Extension
long_description = '''
imagededup is a python package that provides functionality to find duplicates in a collection of images using a variety
of algorithms. Additionally, an evaluation and experimentation framework, is also provided. Following details the
functionality provided by the package:
* Finding duplicates in a directory using one of the following algorithms:
- Convolutional Neural Network
- Perceptual hashing
- Difference hashing
- Wavelet hashing
- Average hashing
* Generation of features for images using one of the above stated algorithms.
* Framework to evaluate effectiveness of deduplication given a ground truth mapping.
* Plotting duplicates found for a given image file.
Read the documentation at: https://idealo.github.io/imagededup/
imagededup is compatible with Python 3.6+ and runs on Linux, MacOS X and Windows.
It is distributed under the Apache 2.0 license.
'''
# Cython compilation is not enabled by default
# http://docs.cython.org/en/latest/src/userguide/source_files_and_compilation.html#distributing-cython-modules
try:
from Cython.Build import cythonize
except ImportError:
use_cython = False
else:
use_cython = True
on_mac = sys.platform.startswith('darwin')
on_windows = sys.platform.startswith('win')
MOD_NAME = 'brute_force_cython_ext'
MOD_PATH = 'imagededup/handlers/search/brute_force_cython_ext'
COMPILE_LINK_ARGS = ['-O3', '-march=native', '-mtune=native']
# On Mac, use libc++ because Apple deprecated use of libstdc
COMPILE_ARGS_OSX = ['-stdlib=libc++']
LINK_ARGS_OSX = ['-lc++', '-nodefaultlibs']
ext_modules = []
if use_cython and on_mac:
ext_modules += cythonize([
Extension(
MOD_NAME,
[MOD_PATH + '.pyx'],
language='c++',
extra_compile_args=COMPILE_LINK_ARGS + COMPILE_ARGS_OSX,
extra_link_args=COMPILE_LINK_ARGS + LINK_ARGS_OSX,
)
])
elif use_cython and on_windows:
ext_modules += cythonize([
Extension(
MOD_NAME,
[MOD_PATH + '.pyx'],
language='c++',
)
])
elif use_cython:
ext_modules += cythonize([
Extension(
MOD_NAME,
[MOD_PATH + '.pyx'],
language='c++',
extra_compile_args=COMPILE_LINK_ARGS,
extra_link_args=COMPILE_LINK_ARGS,
)
])
else:
if on_mac:
ext_modules += [Extension(MOD_NAME,
[MOD_PATH + '.cpp'],
extra_compile_args=COMPILE_ARGS_OSX,
extra_link_args=LINK_ARGS_OSX,
)
]
else:
ext_modules += [Extension(MOD_NAME,
[MOD_PATH + '.cpp'],
)
]
setup(
name='imagededup',
version='0.2.1',
author='Tanuj Jain, Christopher Lennan, Zubin John, Dat Tran',
description='Package for image deduplication',
long_description=long_description,
license='Apache 2.0',
install_requires=[
'numpy<1.17',
'Pillow<7.0.0',
'PyWavelets~=1.0.3',
'scipy',
'tensorflow>1.0',
'tqdm',
'scikit-learn',
'matplotlib',
],
extras_require={
'tests': ['pytest', 'pytest-cov', 'pytest-mock', 'codecov'],
'docs': ['mkdocs', 'mkdocs-material'],
'dev': ['bumpversion', 'twine'],
},
classifiers=[
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
'Operating System :: POSIX :: Linux',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Cython',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Software Development :: Libraries',
'Topic :: Software Development :: Libraries :: Python Modules',
],
packages=find_packages(exclude=('tests',)),
ext_modules=ext_modules
)