You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Functionality remains the same, however, the import name of EfficientNets in TensorFlow has changed slightly.
importtensorflowastf# New (notice the new .efficientnet), see: https://www.tensorflow.org/api_docs/python/tf/keras/applications/efficientnet/EfficientNetB0model=tf.keras.applications.efficientnet.EfficientNetB0()
# Oldmodel=tf.keras.applications.EfficientNetB0()
Data augmentation
from tensorflow.keras.layers.experimental import preprocessing -> from tensorflower.keras import layers
New
fromtensorflow.kerasimportlayersfromtensorflow.keras.modelsimportSequential# NEW: Newer versions of TensorFlow (2.10+) can use the tensorflow.keras.layers API directly for data augmentationdata_augmentation=Sequential([
layers.RandomFlip("horizontal"),
layers.RandomRotation(0.2),
layers.RandomZoom(0.2),
layers.RandomHeight(0.2),
layers.RandomWidth(0.2),
# preprocessing.Rescaling(1./255) # keep for ResNet50V2, remove for EfficientNetB0
], name="data_augmentation")
Old
fromtensorflow.keras.layers.experimentalimportpreprocessing# Build data augmentation layerdata_augmentation=Sequential([
preprocessing.RandomFlip('horizontal'),
preprocessing.RandomHeight(0.2),
preprocessing.RandomWidth(0.2),
preprocessing.RandomZoom(0.2),
preprocessing.RandomRotation(0.2),
# preprocessing.Rescaling(1./255) # keep for ResNet50V2, remove for EfficientNet
], name="data_augmentation")
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Work-in-progress to show some of the newer TensorFlow API namespaces.
Functionality remains mostly the same across versions, however, sometimes the namespace of where things are stored gets changed.
Notebook 06 - Transfer Learning with TensorFlow Part 3: Scaling-up
Link: https://github.com/mrdbourke/tensorflow-deep-learning/blob/main/06_transfer_learning_in_tensorflow_part_3_scaling_up.ipynb
EfficientNet Model
Functionality remains the same, however, the import name of EfficientNets in TensorFlow has changed slightly.
Data augmentation
from tensorflow.keras.layers.experimental import preprocessing
->from tensorflower.keras import layers
New
Old
Beta Was this translation helpful? Give feedback.
All reactions