Skip to content

Commit

Permalink
Fix imports for Tensorflow 2.1.0 (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
eduramiba authored Feb 23, 2020
1 parent e25340f commit b3bb539
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion deepposekit/io/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from tensorflow.python.keras.utils import Sequence
from tensorflow.keras.utils import Sequence
import cv2
import numpy as np
import os
Expand Down
3 changes: 1 addition & 2 deletions deepposekit/models/layers/convolutional.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from tensorflow.python.keras.engine import Layer
from tensorflow.python.keras.engine import InputSpec
from tensorflow.keras.layers import Layer, InputSpec

from tensorflow.keras.layers import UpSampling2D

Expand Down
2 changes: 1 addition & 1 deletion deepposekit/models/layers/imagenet_mobile.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
from tensorflow.python.keras.applications.imagenet_utils import decode_predictions
from tensorflow.keras.layers import Layer
from tensorflow.python.keras.applications import keras_applications
from tensorflow.python.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input

correct_pad = keras_applications.correct_pad
_obtain_input_shape = imagenet_utils.imagenet_utils._obtain_input_shape
Expand Down
2 changes: 1 addition & 1 deletion deepposekit/models/layers/imagenet_xception.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from tensorflow.python.keras.applications.imagenet_utils import decode_predictions
from tensorflow.keras.layers import Layer
from tensorflow.python.keras.applications import keras_applications
from tensorflow.python.keras.applications.mobilenet_v2 import preprocess_input
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input

correct_pad = keras_applications.correct_pad
_obtain_input_shape = imagenet_utils.imagenet_utils._obtain_input_shape
Expand Down
3 changes: 1 addition & 2 deletions deepposekit/models/layers/subpixel.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

from deepposekit.models.backend.backend import find_subpixel_maxima

from tensorflow.python.keras.engine import Layer
from tensorflow.python.keras.engine import InputSpec
from tensorflow.keras.layers import Layer, InputSpec
from tensorflow.python.keras.utils.conv_utils import normalize_data_format


Expand Down
2 changes: 1 addition & 1 deletion deepposekit/models/layers/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from tensorflow.python.keras.engine import Layer
from tensorflow.keras.layers import Layer
import tensorflow.keras.backend as K

__all__ = ["ImageNormalization"]
Expand Down
4 changes: 2 additions & 2 deletions deepposekit/models/loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from tensorflow.python.keras.engine import saving
from tensorflow.python.keras.saving import save

import h5py
import json
Expand Down Expand Up @@ -76,7 +76,7 @@ def load_model(path, generator=None, augmenter=None, custom_objects=None, compil
else:
raise TypeError("file must be type `str`")

train_model = saving.load_model(filepath, custom_objects=custom_objects, compile=compile)
train_model = save.load_model(filepath, custom_objects=custom_objects, compile=compile)

with h5py.File(filepath, "r") as h5file:
train_generator_config = h5file.attrs.get("train_generator_config")
Expand Down
4 changes: 2 additions & 2 deletions deepposekit/models/saving.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from tensorflow.python.keras.engine import saving
from tensorflow.python.keras.saving import save
import h5py
import json
from deepposekit.utils.io import get_json_type
Expand All @@ -29,7 +29,7 @@ def save_model(model, path, optimizer=True):
else:
raise TypeError("file must be type `str`")

saving.save_model(model.train_model, path, include_optimizer=optimizer)
save.save_model(model.train_model, path, include_optimizer=optimizer)

with h5py.File(filepath, "r+") as h5file:

Expand Down

0 comments on commit b3bb539

Please sign in to comment.