Skip to content

Commit b3bb539

Browse files
authored
Fix imports for Tensorflow 2.1.0 (#39)
1 parent e25340f commit b3bb539

File tree

8 files changed

+10
-12
lines changed

8 files changed

+10
-12
lines changed

deepposekit/io/video.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from tensorflow.python.keras.utils import Sequence
16+
from tensorflow.keras.utils import Sequence
1717
import cv2
1818
import numpy as np
1919
import os

deepposekit/models/layers/convolutional.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from tensorflow.python.keras.engine import Layer
17-
from tensorflow.python.keras.engine import InputSpec
16+
from tensorflow.keras.layers import Layer, InputSpec
1817

1918
from tensorflow.keras.layers import UpSampling2D
2019

deepposekit/models/layers/imagenet_mobile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
from tensorflow.python.keras.applications.imagenet_utils import decode_predictions
8585
from tensorflow.keras.layers import Layer
8686
from tensorflow.python.keras.applications import keras_applications
87-
from tensorflow.python.keras.applications.mobilenet_v2 import preprocess_input
87+
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
8888

8989
correct_pad = keras_applications.correct_pad
9090
_obtain_input_shape = imagenet_utils.imagenet_utils._obtain_input_shape

deepposekit/models/layers/imagenet_xception.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
from tensorflow.python.keras.applications.imagenet_utils import decode_predictions
3333
from tensorflow.keras.layers import Layer
3434
from tensorflow.python.keras.applications import keras_applications
35-
from tensorflow.python.keras.applications.mobilenet_v2 import preprocess_input
35+
from tensorflow.keras.applications.mobilenet_v2 import preprocess_input
3636

3737
correct_pad = keras_applications.correct_pad
3838
_obtain_input_shape = imagenet_utils.imagenet_utils._obtain_input_shape

deepposekit/models/layers/subpixel.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515

1616
from deepposekit.models.backend.backend import find_subpixel_maxima
1717

18-
from tensorflow.python.keras.engine import Layer
19-
from tensorflow.python.keras.engine import InputSpec
18+
from tensorflow.keras.layers import Layer, InputSpec
2019
from tensorflow.python.keras.utils.conv_utils import normalize_data_format
2120

2221

deepposekit/models/layers/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from tensorflow.python.keras.engine import Layer
16+
from tensorflow.keras.layers import Layer
1717
import tensorflow.keras.backend as K
1818

1919
__all__ = ["ImageNormalization"]

deepposekit/models/loading.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
from tensorflow.python.keras.engine import saving
16+
from tensorflow.python.keras.saving import save
1717

1818
import h5py
1919
import json
@@ -76,7 +76,7 @@ def load_model(path, generator=None, augmenter=None, custom_objects=None, compil
7676
else:
7777
raise TypeError("file must be type `str`")
7878

79-
train_model = saving.load_model(filepath, custom_objects=custom_objects, compile=compile)
79+
train_model = save.load_model(filepath, custom_objects=custom_objects, compile=compile)
8080

8181
with h5py.File(filepath, "r") as h5file:
8282
train_generator_config = h5file.attrs.get("train_generator_config")

deepposekit/models/saving.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

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

32-
saving.save_model(model.train_model, path, include_optimizer=optimizer)
32+
save.save_model(model.train_model, path, include_optimizer=optimizer)
3333

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

0 commit comments

Comments
 (0)