August 2018
Intermediate to advanced
272 pages
7h 2m
English
In this example, we will load the weights from a MNIST convolutional autoencoder example. We will restore the weights of the encoder part only, freeze the CONV layers, and train the FC layers to perform digits classification:
import tensorflow as tf
import numpy as np
import os from models import CAE_CNN_Encoder
SAVE_FOLDER='/tmp/cae_cnn_transfer'
from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
model = CAE_CNN_Encoder(latent_size = 20)
model_in = model.input
model_out = model.output
labels_in = model.labels
# Get all convs weights
list_convs = [v for v in tf.global_variables() if "conv" in v.name]
# Get fc1 and logits
list_fc_layers = [v for v in tf ...Read now
Unlock full access