Commit 730cf030 authored by Dionisi Jeanne's avatar Dionisi Jeanne
Browse files

Update B0_100batch30epoch18classes.ipynb

parent 6d0b0f9e
%% Cell type:markdown id: tags:
 
# Classification d'images à l'aide d'un réseau EfficientNet
 
#### Extraction des données + apprentissages + validation sur un autre jeu de données
 
%% Cell type:markdown id: tags:
 
## Préparation des données
 
%% Cell type:markdown id: tags:
 
### Chargement des données depuis notre drive et extraction
 
%% Cell type:code id: tags:
 
```
from google.colab import drive
drive.mount('/content/drive', force_remount=True)
```
 
%% Output
 
Mounted at /content/drive
 
%% Cell type:code id: tags:
 
```
# importing required modules
from zipfile import ZipFile
 
# specifying the zip file name
file_name = '/content/drive/My Drive/raw.zip'
 
# opening the zip file in READ mode
with ZipFile(file_name, 'r') as zip:
# printing all the contents of the zip file
zip.printdir()
 
# extracting all the files
print('Extracting all the files now...')
zip.extractall()
print('Done!')
```
 
%% Cell type:markdown id: tags:
 
### Vérification du nombre de sous dossiers ainsi que l'affichage
 
%% Cell type:code id: tags:
 
```
import os
liste_dossiers = os.listdir('raw/color/')
len(liste_dossiers)
```
 
%% Output
 
38
 
%% Cell type:code id: tags:
 
```
%rm -fr /content/raw/color/.ipynb_checkpoints/
```
 
%% Cell type:code id: tags:
 
```
!ls raw/color/
```
 
%% Cell type:code id: tags:
 
```
%rm -fr /content/raw/color/.ipynb_checkpoints/
# %cd raw/color
%mkdir /content/raw/color/Healthy
 
%cp /content/raw/color/Apple___healthy/*.JPG /content/raw/color/Healthy/
%rm -fr /content/raw/color/Apple___healthy/
 
%cp /content/raw/color/Blueberry___healthy/*.JPG /content/raw/color/Healthy/
%rm -fr /content/raw/color/Blueberry___healthy/
 
%cp /content/raw/color/Cherry_\(including_sour\)___healthy/*.JPG /content/raw/color/Healthy/
%rm -fr /content/raw/color/Cherry_\(including_sour\)___healthy/
 
%cp /content/raw/color/Corn_\(maize\)___healthy/*.JPG /content/raw/color/Healthy/
%rm -fr /content/raw/color/Corn_\(maize\)___healthy/
 
%cp /content/raw/color/Grape___healthy/*.JPG /content/raw/color/Healthy/
%rm -fr /content/raw/color/Grape___healthy/
 
%cp /content/raw/color/Peach___healthy/*.JPG /content/raw/color/Healthy/
%rm -fr /content/raw/color/Peach___healthy/
 
%cp /content/raw/color/Pepper,_bell___healthy/*.JPG /content/raw/color/Healthy/
%rm -fr /content/raw/color/Pepper,_bell___healthy/
 
%cp /content/raw/color/Potato___healthy/*.JPG /content/raw/color/Healthy/
%rm -fr /content/raw/color/Potato___healthy/
 
%cp /content/raw/color/Raspberry___healthy/*.JPG /content/raw/color/Healthy/
%rm -fr /content/raw/color/Raspberry___healthy/
 
%cp /content/raw/color/Soybean___healthy/*.JPG /content/raw/color/Healthy/
%rm -fr /content/raw/color/Soybean___healthy/
 
%cp /content/raw/color/Strawberry___healthy/*.JPG /content/raw/color/Healthy/
%rm -fr /content/raw/color/Strawberry___healthy/
 
%cp /content/raw/color/Tomato___healthy/*.JPG /content/raw/color/Healthy/
%rm -fr /content/raw/color/Tomato___healthy/
```
 
%% Cell type:code id: tags:
 
```
%mkdir /content/raw/color/Early_blight
%cp /content/raw/color/Potato___Early_blight/*.JPG /content/raw/color/Early_blight/
%rm -fr /content/raw/color/Potato___Early_blight/
 
%cp /content/raw/color/Tomato___Early_blight/*.JPG /content/raw/color/Early_blight/
%rm -fr /content/raw/color/Tomato___Early_blight/
```
 
%% Cell type:code id: tags:
 
```
%mkdir /content/raw/color/Late_blight
%cp /content/raw/color/Tomato___Late_blight/*.JPG /content/raw/color/Late_blight/
%rm -fr /content/raw/color/Tomato___Late_blight/
 
%cp /content/raw/color/Potato___Late_blight/*.JPG /content/raw/color/Late_blight/
%rm -fr /content/raw/color/Potato___Late_blight/
```
 
%% Cell type:code id: tags:
 
```
%mkdir /content/raw/color/Powdery_mildrew
%cp /content/raw/color/Squash___Powdery_mildew/*.JPG /content/raw/color/Powdery_mildrew/
%rm -fr /content/raw/color/Squash___Powdery_mildew/
 
%cp /content/raw/color/Cherry_\(including_sour\)___Powdery_mildew/*.JPG /content/raw/color/Powdery_mildrew/
%rm -fr /content/raw/color/Cherry_\(including_sour\)___Powdery_mildew/
```
 
%% Cell type:code id: tags:
 
```
%mkdir /content/raw/color/Leaf_blight
%cp /content/raw/color/Grape___Leaf_blight_\(Isariopsis_Leaf_Spot\)/*.JPG /content/raw/color/Leaf_blight/
%rm -fr /content/raw/color/Grape___Leaf_blight_\(Isariopsis_Leaf_Spot\)/
 
%cp /content/raw/color/Corn_\(maize\)___Northern_Leaf_Blight/*.JPG /content/raw/color/Leaf_blight/
%rm -fr /content/raw/color/Corn_\(maize\)___Northern_Leaf_Blight/
```
 
%% Cell type:code id: tags:
 
```
%mkdir /content/raw/color/rust
%cp /content/raw/color/Apple___Cedar_apple_rust/*.JPG /content/raw/color/rust/
%rm -fr /content/raw/color/Apple___Cedar_apple_rust/
 
%cp /content/raw/color/Corn_\(maize\)___Common_rust_/*.JPG /content/raw/color/rust/
%rm -fr /content/raw/color/Corn_\(maize\)___Common_rust_/
```
 
%% Cell type:code id: tags:
 
```
%mkdir /content/raw/color/Black_rot
%cp /content/raw/color/Apple___Black_rot/*.JPG /content/raw/color/Black_rot/
%rm -fr /content/raw/color/Apple___Black_rot/
 
%cp /content/raw/color/Grape___Black_rot/*.JPG /content/raw/color/Black_rot/
%rm -fr /content/raw/color/Grape___Black_rot/
```
 
%% Cell type:code id: tags:
 
```
%mkdir /content/raw/color/leaf_spot
%cp /content/raw/color/Tomato___Septoria_leaf_spot/*.JPG /content/raw/color/leaf_spot/
%rm -fr /content/raw/color/Tomato___Septoria_leaf_spot/
 
%cp /content/raw/color/Corn_\(maize\)___Cercospora_leaf_spot\ Gray_leaf_spot/*.JPG /content/raw/color/leaf_spot/
%rm -fr /content/raw/color/Corn_\(maize\)___Cercospora_leaf_spot\ Gray_leaf_spot/
```
 
%% Cell type:code id: tags:
 
```
%mkdir /content/raw/color/Bacterial_spot
%cp /content/raw/color/Pepper,_bell___Bacterial_spot/*.JPG /content/raw/color/Bacterial_spot/
%rm -fr /content/raw/color/Pepper,_bell___Bacterial_spot/
 
%cp /content/raw/color/Peach___Bacterial_spot/*.JPG /content/raw/color/Bacterial_spot/
%rm -fr /content/raw/color/Peach___Bacterial_spot/
 
%cp /content/raw/color/Tomato___Bacterial_spot/*.JPG /content/raw/color/Bacterial_spot/
%rm -fr /content/raw/color/Tomato___Bacterial_spot/
```
 
%% Cell type:code id: tags:
 
```
!ls /content/raw/color
```
 
%% Output
 
Apple___Apple_scab 'Orange___Haunglongbing_(Citrus_greening)'
Bacterial_spot Powdery_mildrew
Black_rot rust
Early_blight Strawberry___Leaf_scorch
'Grape___Esca_(Black_Measles)' Tomato___Leaf_Mold
Healthy 'Tomato___Spider_mites Two-spotted_spider_mite'
Late_blight Tomato___Target_Spot
Leaf_blight Tomato___Tomato_mosaic_virus
leaf_spot Tomato___Tomato_Yellow_Leaf_Curl_Virus
 
%% Cell type:markdown id: tags:
 
#### Affichage du nom des sous dossier pour récupérer le nom des classes
 
%% Cell type:code id: tags:
 
```
import os
noms_classes = []
for root, dirs, files in os.walk("raw/color"):
#for name in files:
# print(os.path.join(root, name))
for name in dirs:
print(name)
noms_classes.append(name)
```
 
%% Output
 
Bacterial_spot
Healthy
Leaf_blight
leaf_spot
Early_blight
Tomato___Tomato_Yellow_Leaf_Curl_Virus
Tomato___Spider_mites Two-spotted_spider_mite
Apple___Apple_scab
Tomato___Tomato_mosaic_virus
Grape___Esca_(Black_Measles)
Powdery_mildrew
Strawberry___Leaf_scorch
rust
Late_blight
Orange___Haunglongbing_(Citrus_greening)
Tomato___Target_Spot
Tomato___Leaf_Mold
Black_rot
 
%% Cell type:code id: tags:
 
```
print(len(noms_classes))
noms_classes
```
 
%% Output
 
18
 
['Bacterial_spot',
'Healthy',
'Leaf_blight',
'leaf_spot',
'Early_blight',
'Tomato___Tomato_Yellow_Leaf_Curl_Virus',
'Tomato___Spider_mites Two-spotted_spider_mite',
'Apple___Apple_scab',
'Tomato___Tomato_mosaic_virus',
'Grape___Esca_(Black_Measles)',
'Powdery_mildrew',
'Strawberry___Leaf_scorch',
'rust',
'Late_blight',
'Orange___Haunglongbing_(Citrus_greening)',
'Tomato___Target_Spot',
'Tomato___Leaf_Mold',
'Black_rot']
 
%% Cell type:markdown id: tags:
 
Importation de paquets
 
%% Cell type:code id: tags:
 
```
import numpy as np
import os
import PIL
import PIL.Image
import tensorflow as tf
import tensorflow_datasets as tfds
```
 
%% Cell type:markdown id: tags:
 
### Création des deux jeux de données : **train et test**, avec un ratio **80%-20%**
 
En se basant sur l'article de référence que nous voulons surpasser, les batchs peuvent être de taille 24 ou 100.
 
%% Cell type:code id: tags:
 
```
data_set_train = tf.keras.preprocessing.image_dataset_from_directory(
'/content/raw/color/',
labels="inferred",
label_mode="int",
class_names=noms_classes,
color_mode="rgb",
batch_size=100,
image_size=(224, 224),
shuffle=True,
seed=123, #je sais pas à quoi sert ce param
seed=123,
validation_split = 0.2,
subset="training",
interpolation="bilinear",
follow_links=False
)
 
 
data_set_temp = tf.keras.preprocessing.image_dataset_from_directory(
'/content/raw/color/',
labels="inferred",
label_mode="int",
class_names=noms_classes,
color_mode="rgb",
batch_size=100,
image_size=(224, 224),
shuffle=True,
seed=123,
validation_split = 0.2,
subset="validation",
interpolation="bilinear",
follow_links=False
)
 
 
len(data_set_temp)
```
 
%% Output
 
Found 52804 files belonging to 18 classes.
Using 42244 files for training.
Found 52804 files belonging to 18 classes.
Using 10560 files for validation.
 
106
 
%% Cell type:code id: tags:
 
```
#On sépare le jeu de données en 2
data_set_test = data_set_temp.take(53)
data_set_val = data_set_temp.skip(53)
```
 
%% Cell type:markdown id: tags:
 
### Affichage de quelques images pour vérifier la cohérence
 
%% Cell type:code id: tags:
 
```
class_names = data_set_train.class_names
print(class_names)
```
 
%% Output
 
['Bacterial_spot', 'Healthy', 'Leaf_blight', 'leaf_spot', 'Early_blight', 'Tomato___Tomato_Yellow_Leaf_Curl_Virus', 'Tomato___Spider_mites Two-spotted_spider_mite', 'Apple___Apple_scab', 'Tomato___Tomato_mosaic_virus', 'Grape___Esca_(Black_Measles)', 'Powdery_mildrew', 'Strawberry___Leaf_scorch', 'rust', 'Late_blight', 'Orange___Haunglongbing_(Citrus_greening)', 'Tomato___Target_Spot', 'Tomato___Leaf_Mold', 'Black_rot']
 
%% Cell type:code id: tags:
 
```
import matplotlib.pyplot as plt
 
plt.figure(figsize=(10, 10))
for images, labels in data_set_train.take(1):
for i in range(9):
ax = plt.subplot(3, 3, i + 1)
plt.imshow(images[i].numpy().astype("uint8"))
plt.title(class_names[labels[i]])
plt.axis("off")
```
 
%% Output
 
 
%% Cell type:markdown id: tags:
 
#### Vérification de la taille des batchs
 
%% Cell type:code id: tags:
 
```
for image_batch, labels_batch in data_set_train:
print(image_batch.shape)
print(labels_batch.shape)
break
```
 
%% Cell type:markdown id: tags:
 
Installation du module EfficientNet
 
/!\ n'est nécessaire qu'une fois
 
%% Cell type:code id: tags:
 
```
!pip3 install efficientnet
```
 
%% Cell type:markdown id: tags:
 
Chargement des paquets
 
### Vérification de la présence d'un TPU (beaucoup plus rapide) ou à défaut d'une GPU ou CPU
 
Augmentation des données par divers procéssus et transformation en map
 
%% Cell type:code id: tags:
 
```
from tensorflow.keras.applications import EfficientNetB0
import tensorflow as tf
import numpy as np
from tensorflow.keras.models import Sequential
from tensorflow.keras import layers
from tensorflow.keras.layers.experimental import preprocessing
 
#from cloud_tpu_client import Client
#c = Client()
#c.configure_tpu_version(tf.__version__, restart_type="always")
 
try:
tpu = tf.distribute.cluster_resolver.TPUClusterResolver() # TPU detection
print("Running on TPU ", tpu.cluster_spec().as_dict()["worker"])
tf.config.experimental_connect_to_cluster(tpu)
tf.tpu.experimental.initialize_tpu_system(tpu)
strategy = tf.distribute.experimental.TPUStrategy(tpu)
except ValueError:
print("Not connected to a TPU runtime. Using CPU/GPU strategy")
strategy = tf.distribute.MirroredStrategy()
#strategy = tf.distribute.MirroredStrategy()
 
IMG_SIZE = 224
NUM_CLASSES = 18
batch_size = 100
 
img_augmentation = Sequential(
[
preprocessing.RandomRotation(factor=0.15),
preprocessing.RandomTranslation(height_factor=0.1, width_factor=0.1),
preprocessing.RandomFlip(),
preprocessing.RandomContrast(factor=0.1),
],
name="img_augmentation",
)
 
def input_preprocess(image, label):
label = tf.one_hot(label, NUM_CLASSES)
return image, label
 
 
ds_train = data_set_train.map(
input_preprocess, num_parallel_calls=tf.data.experimental.AUTOTUNE
)
#ds_train = ds_train.batch(batch_size=batch_size, drop_remainder=True)
ds_train = ds_train.prefetch(tf.data.experimental.AUTOTUNE)
 
ds_test = data_set_test.map(input_preprocess)
#ds_test = ds_test.batch(batch_size=batch_size, drop_remainder=True)
 
ds_val = data_set_val.map(input_preprocess)
```
 
%% Cell type:markdown id: tags:
 
-----------------------------------------------------------------------
 
## Apprentissage
 
-----------------------------------------------------------------------
 
#### /!\ Ici il y a deux versions de l'apprentissages :
 
* From sratch
* Avec pré-apprentissage sur ImageNet --> dans cette situation, on peut aussi apprendre notre modèle durant quelques epoch puis le reprendre afin de continuer l'apprentissage, dans ce cas on le charge, sans réexécuter le code du pré-apprentissage.
 
Il ne faut lancer que l'un des deux
 
%% Cell type:markdown id: tags:
 
### **From scratch**
 
%% Cell type:code id: tags:
 
```
## from scratch
 
 
with strategy.scope():
inputs = layers.Input(shape=(IMG_SIZE, IMG_SIZE, 3))
x = img_augmentation(inputs)
outputs = EfficientNetB0(include_top=True, weights=None, classes=NUM_CLASSES)(x)
 
model = tf.keras.Model(inputs, outputs)
model.compile(
optimizer="adam", loss="categorical_crossentropy", metrics=["accuracy"]
)
 
model.summary()
 
epochs = 11 # @param {type: "slider", min:10, max:100}
#train_images_tab = np.array(train_images)
#train_labels_tab = np.array(train_labels)
#test_images_tab = np.array(test_images)
#test_labels_tab = np.array(test_labels)
hist = model.fit(ds_train, epochs=epochs, validation_data=ds_test, verbose=2)
```
 
%% Cell type:markdown id: tags:
 
### **Avec pré-apprentissage**
 
%% Cell type:code id: tags:
 
```
## pretrained sur imagenet
 
 
def build_model(num_classes):
inputs = layers.Input(shape=(IMG_SIZE, IMG_SIZE, 3))
x = img_augmentation(inputs)
model = EfficientNetB0(include_top=False, input_tensor=x, weights="imagenet")
 
# Freeze the pretrained weights
model.trainable = False
 
# Rebuild top
x = layers.GlobalAveragePooling2D(name="avg_pool")(model.output)
x = layers.BatchNormalization()(x)
 
top_dropout_rate = 0.2
x = layers.Dropout(top_dropout_rate, name="top_dropout")(x)
outputs = layers.Dense(NUM_CLASSES, activation="softmax", name="pred")(x)
 
# Compile
model = tf.keras.Model(inputs, outputs, name="EfficientNet")
optimizer = tf.keras.optimizers.Adam(learning_rate=1e-2)
model.compile(
optimizer=optimizer, loss="categorical_crossentropy", metrics=["accuracy"]
)
return model
 
with strategy.scope():
model = build_model(num_classes=NUM_CLASSES)
 
#epochs = 25 # @param {type: "slider", min:8, max:80}
epochs = 30
hist = model.fit(ds_train, epochs=epochs, validation_data=ds_val, verbose=1)
 
```
 
%% Output
 
INFO:tensorflow:Reduce to /job:localhost/replica:0/task:0/device:CPU:0 then broadcast to ('/job:localhost/replica:0/task:0/device:CPU:0',).
INFO:tensorflow:Reduce to /job:localhost/replica:0/task:0/device:CPU:0 then broadcast to ('/job:localhost/replica:0/task:0/device:CPU:0',).
INFO:tensorflow:Reduce to /job:localhost/replica:0/task:0/device:CPU:0 then broadcast to ('/job:localhost/replica:0/task:0/device:CPU:0',).
INFO:tensorflow:Reduce to /job:localhost/replica:0/task:0/device:CPU:0 then broadcast to ('/job:localhost/replica:0/task:0/device:CPU:0',).
INFO:tensorflow:Reduce to /job:localhost/replica:0/task:0/device:CPU:0 then broadcast to ('/job:localhost/replica:0/task:0/device:CPU:0',).
INFO:tensorflow:Reduce to /job:localhost/replica:0/task:0/device:CPU:0 then broadcast to ('/job:localhost/replica:0/task:0/device:CPU:0',).
INFO:tensorflow:Reduce to /job:localhost/replica:0/task:0/device:CPU:0 then broadcast to ('/job:localhost/replica:0/task:0/device:CPU:0',).
INFO:tensorflow:Reduce to /job:localhost/replica:0/task:0/device:CPU:0 then broadcast to ('/job:localhost/replica:0/task:0/device:CPU:0',).
INFO:tensorflow:Reduce to /job:localhost/replica:0/task:0/device:CPU:0 then broadcast to ('/job:localhost/replica:0/task:0/device:CPU:0',).
INFO:tensorflow:Reduce to /job:localhost/replica:0/task:0/device:CPU:0 then broadcast to ('/job:localhost/replica:0/task:0/device:CPU:0',).
Downloading data from https://storage.googleapis.com/keras-applications/efficientnetb0_notop.h5
16711680/16705208 [==============================] - 0s 0us/step
Epoch 1/30
435/435 [==============================] - 162s 274ms/step - loss: 0.8377 - accuracy: 0.8054 - val_loss: 0.2599 - val_accuracy: 0.9260
Epoch 2/30
435/435 [==============================] - 104s 237ms/step - loss: 0.4056 - accuracy: 0.9046 - val_loss: 0.2520 - val_accuracy: 0.9354
Epoch 3/30
435/435 [==============================] - 104s 237ms/step - loss: 0.3344 - accuracy: 0.9160 - val_loss: 0.2606 - val_accuracy: 0.9317
Epoch 4/30
435/435 [==============================] - 104s 237ms/step - loss: 0.2944 - accuracy: 0.9214 - val_loss: 0.1973 - val_accuracy: 0.9414
Epoch 5/30
435/435 [==============================] - 104s 238ms/step - loss: 0.2717 - accuracy: 0.9228 - val_loss: 0.1582 - val_accuracy: 0.9493
Epoch 6/30
435/435 [==============================] - 104s 237ms/step - loss: 0.2639 - accuracy: 0.9268 - val_loss: 0.2004 - val_accuracy: 0.9423
Epoch 7/30
435/435 [==============================] - 104s 237ms/step - loss: 0.2510 - accuracy: 0.9272 - val_loss: 0.1883 - val_accuracy: 0.9423
Epoch 8/30
435/435 [==============================] - 104s 237ms/step - loss: 0.2552 - accuracy: 0.9243 - val_loss: 0.1760 - val_accuracy: 0.9491
Epoch 9/30
435/435 [==============================] - 104s 236ms/step - loss: 0.2557 - accuracy: 0.9287 - val_loss: 0.2122 - val_accuracy: 0.9388
Epoch 10/30
435/435 [==============================] - 104s 237ms/step - loss: 0.2650 - accuracy: 0.9252 - val_loss: 0.1731 - val_accuracy: 0.9513
Epoch 11/30
435/435 [==============================] - 104s 236ms/step - loss: 0.2867 - accuracy: 0.9226 - val_loss: 0.2139 - val_accuracy: 0.9398
Epoch 12/30
435/435 [==============================] - 104s 236ms/step - loss: 0.2874 - accuracy: 0.9211 - val_loss: 0.1839 - val_accuracy: 0.9476
Epoch 13/30
435/435 [==============================] - 104s 237ms/step - loss: 0.2964 - accuracy: 0.9206 - val_loss: 0.2805 - val_accuracy: 0.9311
Epoch 14/30
435/435 [==============================] - 103s 235ms/step - loss: 0.2865 - accuracy: 0.9253 - val_loss: 0.2205 - val_accuracy: 0.9460
Epoch 15/30
435/435 [==============================] - 104s 237ms/step - loss: 0.2905 - accuracy: 0.9224 - val_loss: 0.2049 - val_accuracy: 0.9469
Epoch 16/30
435/435 [==============================] - 105s 238ms/step - loss: 0.2965 - accuracy: 0.9235 - val_loss: 0.1822 - val_accuracy: 0.9509
Epoch 17/30
435/435 [==============================] - 104s 237ms/step - loss: 0.2815 - accuracy: 0.9252 - val_loss: 0.1777 - val_accuracy: 0.9506
Epoch 18/30
435/435 [==============================] - 104s 237ms/step - loss: 0.2880 - accuracy: 0.9264 - val_loss: 0.2370 - val_accuracy: 0.9343
Epoch 19/30
435/435 [==============================] - 105s 238ms/step - loss: 0.2907 - accuracy: 0.9243 - val_loss: 0.1942 - val_accuracy: 0.9506
Epoch 20/30
435/435 [==============================] - 104s 238ms/step - loss: 0.2878 - accuracy: 0.9272 - val_loss: 0.1943 - val_accuracy: 0.9462
Epoch 21/30
435/435 [==============================] - 104s 237ms/step - loss: 0.2911 - accuracy: 0.9274 - val_loss: 0.2122 - val_accuracy: 0.9425
Epoch 22/30
435/435 [==============================] - 104s 237ms/step - loss: 0.2773 - accuracy: 0.9297 - val_loss: 0.2423 - val_accuracy: 0.9410
Epoch 23/30
435/435 [==============================] - 104s 238ms/step - loss: 0.2905 - accuracy: 0.9267 - val_loss: 0.2421 - val_accuracy: 0.9383
Epoch 24/30
435/435 [==============================] - 104s 238ms/step - loss: 0.3118 - accuracy: 0.9248 - val_loss: 0.1638 - val_accuracy: 0.9564
Epoch 25/30
435/435 [==============================] - 105s 239ms/step - loss: 0.2863 - accuracy: 0.9297 - val_loss: 0.1929 - val_accuracy: 0.9478
Epoch 26/30
435/435 [==============================] - 105s 238ms/step - loss: 0.3081 - accuracy: 0.9256 - val_loss: 0.2275 - val_accuracy: 0.9423
Epoch 27/30
435/435 [==============================] - 105s 239ms/step - loss: 0.3055 - accuracy: 0.9254 - val_loss: 0.2017 - val_accuracy: 0.9498
Epoch 28/30
435/435 [==============================] - 105s 239ms/step - loss: 0.2920 - accuracy: 0.9270 - val_loss: 0.1951 - val_accuracy: 0.9515
Epoch 29/30
435/435 [==============================] - 105s 239ms/step - loss: 0.2904 - accuracy: 0.9290 - val_loss: 0.2392 - val_accuracy: 0.9482
Epoch 30/30
435/435 [==============================] - 105s 239ms/step - loss: 0.3056 - accuracy: 0.9254 - val_loss: 0.2506 - val_accuracy: 0.9427
 
%% Cell type:markdown id: tags:
 
#### Évaluation sur le jeu de données de test
 
%% Cell type:code id: tags:
 
```
model.evaluate(ds_test, verbose=1)
```
 
%% Output
 
54/54 [==============================] - 11s 187ms/step - loss: 0.2504 - accuracy: 0.9446
 
[0.2503720819950104, 0.9446296095848083]
 
%% Cell type:markdown id: tags:
 
#### Matrice de confusion
 
%% Cell type:code id: tags:
 
```
model.predict(ds_test)
```
 
%% Output
 
array([[1.04884615e-19, 4.83391105e-12, 4.24358171e-18, ...,
3.09647544e-06, 2.07068956e-06, 1.62103002e-12],
[3.23762419e-36, 3.36163253e-27, 2.16056984e-27, ...,
6.37836394e-25, 8.53544129e-28, 3.96316359e-34],
[3.28093330e-33, 4.62228237e-13, 6.07556688e-23, ...,
1.04409666e-22, 1.79479210e-21, 2.36939055e-30],
...,
[3.70610581e-18, 5.51932492e-17, 6.18134106e-20, ...,
8.08427700e-11, 9.99947429e-01, 4.22652026e-14],
[7.33232282e-19, 2.04400465e-18, 8.08917396e-15, ...,
1.21607263e-20, 1.24541866e-21, 1.85483236e-22],
[1.56312459e-28, 1.94282106e-33, 9.50900947e-29, ...,
2.03727057e-26, 1.30362685e-26, 2.30533946e-30]], dtype=float32)
 
%% Cell type:code id: tags:
 
```
predictions = np.array([])
labels = np.array([])
for x, y in ds_test2:
predictions = np.concatenate([predictions, np.argmax(model.predict(x), axis = -1)])
labels = np.concatenate([labels, np.argmax(y.numpy(), axis=-1)])
 
res = tf.math.confusion_matrix(labels=labels, predictions=predictions).numpy()
plt.matshow(res)
```
 
%% Output
 
<matplotlib.image.AxesImage at 0x7fea99bf6950>
 
 
%% Cell type:markdown id: tags:
 
#### Visualisation de l'accuracy et de la loss
 
%% Cell type:markdown id: tags:
 
Valeurs d'accuracy à battre :
 
- si batch 24 : 0.9928 (30 epoch)
- si batch 100 : 0.9935 (30 epoch)
 
%% Cell type:code id: tags:
 
```
import matplotlib.pyplot as plt
 
 
def plot_hist_accuracy(hist):
plt.plot(hist.history["accuracy"])
plt.plot(hist.history["val_accuracy"])
plt.title("model accuracy")
plt.ylabel("accuracy")
plt.xlabel("epoch")
plt.legend(["train", "validation"], loc="upper left")
plt.show()
 
 
plot_hist_accuracy(hist)
```
 
%% Output
 
 
%% Cell type:code id: tags:
 
```
def plot_hist_loss(hist):
plt.plot(hist.history["loss"])
plt.plot(hist.history["val_loss"])
plt.title("model loss")
plt.ylabel("loss")
plt.xlabel("epoch")
plt.legend(["train", "validation"], loc="upper left")
plt.show()
 
 
plot_hist_loss(hist)
```
 
%% Output
 
 
%% Cell type:markdown id: tags:
 
#### Sauvegarde du modèle et chargement pour refaire un apprentissage dessus
 
%% Cell type:code id: tags:
 
```
#!pip install pyyaml h5py
model.save('/content/drive/My Drive/30epoch100batch38classes', save_format='tf')
!ls
```
 
%% Output
 
INFO:tensorflow:Assets written to: /content/drive/My Drive/30epoch100batch38classes/assets
drive raw sample_data
 
%% Cell type:code id: tags:
 
```
#réutiliser le modèle sans run l'entraînement
loaded_model = tf.keras.models.load_model('/content/drive/My Drive/90epoch100batch38classes')
```
 
%% Output
 
WARNING:absl:Importing a function (__inference_block5b_activation_layer_call_and_return_conditional_losses_454649) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block1a_activation_layer_call_and_return_conditional_losses_449799) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block7a_expand_activation_layer_call_and_return_conditional_losses_457849) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block3a_activation_layer_call_and_return_conditional_losses_433971) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block7a_expand_activation_layer_call_and_return_conditional_losses_439019) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block5c_activation_layer_call_and_return_conditional_losses_436935) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block5c_expand_activation_layer_call_and_return_conditional_losses_436841) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block6b_activation_layer_call_and_return_conditional_losses_437775) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block3a_expand_activation_layer_call_and_return_conditional_losses_451257) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block4c_se_reduce_layer_call_and_return_conditional_losses_453606) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block6c_expand_activation_layer_call_and_return_conditional_losses_438127) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block4a_activation_layer_call_and_return_conditional_losses_434811) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block4b_se_reduce_layer_call_and_return_conditional_losses_453041) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block5b_se_reduce_layer_call_and_return_conditional_losses_454689) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_446288) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_top_activation_layer_call_and_return_conditional_losses_439412) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block7a_activation_layer_call_and_return_conditional_losses_457992) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block4b_activation_layer_call_and_return_conditional_losses_435204) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block3a_expand_activation_layer_call_and_return_conditional_losses_433876) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block5b_activation_layer_call_and_return_conditional_losses_436489) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_EfficientNet_layer_call_and_return_conditional_losses_447938) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block2b_expand_activation_layer_call_and_return_conditional_losses_433430) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block6c_activation_layer_call_and_return_conditional_losses_456862) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference_block2b_activation_layer_call_and_return_conditional_losses_450835) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.
WARNING:absl:Importing a function (__inference__wrapped_model_426134) with ops with custom gradients. Will likely fail if a gradient is requested.