2
0
mirror of https://github.com/Shawn-Shan/fawkes.git synced 2026-06-12 21:50:46 +05:30
This commit is contained in:
Shawn-Shan
2020-07-26 14:38:00 -05:00
+5 -4
View File
@@ -1,3 +1,4 @@
import errno
import glob import glob
import gzip import gzip
import json import json
@@ -259,9 +260,9 @@ def fix_gpu_memory(mem_fraction=1):
def preprocess(X, method): def preprocess(X, method):
assert method in {'raw', 'imagenet', 'inception', 'mnist'} assert method in {'raw', 'imagenet', 'inception', 'mnist'}
if method is 'raw': if method == 'raw':
pass pass
elif method is 'imagenet': elif method == 'imagenet':
X = imagenet_preprocessing(X) X = imagenet_preprocessing(X)
else: else:
raise Exception('unknown method %s' % method) raise Exception('unknown method %s' % method)
@@ -272,9 +273,9 @@ def preprocess(X, method):
def reverse_preprocess(X, method): def reverse_preprocess(X, method):
assert method in {'raw', 'imagenet', 'inception', 'mnist'} assert method in {'raw', 'imagenet', 'inception', 'mnist'}
if method is 'raw': if method == 'raw':
pass pass
elif method is 'imagenet': elif method == 'imagenet':
X = imagenet_reverse_preprocessing(X) X = imagenet_reverse_preprocessing(X)
else: else:
raise Exception('unknown method %s' % method) raise Exception('unknown method %s' % method)