dependencies simplified

This commit is contained in:
Dmytro S Lituiev
2019-07-16 16:02:57 -07:00
parent 345070f49c
commit c4b2aea306
2 changed files with 15 additions and 12 deletions
+14 -10
View File
@@ -13,7 +13,7 @@ import scipy.ndimage as ndi
from six.moves import range from six.moves import range
import os import os
import threading import threading
import warnings from warnings import warn
import multiprocessing.pool import multiprocessing.pool
from functools import partial from functools import partial
from collections import Counter from collections import Counter
@@ -59,7 +59,11 @@ _OPENCV_INTERPOLATION_METHODS = {
import json import json
from croppad import crop_pad_center from croppad import crop_pad_center
from pycocotools.mask import encode, decode
try:
from pycocotools.mask import encode, decode
except:
warn('no pycocotools found')
def random_rotation(x, rg, row_axis=1, col_axis=2, channel_axis=0, def random_rotation(x, rg, row_axis=1, col_axis=2, channel_axis=0,
@@ -426,7 +430,7 @@ def load_img_opencv(path, grayscale=False, color_mode='rgb', target_size=None,
ValueError: if interpolation method is not supported. ValueError: if interpolation method is not supported.
""" """
if grayscale is True: if grayscale is True:
warnings.warn('grayscale is deprecated. Please use ' warn('grayscale is deprecated. Please use '
'color_mode = "grayscale"') 'color_mode = "grayscale"')
color_mode = 'grayscale' color_mode = 'grayscale'
@@ -497,7 +501,7 @@ def load_img_pil(path, grayscale=False, color_mode='rgb', target_size=None,
ValueError: if interpolation method is not supported. ValueError: if interpolation method is not supported.
""" """
if grayscale is True: if grayscale is True:
warnings.warn('grayscale is deprecated. Please use ' warn('grayscale is deprecated. Please use '
'color_mode = "grayscale"') 'color_mode = "grayscale"')
color_mode = 'grayscale' color_mode = 'grayscale'
if pil_image is None: if pil_image is None:
@@ -892,7 +896,7 @@ class ImageDataGenerator(object):
if self.mean is not None: if self.mean is not None:
x -= self.mean x -= self.mean
else: else:
warnings.warn('This ImageDataGenerator specifies ' warn('This ImageDataGenerator specifies '
'`featurewise_center`, but it hasn\'t' '`featurewise_center`, but it hasn\'t'
'been fit on any training data. Fit it ' 'been fit on any training data. Fit it '
'first by calling `.fit(numpy_data)`.') 'first by calling `.fit(numpy_data)`.')
@@ -900,7 +904,7 @@ class ImageDataGenerator(object):
if self.std is not None: if self.std is not None:
x /= (self.std + 1e-7) x /= (self.std + 1e-7)
else: else:
warnings.warn('This ImageDataGenerator specifies ' warn('This ImageDataGenerator specifies '
'`featurewise_std_normalization`, but it hasn\'t' '`featurewise_std_normalization`, but it hasn\'t'
'been fit on any training data. Fit it ' 'been fit on any training data. Fit it '
'first by calling `.fit(numpy_data)`.') 'first by calling `.fit(numpy_data)`.')
@@ -910,7 +914,7 @@ class ImageDataGenerator(object):
whitex = np.dot(flatx, self.principal_components) whitex = np.dot(flatx, self.principal_components)
x = np.reshape(whitex, x.shape) x = np.reshape(whitex, x.shape)
else: else:
warnings.warn('This ImageDataGenerator specifies ' warn('This ImageDataGenerator specifies '
'`zca_whitening`, but it hasn\'t' '`zca_whitening`, but it hasn\'t'
'been fit on any training data. Fit it ' 'been fit on any training data. Fit it '
'first by calling `.fit(numpy_data)`.') 'first by calling `.fit(numpy_data)`.')
@@ -1096,7 +1100,7 @@ class ImageDataGenerator(object):
raise ValueError('Input to `.fit()` should have rank 4. ' raise ValueError('Input to `.fit()` should have rank 4. '
'Got array with shape: ' + str(x.shape)) 'Got array with shape: ' + str(x.shape))
if x.shape[self.channel_axis] not in {1, 3, 4}: if x.shape[self.channel_axis] not in {1, 3, 4}:
warnings.warn( warn(
'Expected input to be images (as Numpy array) ' 'Expected input to be images (as Numpy array) '
'following the data format convention "' + self.data_format + '" ' 'following the data format convention "' + self.data_format + '" '
'(channels on axis ' + str(self.channel_axis) + '), i.e. expected ' '(channels on axis ' + str(self.channel_axis) + '), i.e. expected '
@@ -1319,12 +1323,12 @@ class NumpyArrayIterator(Iterator):
self.x = np.asarray(x, dtype=K.floatx()) self.x = np.asarray(x, dtype=K.floatx())
if self.x.ndim != 4: if self.x.ndim != 4:
warnings.warn('Input data in `NumpyArrayIterator` ' warn('Input data in `NumpyArrayIterator` '
'should have rank 4. You passed an array ' 'should have rank 4. You passed an array '
'with shape\t%s' % str(self.x.shape)) 'with shape\t%s' % str(self.x.shape))
else: else:
if self.x.shape[channels_axis] not in {1, 3, 4}: if self.x.shape[channels_axis] not in {1, 3, 4}:
warnings.warn('NumpyArrayIterator is set to use the ' warn('NumpyArrayIterator is set to use the '
'data format convention "' + data_format + '" ' 'data format convention "' + data_format + '" '
'(channels on axis ' + str(channels_axis) + '), i.e. expected ' '(channels on axis ' + str(channels_axis) + '), i.e. expected '
'either 1, 3 or 4 channels on axis ' + str(channels_axis) + '. ' 'either 1, 3 or 4 channels on axis ' + str(channels_axis) + '. '
+1 -2
View File
@@ -11,9 +11,7 @@ opencv-python==3.3.0.10
pandas==0.20.2 pandas==0.20.2
Pillow==4.1.1 Pillow==4.1.1
pyaml==17.7.2 pyaml==17.7.2
-e git+https://github.com/cocodataset/cocoapi/@727b546dd9fa4e4bb113213c98a3925829fac0bf#egg=pycocotools&subdirectory=PythonAPI
pydicom==0.9.9 pydicom==0.9.9
PyYAML==3.12
scikit-image==0.13.0 scikit-image==0.13.0
scikit-learn==0.18.1 scikit-learn==0.18.1
scipy==0.19.1 scipy==0.19.1
@@ -21,3 +19,4 @@ seaborn==0.7.1
sklearn==0.0 sklearn==0.0
tensorflow-gpu==1.4.1 tensorflow-gpu==1.4.1
tensorflow-tensorboard==0.4.0rc3 tensorflow-tensorboard==0.4.0rc3
# -e git+https://github.com/cocodataset/cocoapi/@727b546dd9fa4e4bb113213c98a3925829fac0bf#egg=pycocotools&subdirectory=PythonAPI