Parcourir la source

Merge: [Efficientnet/TF2] fix keras imports

Krzysztof Kudrynski il y a 2 ans
Parent
commit
96bdb5b35f
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      TensorFlow2/Classification/ConvNets/dataloader/augment.py

+ 5 - 1
TensorFlow2/Classification/ConvNets/dataloader/augment.py

@@ -26,7 +26,11 @@ import math
 import tensorflow as tf
 from typing import Any, Dict, List, Optional, Text, Tuple
 
-from keras.layers.preprocessing import image_preprocessing as image_ops
+try:
+    from keras.layers.preprocessing import image_preprocessing as image_ops
+except (ImportError, ModuleNotFoundError):
+    import keras.src.layers.preprocessing.image_preprocessing as image_ops
+
 
 # This signifies the max integer that the controller RNN could predict for the
 # augmentation scheme.