-
Notifications
You must be signed in to change notification settings - Fork 208
/
setup.py
77 lines (70 loc) · 2.71 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
# Setup script for tf_cnnvis
import os
import sys
import six
import pkgutil
import shutil
import glob
# required pkgs
dependencies = ['numpy', 'scipy', 'h5py', 'wget', 'Pillow', 'six','scikit-image']
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
print("Please install if not installed:", dependencies)
from distutils.command.clean import clean
def read(fname):
if six.PY2:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
else:
return open(os.path.join(os.path.dirname(__file__), fname), encoding='latin1').read()
class CleanCommand(clean):
"""Custom clean command to tidy up the project root."""
def deleteFileOrDir(self, f):
try:
if os.path.isdir(f):
shutil.rmtree(f, ignore_errors=True)
else:
os.remove(f)
except Exception as e:
print(e)
def run(self):
for p in './build ./dist ./*.pyc ./*.tgz ./*.egg-info'.split(' '):
if '*' in p:
for f in glob.glob(p):
self.deleteFileOrDir(f)
else:
self.deleteFileOrDir(p)
setup(
name = "tf_cnnvis",
version = "1.0.0",
author = "Bhagyesh Vikani & Falak Shah",
author_email = "[email protected] & [email protected]",
description = ("tf_cnnvis is a CNN visualization library based on the paper 'Visualizing and Understanding Convolutional Networks' by Matthew D. Zeiler and Rob Fergus. We use the 'TensorFlow' library to reconstruct the input images from different layers of the convolutional neural network. The generated images are displayed in [TensorBoard](https://www.tensorflow.org/get_started/summaries_and_tensorboard)."),
license = "MIT",
keywords = "tensorflow tensorboard convolutional-neural-networks cnn visualization",
url = "https://github.com/InFoCusp/tf_cnnvis",
packages=['tf_cnnvis'],
long_description=read('ReadMe.md'),
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"Topic :: Utilities",
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: Unix",
"Programming Language :: Python",
"Topic :: Scientific/Engineering :: Visualization",
],
install_requires=dependencies,
cmdclass={
'clean': CleanCommand,
}
)
# Check TF version as it requires > 1.8
try:
import tensorflow
if (int(tensorflow.__version__.split(".")[0]) + 0.1 * int(tensorflow.__version__.split(".")[1])) < 1.8:
print("Please upgrade to TensorFlow >= 1.8.0")
except:
print("Please install TenSorflow with 'pip install tensorflow'")