Welcome! In this assignment, you're going to build a face recognition system. Many of the ideas presented here are from FaceNet. In the lecture, you also encountered DeepFace.
Face recognition problems commonly fall into one of two categories:
Face Verification "Is this the claimed person?" For example, at some airports, you can pass through customs by letting a system scan your passport and then verifying that you (the person carrying the passport) are the correct person. A mobile phone that unlocks using your face is also using face verification. This is a 1:1 matching problem.
Face Recognition "Who is this person?" For example, the video lecture showed a face recognition video of Baidu employees entering the office without needing to otherwise identify themselves. This is a 1:K matching problem.
FaceNet learns a neural network that encodes a face image into a vector of 128 numbers. By comparing two such vectors, you can then determine if two pictures are of the same person.
By the end of this assignment, you'll be able to:
Channels-last notation
For this assignment, you'll be using a pre-trained model which represents ConvNet activations using a "channels last" convention, as used during the lecture and in previous programming assignments.
In other words, a batch of images will be of shape $(m, n_H, n_W, n_C)$.
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Conv2D, ZeroPadding2D, Activation, Input, concatenate
from tensorflow.keras.models import Model
from tensorflow.keras.layers import BatchNormalization
from tensorflow.keras.layers import MaxPooling2D, AveragePooling2D
from tensorflow.keras.layers import Concatenate
from tensorflow.keras.layers import Lambda, Flatten, Dense
from tensorflow.keras.initializers import glorot_uniform
from tensorflow.keras.layers import Layer
from tensorflow.keras import backend as K
K.set_image_data_format('channels_last')
import os
import numpy as np
from numpy import genfromtxt
import pandas as pd
import tensorflow as tf
import PIL
%matplotlib inline
%load_ext autoreload
%autoreload 2
In Face Verification, you're given two images and you have to determine if they are of the same person. The simplest way to do this is to compare the two images pixel-by-pixel. If the distance between the raw images is below a chosen threshold, it may be the same person!
Of course, this algorithm performs poorly, since the pixel values change dramatically due to variations in lighting, orientation of the person's face, minor changes in head position, and so on.
You'll see that rather than using the raw image, you can learn an encoding, $f(img)$.
By using an encoding for each image, an element-wise comparison produces a more accurate judgement as to whether two pictures are of the same person.
The FaceNet model takes a lot of data and a long time to train. So following the common practice in applied deep learning, you'll load weights that someone else has already trained. The network architecture follows the Inception model from Szegedy et al.. An Inception network implementation has been provided for you, and you can find it in the file inception_blocks_v2.py
to get a closer look at how it is implemented.
Hot tip: Go to "File->Open..." at the top of this notebook. This opens the file directory that contains the .py
file).
The key things to be aware of are:
img_to_encoding()
function.Run the cell below to create the model for face images!
from tensorflow.keras.models import model_from_json
json_file = open('keras-facenet-h5/model.json', 'r')
loaded_model_json = json_file.read()
json_file.close()
model = model_from_json(loaded_model_json)
model.load_weights('keras-facenet-h5/model.h5')
Now summarize the input and output shapes:
print(model.inputs)
print(model.outputs)
[<tf.Tensor 'input_1:0' shape=(None, 160, 160, 3) dtype=float32>] [<tf.Tensor 'Bottleneck_BatchNorm/batchnorm/add_1:0' shape=(None, 128) dtype=float32>]
model.summary()
Model: "inception_resnet_v1" __________________________________________________________________________________________________ Layer (type) Output Shape Param # Connected to ================================================================================================== input_1 (InputLayer) [(None, 160, 160, 3) 0 __________________________________________________________________________________________________ Conv2d_1a_3x3 (Conv2D) (None, 79, 79, 32) 864 input_1[0][0] __________________________________________________________________________________________________ Conv2d_1a_3x3_BatchNorm (BatchN (None, 79, 79, 32) 96 Conv2d_1a_3x3[0][0] __________________________________________________________________________________________________ Conv2d_1a_3x3_Activation (Activ (None, 79, 79, 32) 0 Conv2d_1a_3x3_BatchNorm[0][0] __________________________________________________________________________________________________ Conv2d_2a_3x3 (Conv2D) (None, 77, 77, 32) 9216 Conv2d_1a_3x3_Activation[0][0] __________________________________________________________________________________________________ Conv2d_2a_3x3_BatchNorm (BatchN (None, 77, 77, 32) 96 Conv2d_2a_3x3[0][0] __________________________________________________________________________________________________ Conv2d_2a_3x3_Activation (Activ (None, 77, 77, 32) 0 Conv2d_2a_3x3_BatchNorm[0][0] __________________________________________________________________________________________________ Conv2d_2b_3x3 (Conv2D) (None, 77, 77, 64) 18432 Conv2d_2a_3x3_Activation[0][0] __________________________________________________________________________________________________ Conv2d_2b_3x3_BatchNorm (BatchN (None, 77, 77, 64) 192 Conv2d_2b_3x3[0][0] __________________________________________________________________________________________________ Conv2d_2b_3x3_Activation (Activ (None, 77, 77, 64) 0 Conv2d_2b_3x3_BatchNorm[0][0] __________________________________________________________________________________________________ MaxPool_3a_3x3 (MaxPooling2D) (None, 38, 38, 64) 0 Conv2d_2b_3x3_Activation[0][0] __________________________________________________________________________________________________ Conv2d_3b_1x1 (Conv2D) (None, 38, 38, 80) 5120 MaxPool_3a_3x3[0][0] __________________________________________________________________________________________________ Conv2d_3b_1x1_BatchNorm (BatchN (None, 38, 38, 80) 240 Conv2d_3b_1x1[0][0] __________________________________________________________________________________________________ Conv2d_3b_1x1_Activation (Activ (None, 38, 38, 80) 0 Conv2d_3b_1x1_BatchNorm[0][0] __________________________________________________________________________________________________ Conv2d_4a_3x3 (Conv2D) (None, 36, 36, 192) 138240 Conv2d_3b_1x1_Activation[0][0] __________________________________________________________________________________________________ Conv2d_4a_3x3_BatchNorm (BatchN (None, 36, 36, 192) 576 Conv2d_4a_3x3[0][0] __________________________________________________________________________________________________ Conv2d_4a_3x3_Activation (Activ (None, 36, 36, 192) 0 Conv2d_4a_3x3_BatchNorm[0][0] __________________________________________________________________________________________________ Conv2d_4b_3x3 (Conv2D) (None, 17, 17, 256) 442368 Conv2d_4a_3x3_Activation[0][0] __________________________________________________________________________________________________ Conv2d_4b_3x3_BatchNorm (BatchN (None, 17, 17, 256) 768 Conv2d_4b_3x3[0][0] __________________________________________________________________________________________________ Conv2d_4b_3x3_Activation (Activ (None, 17, 17, 256) 0 Conv2d_4b_3x3_BatchNorm[0][0] __________________________________________________________________________________________________ Block35_1_Branch_2_Conv2d_0a_1x (None, 17, 17, 32) 8192 Conv2d_4b_3x3_Activation[0][0] __________________________________________________________________________________________________ Block35_1_Branch_2_Conv2d_0a_1x (None, 17, 17, 32) 96 Block35_1_Branch_2_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block35_1_Branch_2_Conv2d_0a_1x (None, 17, 17, 32) 0 Block35_1_Branch_2_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_1_Branch_1_Conv2d_0a_1x (None, 17, 17, 32) 8192 Conv2d_4b_3x3_Activation[0][0] __________________________________________________________________________________________________ Block35_1_Branch_2_Conv2d_0b_3x (None, 17, 17, 32) 9216 Block35_1_Branch_2_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_1_Branch_1_Conv2d_0a_1x (None, 17, 17, 32) 96 Block35_1_Branch_1_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block35_1_Branch_2_Conv2d_0b_3x (None, 17, 17, 32) 96 Block35_1_Branch_2_Conv2d_0b_3x3[ __________________________________________________________________________________________________ Block35_1_Branch_1_Conv2d_0a_1x (None, 17, 17, 32) 0 Block35_1_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_1_Branch_2_Conv2d_0b_3x (None, 17, 17, 32) 0 Block35_1_Branch_2_Conv2d_0b_3x3_ __________________________________________________________________________________________________ Block35_1_Branch_0_Conv2d_1x1 ( (None, 17, 17, 32) 8192 Conv2d_4b_3x3_Activation[0][0] __________________________________________________________________________________________________ Block35_1_Branch_1_Conv2d_0b_3x (None, 17, 17, 32) 9216 Block35_1_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_1_Branch_2_Conv2d_0c_3x (None, 17, 17, 32) 9216 Block35_1_Branch_2_Conv2d_0b_3x3_ __________________________________________________________________________________________________ Block35_1_Branch_0_Conv2d_1x1_B (None, 17, 17, 32) 96 Block35_1_Branch_0_Conv2d_1x1[0][ __________________________________________________________________________________________________ Block35_1_Branch_1_Conv2d_0b_3x (None, 17, 17, 32) 96 Block35_1_Branch_1_Conv2d_0b_3x3[ __________________________________________________________________________________________________ Block35_1_Branch_2_Conv2d_0c_3x (None, 17, 17, 32) 96 Block35_1_Branch_2_Conv2d_0c_3x3[ __________________________________________________________________________________________________ Block35_1_Branch_0_Conv2d_1x1_A (None, 17, 17, 32) 0 Block35_1_Branch_0_Conv2d_1x1_Bat __________________________________________________________________________________________________ Block35_1_Branch_1_Conv2d_0b_3x (None, 17, 17, 32) 0 Block35_1_Branch_1_Conv2d_0b_3x3_ __________________________________________________________________________________________________ Block35_1_Branch_2_Conv2d_0c_3x (None, 17, 17, 32) 0 Block35_1_Branch_2_Conv2d_0c_3x3_ __________________________________________________________________________________________________ Block35_1_Concatenate (Concaten (None, 17, 17, 96) 0 Block35_1_Branch_0_Conv2d_1x1_Act Block35_1_Branch_1_Conv2d_0b_3x3_ Block35_1_Branch_2_Conv2d_0c_3x3_ __________________________________________________________________________________________________ Block35_1_Conv2d_1x1 (Conv2D) (None, 17, 17, 256) 24832 Block35_1_Concatenate[0][0] __________________________________________________________________________________________________ Block35_1_ScaleSum (Lambda) (None, 17, 17, 256) 0 Conv2d_4b_3x3_Activation[0][0] Block35_1_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block35_1_Activation (Activatio (None, 17, 17, 256) 0 Block35_1_ScaleSum[0][0] __________________________________________________________________________________________________ Block35_2_Branch_2_Conv2d_0a_1x (None, 17, 17, 32) 8192 Block35_1_Activation[0][0] __________________________________________________________________________________________________ Block35_2_Branch_2_Conv2d_0a_1x (None, 17, 17, 32) 96 Block35_2_Branch_2_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block35_2_Branch_2_Conv2d_0a_1x (None, 17, 17, 32) 0 Block35_2_Branch_2_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_2_Branch_1_Conv2d_0a_1x (None, 17, 17, 32) 8192 Block35_1_Activation[0][0] __________________________________________________________________________________________________ Block35_2_Branch_2_Conv2d_0b_3x (None, 17, 17, 32) 9216 Block35_2_Branch_2_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_2_Branch_1_Conv2d_0a_1x (None, 17, 17, 32) 96 Block35_2_Branch_1_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block35_2_Branch_2_Conv2d_0b_3x (None, 17, 17, 32) 96 Block35_2_Branch_2_Conv2d_0b_3x3[ __________________________________________________________________________________________________ Block35_2_Branch_1_Conv2d_0a_1x (None, 17, 17, 32) 0 Block35_2_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_2_Branch_2_Conv2d_0b_3x (None, 17, 17, 32) 0 Block35_2_Branch_2_Conv2d_0b_3x3_ __________________________________________________________________________________________________ Block35_2_Branch_0_Conv2d_1x1 ( (None, 17, 17, 32) 8192 Block35_1_Activation[0][0] __________________________________________________________________________________________________ Block35_2_Branch_1_Conv2d_0b_3x (None, 17, 17, 32) 9216 Block35_2_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_2_Branch_2_Conv2d_0c_3x (None, 17, 17, 32) 9216 Block35_2_Branch_2_Conv2d_0b_3x3_ __________________________________________________________________________________________________ Block35_2_Branch_0_Conv2d_1x1_B (None, 17, 17, 32) 96 Block35_2_Branch_0_Conv2d_1x1[0][ __________________________________________________________________________________________________ Block35_2_Branch_1_Conv2d_0b_3x (None, 17, 17, 32) 96 Block35_2_Branch_1_Conv2d_0b_3x3[ __________________________________________________________________________________________________ Block35_2_Branch_2_Conv2d_0c_3x (None, 17, 17, 32) 96 Block35_2_Branch_2_Conv2d_0c_3x3[ __________________________________________________________________________________________________ Block35_2_Branch_0_Conv2d_1x1_A (None, 17, 17, 32) 0 Block35_2_Branch_0_Conv2d_1x1_Bat __________________________________________________________________________________________________ Block35_2_Branch_1_Conv2d_0b_3x (None, 17, 17, 32) 0 Block35_2_Branch_1_Conv2d_0b_3x3_ __________________________________________________________________________________________________ Block35_2_Branch_2_Conv2d_0c_3x (None, 17, 17, 32) 0 Block35_2_Branch_2_Conv2d_0c_3x3_ __________________________________________________________________________________________________ Block35_2_Concatenate (Concaten (None, 17, 17, 96) 0 Block35_2_Branch_0_Conv2d_1x1_Act Block35_2_Branch_1_Conv2d_0b_3x3_ Block35_2_Branch_2_Conv2d_0c_3x3_ __________________________________________________________________________________________________ Block35_2_Conv2d_1x1 (Conv2D) (None, 17, 17, 256) 24832 Block35_2_Concatenate[0][0] __________________________________________________________________________________________________ Block35_2_ScaleSum (Lambda) (None, 17, 17, 256) 0 Block35_1_Activation[0][0] Block35_2_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block35_2_Activation (Activatio (None, 17, 17, 256) 0 Block35_2_ScaleSum[0][0] __________________________________________________________________________________________________ Block35_3_Branch_2_Conv2d_0a_1x (None, 17, 17, 32) 8192 Block35_2_Activation[0][0] __________________________________________________________________________________________________ Block35_3_Branch_2_Conv2d_0a_1x (None, 17, 17, 32) 96 Block35_3_Branch_2_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block35_3_Branch_2_Conv2d_0a_1x (None, 17, 17, 32) 0 Block35_3_Branch_2_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_3_Branch_1_Conv2d_0a_1x (None, 17, 17, 32) 8192 Block35_2_Activation[0][0] __________________________________________________________________________________________________ Block35_3_Branch_2_Conv2d_0b_3x (None, 17, 17, 32) 9216 Block35_3_Branch_2_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_3_Branch_1_Conv2d_0a_1x (None, 17, 17, 32) 96 Block35_3_Branch_1_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block35_3_Branch_2_Conv2d_0b_3x (None, 17, 17, 32) 96 Block35_3_Branch_2_Conv2d_0b_3x3[ __________________________________________________________________________________________________ Block35_3_Branch_1_Conv2d_0a_1x (None, 17, 17, 32) 0 Block35_3_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_3_Branch_2_Conv2d_0b_3x (None, 17, 17, 32) 0 Block35_3_Branch_2_Conv2d_0b_3x3_ __________________________________________________________________________________________________ Block35_3_Branch_0_Conv2d_1x1 ( (None, 17, 17, 32) 8192 Block35_2_Activation[0][0] __________________________________________________________________________________________________ Block35_3_Branch_1_Conv2d_0b_3x (None, 17, 17, 32) 9216 Block35_3_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_3_Branch_2_Conv2d_0c_3x (None, 17, 17, 32) 9216 Block35_3_Branch_2_Conv2d_0b_3x3_ __________________________________________________________________________________________________ Block35_3_Branch_0_Conv2d_1x1_B (None, 17, 17, 32) 96 Block35_3_Branch_0_Conv2d_1x1[0][ __________________________________________________________________________________________________ Block35_3_Branch_1_Conv2d_0b_3x (None, 17, 17, 32) 96 Block35_3_Branch_1_Conv2d_0b_3x3[ __________________________________________________________________________________________________ Block35_3_Branch_2_Conv2d_0c_3x (None, 17, 17, 32) 96 Block35_3_Branch_2_Conv2d_0c_3x3[ __________________________________________________________________________________________________ Block35_3_Branch_0_Conv2d_1x1_A (None, 17, 17, 32) 0 Block35_3_Branch_0_Conv2d_1x1_Bat __________________________________________________________________________________________________ Block35_3_Branch_1_Conv2d_0b_3x (None, 17, 17, 32) 0 Block35_3_Branch_1_Conv2d_0b_3x3_ __________________________________________________________________________________________________ Block35_3_Branch_2_Conv2d_0c_3x (None, 17, 17, 32) 0 Block35_3_Branch_2_Conv2d_0c_3x3_ __________________________________________________________________________________________________ Block35_3_Concatenate (Concaten (None, 17, 17, 96) 0 Block35_3_Branch_0_Conv2d_1x1_Act Block35_3_Branch_1_Conv2d_0b_3x3_ Block35_3_Branch_2_Conv2d_0c_3x3_ __________________________________________________________________________________________________ Block35_3_Conv2d_1x1 (Conv2D) (None, 17, 17, 256) 24832 Block35_3_Concatenate[0][0] __________________________________________________________________________________________________ Block35_3_ScaleSum (Lambda) (None, 17, 17, 256) 0 Block35_2_Activation[0][0] Block35_3_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block35_3_Activation (Activatio (None, 17, 17, 256) 0 Block35_3_ScaleSum[0][0] __________________________________________________________________________________________________ Block35_4_Branch_2_Conv2d_0a_1x (None, 17, 17, 32) 8192 Block35_3_Activation[0][0] __________________________________________________________________________________________________ Block35_4_Branch_2_Conv2d_0a_1x (None, 17, 17, 32) 96 Block35_4_Branch_2_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block35_4_Branch_2_Conv2d_0a_1x (None, 17, 17, 32) 0 Block35_4_Branch_2_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_4_Branch_1_Conv2d_0a_1x (None, 17, 17, 32) 8192 Block35_3_Activation[0][0] __________________________________________________________________________________________________ Block35_4_Branch_2_Conv2d_0b_3x (None, 17, 17, 32) 9216 Block35_4_Branch_2_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_4_Branch_1_Conv2d_0a_1x (None, 17, 17, 32) 96 Block35_4_Branch_1_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block35_4_Branch_2_Conv2d_0b_3x (None, 17, 17, 32) 96 Block35_4_Branch_2_Conv2d_0b_3x3[ __________________________________________________________________________________________________ Block35_4_Branch_1_Conv2d_0a_1x (None, 17, 17, 32) 0 Block35_4_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_4_Branch_2_Conv2d_0b_3x (None, 17, 17, 32) 0 Block35_4_Branch_2_Conv2d_0b_3x3_ __________________________________________________________________________________________________ Block35_4_Branch_0_Conv2d_1x1 ( (None, 17, 17, 32) 8192 Block35_3_Activation[0][0] __________________________________________________________________________________________________ Block35_4_Branch_1_Conv2d_0b_3x (None, 17, 17, 32) 9216 Block35_4_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_4_Branch_2_Conv2d_0c_3x (None, 17, 17, 32) 9216 Block35_4_Branch_2_Conv2d_0b_3x3_ __________________________________________________________________________________________________ Block35_4_Branch_0_Conv2d_1x1_B (None, 17, 17, 32) 96 Block35_4_Branch_0_Conv2d_1x1[0][ __________________________________________________________________________________________________ Block35_4_Branch_1_Conv2d_0b_3x (None, 17, 17, 32) 96 Block35_4_Branch_1_Conv2d_0b_3x3[ __________________________________________________________________________________________________ Block35_4_Branch_2_Conv2d_0c_3x (None, 17, 17, 32) 96 Block35_4_Branch_2_Conv2d_0c_3x3[ __________________________________________________________________________________________________ Block35_4_Branch_0_Conv2d_1x1_A (None, 17, 17, 32) 0 Block35_4_Branch_0_Conv2d_1x1_Bat __________________________________________________________________________________________________ Block35_4_Branch_1_Conv2d_0b_3x (None, 17, 17, 32) 0 Block35_4_Branch_1_Conv2d_0b_3x3_ __________________________________________________________________________________________________ Block35_4_Branch_2_Conv2d_0c_3x (None, 17, 17, 32) 0 Block35_4_Branch_2_Conv2d_0c_3x3_ __________________________________________________________________________________________________ Block35_4_Concatenate (Concaten (None, 17, 17, 96) 0 Block35_4_Branch_0_Conv2d_1x1_Act Block35_4_Branch_1_Conv2d_0b_3x3_ Block35_4_Branch_2_Conv2d_0c_3x3_ __________________________________________________________________________________________________ Block35_4_Conv2d_1x1 (Conv2D) (None, 17, 17, 256) 24832 Block35_4_Concatenate[0][0] __________________________________________________________________________________________________ Block35_4_ScaleSum (Lambda) (None, 17, 17, 256) 0 Block35_3_Activation[0][0] Block35_4_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block35_4_Activation (Activatio (None, 17, 17, 256) 0 Block35_4_ScaleSum[0][0] __________________________________________________________________________________________________ Block35_5_Branch_2_Conv2d_0a_1x (None, 17, 17, 32) 8192 Block35_4_Activation[0][0] __________________________________________________________________________________________________ Block35_5_Branch_2_Conv2d_0a_1x (None, 17, 17, 32) 96 Block35_5_Branch_2_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block35_5_Branch_2_Conv2d_0a_1x (None, 17, 17, 32) 0 Block35_5_Branch_2_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_5_Branch_1_Conv2d_0a_1x (None, 17, 17, 32) 8192 Block35_4_Activation[0][0] __________________________________________________________________________________________________ Block35_5_Branch_2_Conv2d_0b_3x (None, 17, 17, 32) 9216 Block35_5_Branch_2_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_5_Branch_1_Conv2d_0a_1x (None, 17, 17, 32) 96 Block35_5_Branch_1_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block35_5_Branch_2_Conv2d_0b_3x (None, 17, 17, 32) 96 Block35_5_Branch_2_Conv2d_0b_3x3[ __________________________________________________________________________________________________ Block35_5_Branch_1_Conv2d_0a_1x (None, 17, 17, 32) 0 Block35_5_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_5_Branch_2_Conv2d_0b_3x (None, 17, 17, 32) 0 Block35_5_Branch_2_Conv2d_0b_3x3_ __________________________________________________________________________________________________ Block35_5_Branch_0_Conv2d_1x1 ( (None, 17, 17, 32) 8192 Block35_4_Activation[0][0] __________________________________________________________________________________________________ Block35_5_Branch_1_Conv2d_0b_3x (None, 17, 17, 32) 9216 Block35_5_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block35_5_Branch_2_Conv2d_0c_3x (None, 17, 17, 32) 9216 Block35_5_Branch_2_Conv2d_0b_3x3_ __________________________________________________________________________________________________ Block35_5_Branch_0_Conv2d_1x1_B (None, 17, 17, 32) 96 Block35_5_Branch_0_Conv2d_1x1[0][ __________________________________________________________________________________________________ Block35_5_Branch_1_Conv2d_0b_3x (None, 17, 17, 32) 96 Block35_5_Branch_1_Conv2d_0b_3x3[ __________________________________________________________________________________________________ Block35_5_Branch_2_Conv2d_0c_3x (None, 17, 17, 32) 96 Block35_5_Branch_2_Conv2d_0c_3x3[ __________________________________________________________________________________________________ Block35_5_Branch_0_Conv2d_1x1_A (None, 17, 17, 32) 0 Block35_5_Branch_0_Conv2d_1x1_Bat __________________________________________________________________________________________________ Block35_5_Branch_1_Conv2d_0b_3x (None, 17, 17, 32) 0 Block35_5_Branch_1_Conv2d_0b_3x3_ __________________________________________________________________________________________________ Block35_5_Branch_2_Conv2d_0c_3x (None, 17, 17, 32) 0 Block35_5_Branch_2_Conv2d_0c_3x3_ __________________________________________________________________________________________________ Block35_5_Concatenate (Concaten (None, 17, 17, 96) 0 Block35_5_Branch_0_Conv2d_1x1_Act Block35_5_Branch_1_Conv2d_0b_3x3_ Block35_5_Branch_2_Conv2d_0c_3x3_ __________________________________________________________________________________________________ Block35_5_Conv2d_1x1 (Conv2D) (None, 17, 17, 256) 24832 Block35_5_Concatenate[0][0] __________________________________________________________________________________________________ Block35_5_ScaleSum (Lambda) (None, 17, 17, 256) 0 Block35_4_Activation[0][0] Block35_5_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block35_5_Activation (Activatio (None, 17, 17, 256) 0 Block35_5_ScaleSum[0][0] __________________________________________________________________________________________________ Mixed_6a_Branch_1_Conv2d_0a_1x1 (None, 17, 17, 192) 49152 Block35_5_Activation[0][0] __________________________________________________________________________________________________ Mixed_6a_Branch_1_Conv2d_0a_1x1 (None, 17, 17, 192) 576 Mixed_6a_Branch_1_Conv2d_0a_1x1[0 __________________________________________________________________________________________________ Mixed_6a_Branch_1_Conv2d_0a_1x1 (None, 17, 17, 192) 0 Mixed_6a_Branch_1_Conv2d_0a_1x1_B __________________________________________________________________________________________________ Mixed_6a_Branch_1_Conv2d_0b_3x3 (None, 17, 17, 192) 331776 Mixed_6a_Branch_1_Conv2d_0a_1x1_A __________________________________________________________________________________________________ Mixed_6a_Branch_1_Conv2d_0b_3x3 (None, 17, 17, 192) 576 Mixed_6a_Branch_1_Conv2d_0b_3x3[0 __________________________________________________________________________________________________ Mixed_6a_Branch_1_Conv2d_0b_3x3 (None, 17, 17, 192) 0 Mixed_6a_Branch_1_Conv2d_0b_3x3_B __________________________________________________________________________________________________ Mixed_6a_Branch_0_Conv2d_1a_3x3 (None, 8, 8, 384) 884736 Block35_5_Activation[0][0] __________________________________________________________________________________________________ Mixed_6a_Branch_1_Conv2d_1a_3x3 (None, 8, 8, 256) 442368 Mixed_6a_Branch_1_Conv2d_0b_3x3_A __________________________________________________________________________________________________ Mixed_6a_Branch_0_Conv2d_1a_3x3 (None, 8, 8, 384) 1152 Mixed_6a_Branch_0_Conv2d_1a_3x3[0 __________________________________________________________________________________________________ Mixed_6a_Branch_1_Conv2d_1a_3x3 (None, 8, 8, 256) 768 Mixed_6a_Branch_1_Conv2d_1a_3x3[0 __________________________________________________________________________________________________ Mixed_6a_Branch_0_Conv2d_1a_3x3 (None, 8, 8, 384) 0 Mixed_6a_Branch_0_Conv2d_1a_3x3_B __________________________________________________________________________________________________ Mixed_6a_Branch_1_Conv2d_1a_3x3 (None, 8, 8, 256) 0 Mixed_6a_Branch_1_Conv2d_1a_3x3_B __________________________________________________________________________________________________ Mixed_6a_Branch_2_MaxPool_1a_3x (None, 8, 8, 256) 0 Block35_5_Activation[0][0] __________________________________________________________________________________________________ Mixed_6a (Concatenate) (None, 8, 8, 896) 0 Mixed_6a_Branch_0_Conv2d_1a_3x3_A Mixed_6a_Branch_1_Conv2d_1a_3x3_A Mixed_6a_Branch_2_MaxPool_1a_3x3[ __________________________________________________________________________________________________ Block17_1_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 114688 Mixed_6a[0][0] __________________________________________________________________________________________________ Block17_1_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 384 Block17_1_Branch_1_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block17_1_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 0 Block17_1_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block17_1_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 114688 Block17_1_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block17_1_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 384 Block17_1_Branch_1_Conv2d_0b_1x7[ __________________________________________________________________________________________________ Block17_1_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 0 Block17_1_Branch_1_Conv2d_0b_1x7_ __________________________________________________________________________________________________ Block17_1_Branch_0_Conv2d_1x1 ( (None, 8, 8, 128) 114688 Mixed_6a[0][0] __________________________________________________________________________________________________ Block17_1_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 114688 Block17_1_Branch_1_Conv2d_0b_1x7_ __________________________________________________________________________________________________ Block17_1_Branch_0_Conv2d_1x1_B (None, 8, 8, 128) 384 Block17_1_Branch_0_Conv2d_1x1[0][ __________________________________________________________________________________________________ Block17_1_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 384 Block17_1_Branch_1_Conv2d_0c_7x1[ __________________________________________________________________________________________________ Block17_1_Branch_0_Conv2d_1x1_A (None, 8, 8, 128) 0 Block17_1_Branch_0_Conv2d_1x1_Bat __________________________________________________________________________________________________ Block17_1_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 0 Block17_1_Branch_1_Conv2d_0c_7x1_ __________________________________________________________________________________________________ Block17_1_Concatenate (Concaten (None, 8, 8, 256) 0 Block17_1_Branch_0_Conv2d_1x1_Act Block17_1_Branch_1_Conv2d_0c_7x1_ __________________________________________________________________________________________________ Block17_1_Conv2d_1x1 (Conv2D) (None, 8, 8, 896) 230272 Block17_1_Concatenate[0][0] __________________________________________________________________________________________________ Block17_1_ScaleSum (Lambda) (None, 8, 8, 896) 0 Mixed_6a[0][0] Block17_1_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block17_1_Activation (Activatio (None, 8, 8, 896) 0 Block17_1_ScaleSum[0][0] __________________________________________________________________________________________________ Block17_2_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 114688 Block17_1_Activation[0][0] __________________________________________________________________________________________________ Block17_2_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 384 Block17_2_Branch_1_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block17_2_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 0 Block17_2_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block17_2_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 114688 Block17_2_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block17_2_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 384 Block17_2_Branch_1_Conv2d_0b_1x7[ __________________________________________________________________________________________________ Block17_2_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 0 Block17_2_Branch_1_Conv2d_0b_1x7_ __________________________________________________________________________________________________ Block17_2_Branch_0_Conv2d_1x1 ( (None, 8, 8, 128) 114688 Block17_1_Activation[0][0] __________________________________________________________________________________________________ Block17_2_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 114688 Block17_2_Branch_1_Conv2d_0b_1x7_ __________________________________________________________________________________________________ Block17_2_Branch_0_Conv2d_1x1_B (None, 8, 8, 128) 384 Block17_2_Branch_0_Conv2d_1x1[0][ __________________________________________________________________________________________________ Block17_2_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 384 Block17_2_Branch_1_Conv2d_0c_7x1[ __________________________________________________________________________________________________ Block17_2_Branch_0_Conv2d_1x1_A (None, 8, 8, 128) 0 Block17_2_Branch_0_Conv2d_1x1_Bat __________________________________________________________________________________________________ Block17_2_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 0 Block17_2_Branch_1_Conv2d_0c_7x1_ __________________________________________________________________________________________________ Block17_2_Concatenate (Concaten (None, 8, 8, 256) 0 Block17_2_Branch_0_Conv2d_1x1_Act Block17_2_Branch_1_Conv2d_0c_7x1_ __________________________________________________________________________________________________ Block17_2_Conv2d_1x1 (Conv2D) (None, 8, 8, 896) 230272 Block17_2_Concatenate[0][0] __________________________________________________________________________________________________ Block17_2_ScaleSum (Lambda) (None, 8, 8, 896) 0 Block17_1_Activation[0][0] Block17_2_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block17_2_Activation (Activatio (None, 8, 8, 896) 0 Block17_2_ScaleSum[0][0] __________________________________________________________________________________________________ Block17_3_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 114688 Block17_2_Activation[0][0] __________________________________________________________________________________________________ Block17_3_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 384 Block17_3_Branch_1_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block17_3_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 0 Block17_3_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block17_3_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 114688 Block17_3_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block17_3_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 384 Block17_3_Branch_1_Conv2d_0b_1x7[ __________________________________________________________________________________________________ Block17_3_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 0 Block17_3_Branch_1_Conv2d_0b_1x7_ __________________________________________________________________________________________________ Block17_3_Branch_0_Conv2d_1x1 ( (None, 8, 8, 128) 114688 Block17_2_Activation[0][0] __________________________________________________________________________________________________ Block17_3_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 114688 Block17_3_Branch_1_Conv2d_0b_1x7_ __________________________________________________________________________________________________ Block17_3_Branch_0_Conv2d_1x1_B (None, 8, 8, 128) 384 Block17_3_Branch_0_Conv2d_1x1[0][ __________________________________________________________________________________________________ Block17_3_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 384 Block17_3_Branch_1_Conv2d_0c_7x1[ __________________________________________________________________________________________________ Block17_3_Branch_0_Conv2d_1x1_A (None, 8, 8, 128) 0 Block17_3_Branch_0_Conv2d_1x1_Bat __________________________________________________________________________________________________ Block17_3_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 0 Block17_3_Branch_1_Conv2d_0c_7x1_ __________________________________________________________________________________________________ Block17_3_Concatenate (Concaten (None, 8, 8, 256) 0 Block17_3_Branch_0_Conv2d_1x1_Act Block17_3_Branch_1_Conv2d_0c_7x1_ __________________________________________________________________________________________________ Block17_3_Conv2d_1x1 (Conv2D) (None, 8, 8, 896) 230272 Block17_3_Concatenate[0][0] __________________________________________________________________________________________________ Block17_3_ScaleSum (Lambda) (None, 8, 8, 896) 0 Block17_2_Activation[0][0] Block17_3_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block17_3_Activation (Activatio (None, 8, 8, 896) 0 Block17_3_ScaleSum[0][0] __________________________________________________________________________________________________ Block17_4_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 114688 Block17_3_Activation[0][0] __________________________________________________________________________________________________ Block17_4_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 384 Block17_4_Branch_1_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block17_4_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 0 Block17_4_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block17_4_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 114688 Block17_4_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block17_4_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 384 Block17_4_Branch_1_Conv2d_0b_1x7[ __________________________________________________________________________________________________ Block17_4_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 0 Block17_4_Branch_1_Conv2d_0b_1x7_ __________________________________________________________________________________________________ Block17_4_Branch_0_Conv2d_1x1 ( (None, 8, 8, 128) 114688 Block17_3_Activation[0][0] __________________________________________________________________________________________________ Block17_4_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 114688 Block17_4_Branch_1_Conv2d_0b_1x7_ __________________________________________________________________________________________________ Block17_4_Branch_0_Conv2d_1x1_B (None, 8, 8, 128) 384 Block17_4_Branch_0_Conv2d_1x1[0][ __________________________________________________________________________________________________ Block17_4_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 384 Block17_4_Branch_1_Conv2d_0c_7x1[ __________________________________________________________________________________________________ Block17_4_Branch_0_Conv2d_1x1_A (None, 8, 8, 128) 0 Block17_4_Branch_0_Conv2d_1x1_Bat __________________________________________________________________________________________________ Block17_4_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 0 Block17_4_Branch_1_Conv2d_0c_7x1_ __________________________________________________________________________________________________ Block17_4_Concatenate (Concaten (None, 8, 8, 256) 0 Block17_4_Branch_0_Conv2d_1x1_Act Block17_4_Branch_1_Conv2d_0c_7x1_ __________________________________________________________________________________________________ Block17_4_Conv2d_1x1 (Conv2D) (None, 8, 8, 896) 230272 Block17_4_Concatenate[0][0] __________________________________________________________________________________________________ Block17_4_ScaleSum (Lambda) (None, 8, 8, 896) 0 Block17_3_Activation[0][0] Block17_4_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block17_4_Activation (Activatio (None, 8, 8, 896) 0 Block17_4_ScaleSum[0][0] __________________________________________________________________________________________________ Block17_5_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 114688 Block17_4_Activation[0][0] __________________________________________________________________________________________________ Block17_5_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 384 Block17_5_Branch_1_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block17_5_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 0 Block17_5_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block17_5_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 114688 Block17_5_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block17_5_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 384 Block17_5_Branch_1_Conv2d_0b_1x7[ __________________________________________________________________________________________________ Block17_5_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 0 Block17_5_Branch_1_Conv2d_0b_1x7_ __________________________________________________________________________________________________ Block17_5_Branch_0_Conv2d_1x1 ( (None, 8, 8, 128) 114688 Block17_4_Activation[0][0] __________________________________________________________________________________________________ Block17_5_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 114688 Block17_5_Branch_1_Conv2d_0b_1x7_ __________________________________________________________________________________________________ Block17_5_Branch_0_Conv2d_1x1_B (None, 8, 8, 128) 384 Block17_5_Branch_0_Conv2d_1x1[0][ __________________________________________________________________________________________________ Block17_5_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 384 Block17_5_Branch_1_Conv2d_0c_7x1[ __________________________________________________________________________________________________ Block17_5_Branch_0_Conv2d_1x1_A (None, 8, 8, 128) 0 Block17_5_Branch_0_Conv2d_1x1_Bat __________________________________________________________________________________________________ Block17_5_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 0 Block17_5_Branch_1_Conv2d_0c_7x1_ __________________________________________________________________________________________________ Block17_5_Concatenate (Concaten (None, 8, 8, 256) 0 Block17_5_Branch_0_Conv2d_1x1_Act Block17_5_Branch_1_Conv2d_0c_7x1_ __________________________________________________________________________________________________ Block17_5_Conv2d_1x1 (Conv2D) (None, 8, 8, 896) 230272 Block17_5_Concatenate[0][0] __________________________________________________________________________________________________ Block17_5_ScaleSum (Lambda) (None, 8, 8, 896) 0 Block17_4_Activation[0][0] Block17_5_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block17_5_Activation (Activatio (None, 8, 8, 896) 0 Block17_5_ScaleSum[0][0] __________________________________________________________________________________________________ Block17_6_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 114688 Block17_5_Activation[0][0] __________________________________________________________________________________________________ Block17_6_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 384 Block17_6_Branch_1_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block17_6_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 0 Block17_6_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block17_6_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 114688 Block17_6_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block17_6_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 384 Block17_6_Branch_1_Conv2d_0b_1x7[ __________________________________________________________________________________________________ Block17_6_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 0 Block17_6_Branch_1_Conv2d_0b_1x7_ __________________________________________________________________________________________________ Block17_6_Branch_0_Conv2d_1x1 ( (None, 8, 8, 128) 114688 Block17_5_Activation[0][0] __________________________________________________________________________________________________ Block17_6_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 114688 Block17_6_Branch_1_Conv2d_0b_1x7_ __________________________________________________________________________________________________ Block17_6_Branch_0_Conv2d_1x1_B (None, 8, 8, 128) 384 Block17_6_Branch_0_Conv2d_1x1[0][ __________________________________________________________________________________________________ Block17_6_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 384 Block17_6_Branch_1_Conv2d_0c_7x1[ __________________________________________________________________________________________________ Block17_6_Branch_0_Conv2d_1x1_A (None, 8, 8, 128) 0 Block17_6_Branch_0_Conv2d_1x1_Bat __________________________________________________________________________________________________ Block17_6_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 0 Block17_6_Branch_1_Conv2d_0c_7x1_ __________________________________________________________________________________________________ Block17_6_Concatenate (Concaten (None, 8, 8, 256) 0 Block17_6_Branch_0_Conv2d_1x1_Act Block17_6_Branch_1_Conv2d_0c_7x1_ __________________________________________________________________________________________________ Block17_6_Conv2d_1x1 (Conv2D) (None, 8, 8, 896) 230272 Block17_6_Concatenate[0][0] __________________________________________________________________________________________________ Block17_6_ScaleSum (Lambda) (None, 8, 8, 896) 0 Block17_5_Activation[0][0] Block17_6_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block17_6_Activation (Activatio (None, 8, 8, 896) 0 Block17_6_ScaleSum[0][0] __________________________________________________________________________________________________ Block17_7_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 114688 Block17_6_Activation[0][0] __________________________________________________________________________________________________ Block17_7_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 384 Block17_7_Branch_1_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block17_7_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 0 Block17_7_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block17_7_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 114688 Block17_7_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block17_7_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 384 Block17_7_Branch_1_Conv2d_0b_1x7[ __________________________________________________________________________________________________ Block17_7_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 0 Block17_7_Branch_1_Conv2d_0b_1x7_ __________________________________________________________________________________________________ Block17_7_Branch_0_Conv2d_1x1 ( (None, 8, 8, 128) 114688 Block17_6_Activation[0][0] __________________________________________________________________________________________________ Block17_7_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 114688 Block17_7_Branch_1_Conv2d_0b_1x7_ __________________________________________________________________________________________________ Block17_7_Branch_0_Conv2d_1x1_B (None, 8, 8, 128) 384 Block17_7_Branch_0_Conv2d_1x1[0][ __________________________________________________________________________________________________ Block17_7_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 384 Block17_7_Branch_1_Conv2d_0c_7x1[ __________________________________________________________________________________________________ Block17_7_Branch_0_Conv2d_1x1_A (None, 8, 8, 128) 0 Block17_7_Branch_0_Conv2d_1x1_Bat __________________________________________________________________________________________________ Block17_7_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 0 Block17_7_Branch_1_Conv2d_0c_7x1_ __________________________________________________________________________________________________ Block17_7_Concatenate (Concaten (None, 8, 8, 256) 0 Block17_7_Branch_0_Conv2d_1x1_Act Block17_7_Branch_1_Conv2d_0c_7x1_ __________________________________________________________________________________________________ Block17_7_Conv2d_1x1 (Conv2D) (None, 8, 8, 896) 230272 Block17_7_Concatenate[0][0] __________________________________________________________________________________________________ Block17_7_ScaleSum (Lambda) (None, 8, 8, 896) 0 Block17_6_Activation[0][0] Block17_7_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block17_7_Activation (Activatio (None, 8, 8, 896) 0 Block17_7_ScaleSum[0][0] __________________________________________________________________________________________________ Block17_8_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 114688 Block17_7_Activation[0][0] __________________________________________________________________________________________________ Block17_8_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 384 Block17_8_Branch_1_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block17_8_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 0 Block17_8_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block17_8_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 114688 Block17_8_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block17_8_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 384 Block17_8_Branch_1_Conv2d_0b_1x7[ __________________________________________________________________________________________________ Block17_8_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 0 Block17_8_Branch_1_Conv2d_0b_1x7_ __________________________________________________________________________________________________ Block17_8_Branch_0_Conv2d_1x1 ( (None, 8, 8, 128) 114688 Block17_7_Activation[0][0] __________________________________________________________________________________________________ Block17_8_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 114688 Block17_8_Branch_1_Conv2d_0b_1x7_ __________________________________________________________________________________________________ Block17_8_Branch_0_Conv2d_1x1_B (None, 8, 8, 128) 384 Block17_8_Branch_0_Conv2d_1x1[0][ __________________________________________________________________________________________________ Block17_8_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 384 Block17_8_Branch_1_Conv2d_0c_7x1[ __________________________________________________________________________________________________ Block17_8_Branch_0_Conv2d_1x1_A (None, 8, 8, 128) 0 Block17_8_Branch_0_Conv2d_1x1_Bat __________________________________________________________________________________________________ Block17_8_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 0 Block17_8_Branch_1_Conv2d_0c_7x1_ __________________________________________________________________________________________________ Block17_8_Concatenate (Concaten (None, 8, 8, 256) 0 Block17_8_Branch_0_Conv2d_1x1_Act Block17_8_Branch_1_Conv2d_0c_7x1_ __________________________________________________________________________________________________ Block17_8_Conv2d_1x1 (Conv2D) (None, 8, 8, 896) 230272 Block17_8_Concatenate[0][0] __________________________________________________________________________________________________ Block17_8_ScaleSum (Lambda) (None, 8, 8, 896) 0 Block17_7_Activation[0][0] Block17_8_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block17_8_Activation (Activatio (None, 8, 8, 896) 0 Block17_8_ScaleSum[0][0] __________________________________________________________________________________________________ Block17_9_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 114688 Block17_8_Activation[0][0] __________________________________________________________________________________________________ Block17_9_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 384 Block17_9_Branch_1_Conv2d_0a_1x1[ __________________________________________________________________________________________________ Block17_9_Branch_1_Conv2d_0a_1x (None, 8, 8, 128) 0 Block17_9_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block17_9_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 114688 Block17_9_Branch_1_Conv2d_0a_1x1_ __________________________________________________________________________________________________ Block17_9_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 384 Block17_9_Branch_1_Conv2d_0b_1x7[ __________________________________________________________________________________________________ Block17_9_Branch_1_Conv2d_0b_1x (None, 8, 8, 128) 0 Block17_9_Branch_1_Conv2d_0b_1x7_ __________________________________________________________________________________________________ Block17_9_Branch_0_Conv2d_1x1 ( (None, 8, 8, 128) 114688 Block17_8_Activation[0][0] __________________________________________________________________________________________________ Block17_9_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 114688 Block17_9_Branch_1_Conv2d_0b_1x7_ __________________________________________________________________________________________________ Block17_9_Branch_0_Conv2d_1x1_B (None, 8, 8, 128) 384 Block17_9_Branch_0_Conv2d_1x1[0][ __________________________________________________________________________________________________ Block17_9_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 384 Block17_9_Branch_1_Conv2d_0c_7x1[ __________________________________________________________________________________________________ Block17_9_Branch_0_Conv2d_1x1_A (None, 8, 8, 128) 0 Block17_9_Branch_0_Conv2d_1x1_Bat __________________________________________________________________________________________________ Block17_9_Branch_1_Conv2d_0c_7x (None, 8, 8, 128) 0 Block17_9_Branch_1_Conv2d_0c_7x1_ __________________________________________________________________________________________________ Block17_9_Concatenate (Concaten (None, 8, 8, 256) 0 Block17_9_Branch_0_Conv2d_1x1_Act Block17_9_Branch_1_Conv2d_0c_7x1_ __________________________________________________________________________________________________ Block17_9_Conv2d_1x1 (Conv2D) (None, 8, 8, 896) 230272 Block17_9_Concatenate[0][0] __________________________________________________________________________________________________ Block17_9_ScaleSum (Lambda) (None, 8, 8, 896) 0 Block17_8_Activation[0][0] Block17_9_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block17_9_Activation (Activatio (None, 8, 8, 896) 0 Block17_9_ScaleSum[0][0] __________________________________________________________________________________________________ Block17_10_Branch_1_Conv2d_0a_1 (None, 8, 8, 128) 114688 Block17_9_Activation[0][0] __________________________________________________________________________________________________ Block17_10_Branch_1_Conv2d_0a_1 (None, 8, 8, 128) 384 Block17_10_Branch_1_Conv2d_0a_1x1 __________________________________________________________________________________________________ Block17_10_Branch_1_Conv2d_0a_1 (None, 8, 8, 128) 0 Block17_10_Branch_1_Conv2d_0a_1x1 __________________________________________________________________________________________________ Block17_10_Branch_1_Conv2d_0b_1 (None, 8, 8, 128) 114688 Block17_10_Branch_1_Conv2d_0a_1x1 __________________________________________________________________________________________________ Block17_10_Branch_1_Conv2d_0b_1 (None, 8, 8, 128) 384 Block17_10_Branch_1_Conv2d_0b_1x7 __________________________________________________________________________________________________ Block17_10_Branch_1_Conv2d_0b_1 (None, 8, 8, 128) 0 Block17_10_Branch_1_Conv2d_0b_1x7 __________________________________________________________________________________________________ Block17_10_Branch_0_Conv2d_1x1 (None, 8, 8, 128) 114688 Block17_9_Activation[0][0] __________________________________________________________________________________________________ Block17_10_Branch_1_Conv2d_0c_7 (None, 8, 8, 128) 114688 Block17_10_Branch_1_Conv2d_0b_1x7 __________________________________________________________________________________________________ Block17_10_Branch_0_Conv2d_1x1_ (None, 8, 8, 128) 384 Block17_10_Branch_0_Conv2d_1x1[0] __________________________________________________________________________________________________ Block17_10_Branch_1_Conv2d_0c_7 (None, 8, 8, 128) 384 Block17_10_Branch_1_Conv2d_0c_7x1 __________________________________________________________________________________________________ Block17_10_Branch_0_Conv2d_1x1_ (None, 8, 8, 128) 0 Block17_10_Branch_0_Conv2d_1x1_Ba __________________________________________________________________________________________________ Block17_10_Branch_1_Conv2d_0c_7 (None, 8, 8, 128) 0 Block17_10_Branch_1_Conv2d_0c_7x1 __________________________________________________________________________________________________ Block17_10_Concatenate (Concate (None, 8, 8, 256) 0 Block17_10_Branch_0_Conv2d_1x1_Ac Block17_10_Branch_1_Conv2d_0c_7x1 __________________________________________________________________________________________________ Block17_10_Conv2d_1x1 (Conv2D) (None, 8, 8, 896) 230272 Block17_10_Concatenate[0][0] __________________________________________________________________________________________________ Block17_10_ScaleSum (Lambda) (None, 8, 8, 896) 0 Block17_9_Activation[0][0] Block17_10_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block17_10_Activation (Activati (None, 8, 8, 896) 0 Block17_10_ScaleSum[0][0] __________________________________________________________________________________________________ Mixed_7a_Branch_2_Conv2d_0a_1x1 (None, 8, 8, 256) 229376 Block17_10_Activation[0][0] __________________________________________________________________________________________________ Mixed_7a_Branch_2_Conv2d_0a_1x1 (None, 8, 8, 256) 768 Mixed_7a_Branch_2_Conv2d_0a_1x1[0 __________________________________________________________________________________________________ Mixed_7a_Branch_2_Conv2d_0a_1x1 (None, 8, 8, 256) 0 Mixed_7a_Branch_2_Conv2d_0a_1x1_B __________________________________________________________________________________________________ Mixed_7a_Branch_0_Conv2d_0a_1x1 (None, 8, 8, 256) 229376 Block17_10_Activation[0][0] __________________________________________________________________________________________________ Mixed_7a_Branch_1_Conv2d_0a_1x1 (None, 8, 8, 256) 229376 Block17_10_Activation[0][0] __________________________________________________________________________________________________ Mixed_7a_Branch_2_Conv2d_0b_3x3 (None, 8, 8, 256) 589824 Mixed_7a_Branch_2_Conv2d_0a_1x1_A __________________________________________________________________________________________________ Mixed_7a_Branch_0_Conv2d_0a_1x1 (None, 8, 8, 256) 768 Mixed_7a_Branch_0_Conv2d_0a_1x1[0 __________________________________________________________________________________________________ Mixed_7a_Branch_1_Conv2d_0a_1x1 (None, 8, 8, 256) 768 Mixed_7a_Branch_1_Conv2d_0a_1x1[0 __________________________________________________________________________________________________ Mixed_7a_Branch_2_Conv2d_0b_3x3 (None, 8, 8, 256) 768 Mixed_7a_Branch_2_Conv2d_0b_3x3[0 __________________________________________________________________________________________________ Mixed_7a_Branch_0_Conv2d_0a_1x1 (None, 8, 8, 256) 0 Mixed_7a_Branch_0_Conv2d_0a_1x1_B __________________________________________________________________________________________________ Mixed_7a_Branch_1_Conv2d_0a_1x1 (None, 8, 8, 256) 0 Mixed_7a_Branch_1_Conv2d_0a_1x1_B __________________________________________________________________________________________________ Mixed_7a_Branch_2_Conv2d_0b_3x3 (None, 8, 8, 256) 0 Mixed_7a_Branch_2_Conv2d_0b_3x3_B __________________________________________________________________________________________________ Mixed_7a_Branch_0_Conv2d_1a_3x3 (None, 3, 3, 384) 884736 Mixed_7a_Branch_0_Conv2d_0a_1x1_A __________________________________________________________________________________________________ Mixed_7a_Branch_1_Conv2d_1a_3x3 (None, 3, 3, 256) 589824 Mixed_7a_Branch_1_Conv2d_0a_1x1_A __________________________________________________________________________________________________ Mixed_7a_Branch_2_Conv2d_1a_3x3 (None, 3, 3, 256) 589824 Mixed_7a_Branch_2_Conv2d_0b_3x3_A __________________________________________________________________________________________________ Mixed_7a_Branch_0_Conv2d_1a_3x3 (None, 3, 3, 384) 1152 Mixed_7a_Branch_0_Conv2d_1a_3x3[0 __________________________________________________________________________________________________ Mixed_7a_Branch_1_Conv2d_1a_3x3 (None, 3, 3, 256) 768 Mixed_7a_Branch_1_Conv2d_1a_3x3[0 __________________________________________________________________________________________________ Mixed_7a_Branch_2_Conv2d_1a_3x3 (None, 3, 3, 256) 768 Mixed_7a_Branch_2_Conv2d_1a_3x3[0 __________________________________________________________________________________________________ Mixed_7a_Branch_0_Conv2d_1a_3x3 (None, 3, 3, 384) 0 Mixed_7a_Branch_0_Conv2d_1a_3x3_B __________________________________________________________________________________________________ Mixed_7a_Branch_1_Conv2d_1a_3x3 (None, 3, 3, 256) 0 Mixed_7a_Branch_1_Conv2d_1a_3x3_B __________________________________________________________________________________________________ Mixed_7a_Branch_2_Conv2d_1a_3x3 (None, 3, 3, 256) 0 Mixed_7a_Branch_2_Conv2d_1a_3x3_B __________________________________________________________________________________________________ Mixed_7a_Branch_3_MaxPool_1a_3x (None, 3, 3, 896) 0 Block17_10_Activation[0][0] __________________________________________________________________________________________________ Mixed_7a (Concatenate) (None, 3, 3, 1792) 0 Mixed_7a_Branch_0_Conv2d_1a_3x3_A Mixed_7a_Branch_1_Conv2d_1a_3x3_A Mixed_7a_Branch_2_Conv2d_1a_3x3_A Mixed_7a_Branch_3_MaxPool_1a_3x3[ __________________________________________________________________________________________________ Block8_1_Branch_1_Conv2d_0a_1x1 (None, 3, 3, 192) 344064 Mixed_7a[0][0] __________________________________________________________________________________________________ Block8_1_Branch_1_Conv2d_0a_1x1 (None, 3, 3, 192) 576 Block8_1_Branch_1_Conv2d_0a_1x1[0 __________________________________________________________________________________________________ Block8_1_Branch_1_Conv2d_0a_1x1 (None, 3, 3, 192) 0 Block8_1_Branch_1_Conv2d_0a_1x1_B __________________________________________________________________________________________________ Block8_1_Branch_1_Conv2d_0b_1x3 (None, 3, 3, 192) 110592 Block8_1_Branch_1_Conv2d_0a_1x1_A __________________________________________________________________________________________________ Block8_1_Branch_1_Conv2d_0b_1x3 (None, 3, 3, 192) 576 Block8_1_Branch_1_Conv2d_0b_1x3[0 __________________________________________________________________________________________________ Block8_1_Branch_1_Conv2d_0b_1x3 (None, 3, 3, 192) 0 Block8_1_Branch_1_Conv2d_0b_1x3_B __________________________________________________________________________________________________ Block8_1_Branch_0_Conv2d_1x1 (C (None, 3, 3, 192) 344064 Mixed_7a[0][0] __________________________________________________________________________________________________ Block8_1_Branch_1_Conv2d_0c_3x1 (None, 3, 3, 192) 110592 Block8_1_Branch_1_Conv2d_0b_1x3_A __________________________________________________________________________________________________ Block8_1_Branch_0_Conv2d_1x1_Ba (None, 3, 3, 192) 576 Block8_1_Branch_0_Conv2d_1x1[0][0 __________________________________________________________________________________________________ Block8_1_Branch_1_Conv2d_0c_3x1 (None, 3, 3, 192) 576 Block8_1_Branch_1_Conv2d_0c_3x1[0 __________________________________________________________________________________________________ Block8_1_Branch_0_Conv2d_1x1_Ac (None, 3, 3, 192) 0 Block8_1_Branch_0_Conv2d_1x1_Batc __________________________________________________________________________________________________ Block8_1_Branch_1_Conv2d_0c_3x1 (None, 3, 3, 192) 0 Block8_1_Branch_1_Conv2d_0c_3x1_B __________________________________________________________________________________________________ Block8_1_Concatenate (Concatena (None, 3, 3, 384) 0 Block8_1_Branch_0_Conv2d_1x1_Acti Block8_1_Branch_1_Conv2d_0c_3x1_A __________________________________________________________________________________________________ Block8_1_Conv2d_1x1 (Conv2D) (None, 3, 3, 1792) 689920 Block8_1_Concatenate[0][0] __________________________________________________________________________________________________ Block8_1_ScaleSum (Lambda) (None, 3, 3, 1792) 0 Mixed_7a[0][0] Block8_1_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block8_1_Activation (Activation (None, 3, 3, 1792) 0 Block8_1_ScaleSum[0][0] __________________________________________________________________________________________________ Block8_2_Branch_1_Conv2d_0a_1x1 (None, 3, 3, 192) 344064 Block8_1_Activation[0][0] __________________________________________________________________________________________________ Block8_2_Branch_1_Conv2d_0a_1x1 (None, 3, 3, 192) 576 Block8_2_Branch_1_Conv2d_0a_1x1[0 __________________________________________________________________________________________________ Block8_2_Branch_1_Conv2d_0a_1x1 (None, 3, 3, 192) 0 Block8_2_Branch_1_Conv2d_0a_1x1_B __________________________________________________________________________________________________ Block8_2_Branch_1_Conv2d_0b_1x3 (None, 3, 3, 192) 110592 Block8_2_Branch_1_Conv2d_0a_1x1_A __________________________________________________________________________________________________ Block8_2_Branch_1_Conv2d_0b_1x3 (None, 3, 3, 192) 576 Block8_2_Branch_1_Conv2d_0b_1x3[0 __________________________________________________________________________________________________ Block8_2_Branch_1_Conv2d_0b_1x3 (None, 3, 3, 192) 0 Block8_2_Branch_1_Conv2d_0b_1x3_B __________________________________________________________________________________________________ Block8_2_Branch_0_Conv2d_1x1 (C (None, 3, 3, 192) 344064 Block8_1_Activation[0][0] __________________________________________________________________________________________________ Block8_2_Branch_1_Conv2d_0c_3x1 (None, 3, 3, 192) 110592 Block8_2_Branch_1_Conv2d_0b_1x3_A __________________________________________________________________________________________________ Block8_2_Branch_0_Conv2d_1x1_Ba (None, 3, 3, 192) 576 Block8_2_Branch_0_Conv2d_1x1[0][0 __________________________________________________________________________________________________ Block8_2_Branch_1_Conv2d_0c_3x1 (None, 3, 3, 192) 576 Block8_2_Branch_1_Conv2d_0c_3x1[0 __________________________________________________________________________________________________ Block8_2_Branch_0_Conv2d_1x1_Ac (None, 3, 3, 192) 0 Block8_2_Branch_0_Conv2d_1x1_Batc __________________________________________________________________________________________________ Block8_2_Branch_1_Conv2d_0c_3x1 (None, 3, 3, 192) 0 Block8_2_Branch_1_Conv2d_0c_3x1_B __________________________________________________________________________________________________ Block8_2_Concatenate (Concatena (None, 3, 3, 384) 0 Block8_2_Branch_0_Conv2d_1x1_Acti Block8_2_Branch_1_Conv2d_0c_3x1_A __________________________________________________________________________________________________ Block8_2_Conv2d_1x1 (Conv2D) (None, 3, 3, 1792) 689920 Block8_2_Concatenate[0][0] __________________________________________________________________________________________________ Block8_2_ScaleSum (Lambda) (None, 3, 3, 1792) 0 Block8_1_Activation[0][0] Block8_2_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block8_2_Activation (Activation (None, 3, 3, 1792) 0 Block8_2_ScaleSum[0][0] __________________________________________________________________________________________________ Block8_3_Branch_1_Conv2d_0a_1x1 (None, 3, 3, 192) 344064 Block8_2_Activation[0][0] __________________________________________________________________________________________________ Block8_3_Branch_1_Conv2d_0a_1x1 (None, 3, 3, 192) 576 Block8_3_Branch_1_Conv2d_0a_1x1[0 __________________________________________________________________________________________________ Block8_3_Branch_1_Conv2d_0a_1x1 (None, 3, 3, 192) 0 Block8_3_Branch_1_Conv2d_0a_1x1_B __________________________________________________________________________________________________ Block8_3_Branch_1_Conv2d_0b_1x3 (None, 3, 3, 192) 110592 Block8_3_Branch_1_Conv2d_0a_1x1_A __________________________________________________________________________________________________ Block8_3_Branch_1_Conv2d_0b_1x3 (None, 3, 3, 192) 576 Block8_3_Branch_1_Conv2d_0b_1x3[0 __________________________________________________________________________________________________ Block8_3_Branch_1_Conv2d_0b_1x3 (None, 3, 3, 192) 0 Block8_3_Branch_1_Conv2d_0b_1x3_B __________________________________________________________________________________________________ Block8_3_Branch_0_Conv2d_1x1 (C (None, 3, 3, 192) 344064 Block8_2_Activation[0][0] __________________________________________________________________________________________________ Block8_3_Branch_1_Conv2d_0c_3x1 (None, 3, 3, 192) 110592 Block8_3_Branch_1_Conv2d_0b_1x3_A __________________________________________________________________________________________________ Block8_3_Branch_0_Conv2d_1x1_Ba (None, 3, 3, 192) 576 Block8_3_Branch_0_Conv2d_1x1[0][0 __________________________________________________________________________________________________ Block8_3_Branch_1_Conv2d_0c_3x1 (None, 3, 3, 192) 576 Block8_3_Branch_1_Conv2d_0c_3x1[0 __________________________________________________________________________________________________ Block8_3_Branch_0_Conv2d_1x1_Ac (None, 3, 3, 192) 0 Block8_3_Branch_0_Conv2d_1x1_Batc __________________________________________________________________________________________________ Block8_3_Branch_1_Conv2d_0c_3x1 (None, 3, 3, 192) 0 Block8_3_Branch_1_Conv2d_0c_3x1_B __________________________________________________________________________________________________ Block8_3_Concatenate (Concatena (None, 3, 3, 384) 0 Block8_3_Branch_0_Conv2d_1x1_Acti Block8_3_Branch_1_Conv2d_0c_3x1_A __________________________________________________________________________________________________ Block8_3_Conv2d_1x1 (Conv2D) (None, 3, 3, 1792) 689920 Block8_3_Concatenate[0][0] __________________________________________________________________________________________________ Block8_3_ScaleSum (Lambda) (None, 3, 3, 1792) 0 Block8_2_Activation[0][0] Block8_3_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block8_3_Activation (Activation (None, 3, 3, 1792) 0 Block8_3_ScaleSum[0][0] __________________________________________________________________________________________________ Block8_4_Branch_1_Conv2d_0a_1x1 (None, 3, 3, 192) 344064 Block8_3_Activation[0][0] __________________________________________________________________________________________________ Block8_4_Branch_1_Conv2d_0a_1x1 (None, 3, 3, 192) 576 Block8_4_Branch_1_Conv2d_0a_1x1[0 __________________________________________________________________________________________________ Block8_4_Branch_1_Conv2d_0a_1x1 (None, 3, 3, 192) 0 Block8_4_Branch_1_Conv2d_0a_1x1_B __________________________________________________________________________________________________ Block8_4_Branch_1_Conv2d_0b_1x3 (None, 3, 3, 192) 110592 Block8_4_Branch_1_Conv2d_0a_1x1_A __________________________________________________________________________________________________ Block8_4_Branch_1_Conv2d_0b_1x3 (None, 3, 3, 192) 576 Block8_4_Branch_1_Conv2d_0b_1x3[0 __________________________________________________________________________________________________ Block8_4_Branch_1_Conv2d_0b_1x3 (None, 3, 3, 192) 0 Block8_4_Branch_1_Conv2d_0b_1x3_B __________________________________________________________________________________________________ Block8_4_Branch_0_Conv2d_1x1 (C (None, 3, 3, 192) 344064 Block8_3_Activation[0][0] __________________________________________________________________________________________________ Block8_4_Branch_1_Conv2d_0c_3x1 (None, 3, 3, 192) 110592 Block8_4_Branch_1_Conv2d_0b_1x3_A __________________________________________________________________________________________________ Block8_4_Branch_0_Conv2d_1x1_Ba (None, 3, 3, 192) 576 Block8_4_Branch_0_Conv2d_1x1[0][0 __________________________________________________________________________________________________ Block8_4_Branch_1_Conv2d_0c_3x1 (None, 3, 3, 192) 576 Block8_4_Branch_1_Conv2d_0c_3x1[0 __________________________________________________________________________________________________ Block8_4_Branch_0_Conv2d_1x1_Ac (None, 3, 3, 192) 0 Block8_4_Branch_0_Conv2d_1x1_Batc __________________________________________________________________________________________________ Block8_4_Branch_1_Conv2d_0c_3x1 (None, 3, 3, 192) 0 Block8_4_Branch_1_Conv2d_0c_3x1_B __________________________________________________________________________________________________ Block8_4_Concatenate (Concatena (None, 3, 3, 384) 0 Block8_4_Branch_0_Conv2d_1x1_Acti Block8_4_Branch_1_Conv2d_0c_3x1_A __________________________________________________________________________________________________ Block8_4_Conv2d_1x1 (Conv2D) (None, 3, 3, 1792) 689920 Block8_4_Concatenate[0][0] __________________________________________________________________________________________________ Block8_4_ScaleSum (Lambda) (None, 3, 3, 1792) 0 Block8_3_Activation[0][0] Block8_4_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block8_4_Activation (Activation (None, 3, 3, 1792) 0 Block8_4_ScaleSum[0][0] __________________________________________________________________________________________________ Block8_5_Branch_1_Conv2d_0a_1x1 (None, 3, 3, 192) 344064 Block8_4_Activation[0][0] __________________________________________________________________________________________________ Block8_5_Branch_1_Conv2d_0a_1x1 (None, 3, 3, 192) 576 Block8_5_Branch_1_Conv2d_0a_1x1[0 __________________________________________________________________________________________________ Block8_5_Branch_1_Conv2d_0a_1x1 (None, 3, 3, 192) 0 Block8_5_Branch_1_Conv2d_0a_1x1_B __________________________________________________________________________________________________ Block8_5_Branch_1_Conv2d_0b_1x3 (None, 3, 3, 192) 110592 Block8_5_Branch_1_Conv2d_0a_1x1_A __________________________________________________________________________________________________ Block8_5_Branch_1_Conv2d_0b_1x3 (None, 3, 3, 192) 576 Block8_5_Branch_1_Conv2d_0b_1x3[0 __________________________________________________________________________________________________ Block8_5_Branch_1_Conv2d_0b_1x3 (None, 3, 3, 192) 0 Block8_5_Branch_1_Conv2d_0b_1x3_B __________________________________________________________________________________________________ Block8_5_Branch_0_Conv2d_1x1 (C (None, 3, 3, 192) 344064 Block8_4_Activation[0][0] __________________________________________________________________________________________________ Block8_5_Branch_1_Conv2d_0c_3x1 (None, 3, 3, 192) 110592 Block8_5_Branch_1_Conv2d_0b_1x3_A __________________________________________________________________________________________________ Block8_5_Branch_0_Conv2d_1x1_Ba (None, 3, 3, 192) 576 Block8_5_Branch_0_Conv2d_1x1[0][0 __________________________________________________________________________________________________ Block8_5_Branch_1_Conv2d_0c_3x1 (None, 3, 3, 192) 576 Block8_5_Branch_1_Conv2d_0c_3x1[0 __________________________________________________________________________________________________ Block8_5_Branch_0_Conv2d_1x1_Ac (None, 3, 3, 192) 0 Block8_5_Branch_0_Conv2d_1x1_Batc __________________________________________________________________________________________________ Block8_5_Branch_1_Conv2d_0c_3x1 (None, 3, 3, 192) 0 Block8_5_Branch_1_Conv2d_0c_3x1_B __________________________________________________________________________________________________ Block8_5_Concatenate (Concatena (None, 3, 3, 384) 0 Block8_5_Branch_0_Conv2d_1x1_Acti Block8_5_Branch_1_Conv2d_0c_3x1_A __________________________________________________________________________________________________ Block8_5_Conv2d_1x1 (Conv2D) (None, 3, 3, 1792) 689920 Block8_5_Concatenate[0][0] __________________________________________________________________________________________________ Block8_5_ScaleSum (Lambda) (None, 3, 3, 1792) 0 Block8_4_Activation[0][0] Block8_5_Conv2d_1x1[0][0] __________________________________________________________________________________________________ Block8_5_Activation (Activation (None, 3, 3, 1792) 0 Block8_5_ScaleSum[0][0] __________________________________________________________________________________________________ Block8_6_Branch_1_Conv2d_0a_1x1 (None, 3, 3, 192) 344064 Block8_5_Activation[0][0] __________________________________________________________________________________________________ Block8_6_Branch_1_Conv2d_0a_1x1 (None, 3, 3, 192) 576 Block8_6_Branch_1_Conv2d_0a_1x1[0 __________________________________________________________________________________________________ Block8_6_Branch_1_Conv2d_0a_1x1 (None, 3, 3, 192) 0 Block8_6_Branch_1_Conv2d_0a_1x1_B __________________________________________________________________________________________________ Block8_6_Branch_1_Conv2d_0b_1x3 (None, 3, 3, 192) 110592 Block8_6_Branch_1_Conv2d_0a_1x1_A __________________________________________________________________________________________________ Block8_6_Branch_1_Conv2d_0b_1x3 (None, 3, 3, 192) 576 Block8_6_Branch_1_Conv2d_0b_1x3[0 __________________________________________________________________________________________________ Block8_6_Branch_1_Conv2d_0b_1x3 (None, 3, 3, 192) 0 Block8_6_Branch_1_Conv2d_0b_1x3_B __________________________________________________________________________________________________ Block8_6_Branch_0_Conv2d_1x1 (C (None, 3, 3, 192) 344064 Block8_5_Activation[0][0] __________________________________________________________________________________________________ Block8_6_Branch_1_Conv2d_0c_3x1 (None, 3, 3, 192) 110592 Block8_6_Branch_1_Conv2d_0b_1x3_A __________________________________________________________________________________________________ Block8_6_Branch_0_Conv2d_1x1_Ba (None, 3, 3, 192) 576 Block8_6_Branch_0_Conv2d_1x1[0][0 __________________________________________________________________________________________________ Block8_6_Branch_1_Conv2d_0c_3x1 (None, 3, 3, 192) 576 Block8_6_Branch_1_Conv2d_0c_3x1[0 __________________________________________________________________________________________________ Block8_6_Branch_0_Conv2d_1x1_Ac (None, 3, 3, 192) 0 Block8_6_Branch_0_Conv2d_1x1_Batc __________________________________________________________________________________________________ Block8_6_Branch_1_Conv2d_0c_3x1 (None, 3, 3, 192) 0 Block8_6_Branch_1_Conv2d_0c_3x1_B __________________________________________________________________________________________________ Block8_6_Concatenate (Concatena (None, 3, 3, 384) 0 Block8_6_Branch_0_Conv2d_1x1_Acti Block8_6_Branch_1_Conv2d_0c_3x1_A __________________________________________________________________________________________________ Block8_6_Conv2d_1x1 (Conv2D) (None, 3, 3, 1792) 689920 Block8_6_Concatenate[0][0] __________________________________________________________________________________________________ Block8_6_ScaleSum (Lambda) (None, 3, 3, 1792) 0 Block8_5_Activation[0][0] Block8_6_Conv2d_1x1[0][0] __________________________________________________________________________________________________ AvgPool (GlobalAveragePooling2D (None, 1792) 0 Block8_6_ScaleSum[0][0] __________________________________________________________________________________________________ Dropout (Dropout) (None, 1792) 0 AvgPool[0][0] __________________________________________________________________________________________________ Bottleneck (Dense) (None, 128) 229376 Dropout[0][0] __________________________________________________________________________________________________ Bottleneck_BatchNorm (BatchNorm (None, 128) 384 Bottleneck[0][0] ================================================================================================== Total params: 22,808,144 Trainable params: 22,779,312 Non-trainable params: 28,832 __________________________________________________________________________________________________
By using a 128-neuron fully connected layer as its last layer, the model ensures that the output is an encoding vector of size 128. You then use the encodings to compare two face images as follows:
So, an encoding is a good one if:
The triplet loss function formalizes this, and tries to "push" the encodings of two images of the same person (Anchor and Positive) closer together, while "pulling" the encodings of two images of different persons (Anchor, Negative) further apart.
Important Note: Since you're using a pretrained model, you won't actually need to implement the triplet loss function in this assignment. However, the triplet loss is the main ingredient of the face recognition algorithm, and you'll need to know how to use it for training your own FaceNet model, as well as other types of image similarity problems. Therefore, you'll implement it below, for fun and edification. :)
For an image $x$, its encoding is denoted as $f(x)$, where $f$ is the function computed by the neural network.
Training will use triplets of images $(A, P, N)$:
These triplets are picked from the training dataset. $(A^{(i)}, P^{(i)}, N^{(i)})$ is used here to denote the $i$-th training example.
You'd like to make sure that an image $A^{(i)}$ of an individual is closer to the Positive $P^{(i)}$ than to the Negative image $N^{(i)}$) by at least a margin $\alpha$:
$$ || f\left(A^{(i)}\right)-f\left(P^{(i)}\right)||_{2}^{2}+\alpha<|| f\left(A^{(i)}\right)-f\left(N^{(i)}\right)||_{2}^{2} $$You would thus like to minimize the following "triplet cost":
$$\mathcal{J} = \sum^{m}_{i=1} \large[ \small \underbrace{\mid \mid f(A^{(i)}) - f(P^{(i)}) \mid \mid_2^2}_\text{(1)} - \underbrace{\mid \mid f(A^{(i)}) - f(N^{(i)}) \mid \mid_2^2}_\text{(2)} + \alpha \large ] \small_+ \tag{3}$$Here, the notation "$[z]_+$" is used to denote $max(z,0)$.
Notes:
Most implementations also rescale the encoding vectors to haven L2 norm equal to one (i.e., $\mid \mid f(img)\mid \mid_2$=1); you won't have to worry about that in this assignment.
Implement the triplet loss as defined by formula (3). These are the 4 steps:
Hints:
Useful functions: tf.reduce_sum()
, tf.square()
, tf.subtract()
, tf.add()
, tf.maximum()
.
For steps 1 and 2, sum over the entries of $\mid \mid f(A^{(i)}) - f(P^{(i)}) \mid \mid_2^2$ and $\mid \mid f(A^{(i)}) - f(N^{(i)}) \mid \mid_2^2$.
For step 4, you will sum over the training examples.
Additional Hints:
Recall that the square of the L2 norm is the sum of the squared differences: $||x - y||_{2}^{2} = \sum_{i=1}^{N}(x_{i} - y_{i})^{2}$
Note that the anchor, positive and negative encodings are of shape (m,128), where m is the number of training examples and 128 is the number of elements used to encode a single example.
For steps 1 and 2, maintain the number of m training examples and sum along the 128 values of each encoding. tf.reduce_sum
has an axis parameter. This chooses along which axis the sums are applied.
Note that one way to choose the last axis in a tensor is to use negative indexing (axis=-1).
In step 4, when summing over training examples, the result will be a single scalar value.
For tf.reduce_sum
to sum across all axes, keep the default value axis=None.
# GRADED FUNCTION: triplet_loss
def triplet_loss(y_true, y_pred, alpha = 0.2):
"""
Implementation of the triplet loss as defined by formula (3)
Arguments:
y_true -- true labels, required when you define a loss in Keras, you don't need it in this function.
y_pred -- python list containing three objects:
anchor -- the encodings for the anchor images, of shape (None, 128)
positive -- the encodings for the positive images, of shape (None, 128)
negative -- the encodings for the negative images, of shape (None, 128)
Returns:
loss -- real number, value of the loss
"""
anchor, positive, negative = y_pred[0], y_pred[1], y_pred[2]
# YOUR CODE STARTS HERE (≈ 4 lines)
# Step 1: Compute the (encoding) distance between the anchor and the positive
pos_dist = tf.reduce_sum(tf.square(tf.subtract(anchor,positive)),axis=-1)
# Step 2: Compute the (encoding) distance between the anchor and the negative
neg_dist = tf.reduce_sum(tf.square(tf.subtract(anchor,negative)),axis=-1)
# Step 3: subtract the two previous distances and add alpha.
basic_loss = tf.maximum(tf.add(tf.subtract(pos_dist,neg_dist),alpha),0)
# Step 4: Take the maximum of basic_loss and 0.0. Sum over the training examples.
loss = tf.reduce_sum(basic_loss)
# YOUR CODE ENDS HERE
return loss
tf.random.set_seed(1)
y_true = (None, None, None) # It is not used
y_pred = (tf.keras.backend.random_normal([3, 128], mean=6, stddev=0.1, seed = 1),
tf.keras.backend.random_normal([3, 128], mean=1, stddev=1, seed = 1),
tf.keras.backend.random_normal([3, 128], mean=3, stddev=4, seed = 1))
loss = triplet_loss(y_true, y_pred)
assert type(loss) == tf.python.framework.ops.EagerTensor, "Use tensorflow functions"
print("loss = " + str(loss))
y_pred_perfect = ([1., 1.], [1., 1.], [1., 1.,])
loss = triplet_loss(y_true, y_pred_perfect, 5)
assert loss == 5, "Wrong value. Did you add the alpha to basic_loss?"
y_pred_perfect = ([1., 1.],[1., 1.], [0., 0.,])
loss = triplet_loss(y_true, y_pred_perfect, 3)
assert loss == 1., "Wrong value. Check that pos_dist = 0 and neg_dist = 2 in this example"
y_pred_perfect = ([1., 1.],[0., 0.], [1., 1.,])
loss = triplet_loss(y_true, y_pred_perfect, 0)
assert loss == 2., "Wrong value. Check that pos_dist = 2 and neg_dist = 0 in this example"
y_pred_perfect = ([0., 0.],[0., 0.], [0., 0.,])
loss = triplet_loss(y_true, y_pred_perfect, -2)
assert loss == 0, "Wrong value. Are you taking the maximum between basic_loss and 0?"
y_pred_perfect = ([[1., 0.], [1., 0.]],[[1., 0.], [1., 0.]], [[0., 1.], [0., 1.]])
loss = triplet_loss(y_true, y_pred_perfect, 3)
assert loss == 2., "Wrong value. Are you applying tf.reduce_sum to get the loss?"
loss = tf.Tensor(527.2598, shape=(), dtype=float32)
Expected Output:
loss | 527.2598 |
FaceNet is trained by minimizing the triplet loss. But since training requires a lot of data and a lot of computation, you won't train it from scratch here. Instead, you'll load a previously trained model in the following cell; which might take a couple of minutes to run.
FRmodel = model
Here are some examples of distances between the encodings between three individuals:
Now use this model to perform face verification and face recognition!
You're building a system for an office building where the building manager would like to offer facial recognition to allow the employees to enter the building.
You'd like to build a face verification system that gives access to a list of people. To be admitted, each person has to swipe an identification card at the entrance. The face recognition system then verifies that they are who they claim to be.
Now you'll build a database containing one encoding vector for each person who is allowed to enter the office. To generate the encoding, you'll use img_to_encoding(image_path, model)
, which runs the forward propagation of the model on the specified image.
Run the following code to build the database (represented as a Python dictionary). This database maps each person's name to a 128-dimensional encoding of their face.
#tf.keras.backend.set_image_data_format('channels_last')
def img_to_encoding(image_path, model):
img = tf.keras.preprocessing.image.load_img(image_path, target_size=(160, 160))
img = np.around(np.array(img) / 255.0, decimals=12)
x_train = np.expand_dims(img, axis=0)
embedding = model.predict_on_batch(x_train)
return embedding / np.linalg.norm(embedding, ord=2)
database = {}
database["danielle"] = img_to_encoding("images/danielle.png", FRmodel)
database["younes"] = img_to_encoding("images/younes.jpg", FRmodel)
database["tian"] = img_to_encoding("images/tian.jpg", FRmodel)
database["andrew"] = img_to_encoding("images/andrew.jpg", FRmodel)
database["kian"] = img_to_encoding("images/kian.jpg", FRmodel)
database["dan"] = img_to_encoding("images/dan.jpg", FRmodel)
database["sebastiano"] = img_to_encoding("images/sebastiano.jpg", FRmodel)
database["bertrand"] = img_to_encoding("images/bertrand.jpg", FRmodel)
database["kevin"] = img_to_encoding("images/kevin.jpg", FRmodel)
database["felix"] = img_to_encoding("images/felix.jpg", FRmodel)
database["benoit"] = img_to_encoding("images/benoit.jpg", FRmodel)
database["arnaud"] = img_to_encoding("images/arnaud.jpg", FRmodel)
Load the images of Danielle and Kian:
danielle = tf.keras.preprocessing.image.load_img("images/danielle.png", target_size=(160, 160))
kian = tf.keras.preprocessing.image.load_img("images/kian.jpg", target_size=(160, 160))
#np.around(np.array(kian) / 255.0, decimals=12).shape
kian
benoit = tf.keras.preprocessing.image.load_img("images/benoit.jpg", target_size=(160, 160))
np.around(np.array(benoit) / 255.0, decimals=12).shape
(160, 160, 3)
benoit
np.around(np.array(danielle) / 255.0, decimals=12).shape
(160, 160, 3)
danielle
Now, when someone shows up at your front door and swipes their ID card (thus giving you their name), you can look up their encoding in the database, and use it to check if the person standing at the front door matches the name on the ID.
Implement the verify()
function, which checks if the front-door camera picture (image_path
) is actually the person called "identity". You will have to go through the following steps:
image_path
.As presented above, you should use the L2 distance np.linalg.norm
.
Note: In this implementation, compare the L2 distance, not the square of the L2 distance, to the threshold 0.7.
Hints:
identity
is a string that is also a key in the database dictionary.img_to_encoding
has two parameters: the image_path and model.# GRADED FUNCTION: verify
def verify(image_path, identity, database, model):
"""
Function that verifies if the person on the "image_path" image is "identity".
Arguments:
image_path -- path to an image
identity -- string, name of the person you'd like to verify the identity. Has to be an employee who works in the office.
database -- python dictionary mapping names of allowed people's names (strings) to their encodings (vectors).
model -- your Inception model instance in Keras
Returns:
dist -- distance between the image_path and the image of "identity" in the database.
door_open -- True, if the door should open. False otherwise.
"""
# YOUR CODE STARTS HERE
#Step 1: Compute the encoding for the image. Use img_to_encoding() see example above. (≈ 1 line)
encoding = img_to_encoding(image_path,model)
# Step 2: Compute distance with identity's image (≈ 1 line)
dist = np.linalg.norm(encoding - database[identity])
# Step 3: Open the door if dist < 0.7, else don't open (≈ 3 lines)
if dist < 0.7:
print("It's " + str(identity) + ", welcome in!")
door_open = True
else:
print("It's not " + str(identity) + ", please go away")
door_open = False
# YOUR CODE ENDS HERE
return dist, door_open
Younes is trying to enter the office and the camera takes a picture of him ("images/camera_0.jpg"). Let's run your verification algorithm on this picture:
assert(np.allclose(verify("images/camera_1.jpg", "bertrand", database, FRmodel), (0.54364836, True)))
assert(np.allclose(verify("images/camera_3.jpg", "bertrand", database, FRmodel), (0.38616243, True)))
assert(np.allclose(verify("images/camera_1.jpg", "younes", database, FRmodel), (1.3963861, False)))
assert(np.allclose(verify("images/camera_3.jpg", "younes", database, FRmodel), (1.3872949, False)))
verify("images/camera_0.jpg", "younes", database, FRmodel)
It's bertrand, welcome in! It's bertrand, welcome in! It's not younes, please go away It's not younes, please go away It's younes, welcome in!
(0.5992949, True)
Expected Output:
It's Younes, welcome in! | (0.5992946, True) |
Benoit, who does not work in the office, stole Kian's ID card and tried to enter the office. Naughty Benoit! The camera took a picture of Benoit ("images/camera_2.jpg).
Run the verification algorithm to check if Benoit can enter.
verify("images/camera_2.jpg", "kian", database, FRmodel)
It's not kian, please go away
(1.0259346, False)
Expected Output:
It's not Kian, please go away | (1.0259346, False) |
Run the verification algorithm to check if Andrew can enter
verify("images/andrew.jpg", "andrew", database, FRmodel)
It's andrew, welcome in!
(0.0, True)
Your face verification system is mostly working. But since Kian got his ID card stolen, when he came back to the office the next day he couldn't get in!
To solve this, you'd like to change your face verification system to a face recognition system. This way, no one has to carry an ID card anymore. An authorized person can just walk up to the building, and the door will unlock for them!
You'll implement a face recognition system that takes as input an image, and figures out if it is one of the authorized persons (and if so, who). Unlike the previous face verification system, you will no longer get a person's name as one of the inputs.
Implement who_is_it()
with the following steps:
image_path
min_dist
variable to a large enough number (100). This helps you keep track of the closest encoding to the input's encoding.database.items()
.# GRADED FUNCTION: who_is_it
def who_is_it(image_path, database, model):
"""
Implements face recognition for the office by finding who is the person on the image_path image.
Arguments:
image_path -- path to an image
database -- database containing image encodings along with the name of the person on the image
model -- your Inception model instance in Keras
Returns:
min_dist -- the minimum distance between image_path encoding and the encodings from the database
identity -- string, the name prediction for the person on image_path
"""
# YOUR CODE STARTS HERE
## Step 1: Compute the target "encoding" for the image. Use img_to_encoding() see example above. ## (≈ 1 line)
encoding = img_to_encoding(image_path,model)
## Step 2: Find the closest encoding ##
# Initialize "min_dist" to a large value, say 100 (≈1 line)
min_dist = 100
#Loop over the database dictionary's names and encodings.
for (name, db_enc) in database.items():
# Compute L2 distance between the target "encoding" and the current db_enc from the database. (≈ 1 line)
dist = np.linalg.norm(encoding - db_enc)
# If this distance is less than the min_dist, then set min_dist to dist, and identity to name. (≈ 3 lines)
if dist < min_dist:
min_dist = dist
identity = name
# YOUR CODE ENDS HERE
if min_dist > 0.7:
print("Not in the database.")
else:
print ("it's " + str(identity) + ", the distance is " + str(min_dist))
return min_dist, identity
Younes is at the front door and the camera takes a picture of him ("images/camera_0.jpg"). Let's see if your who_it_is()
algorithm identifies Younes.
# Test 1 with Younes pictures
who_is_it("images/camera_0.jpg", database, FRmodel)
# Test 2 with Younes pictures
test1 = who_is_it("images/camera_0.jpg", database, FRmodel)
assert np.isclose(test1[0], 0.5992946)
assert test1[1] == 'younes'
# Test 3 with Younes pictures
test2 = who_is_it("images/younes.jpg", database, FRmodel)
assert np.isclose(test2[0], 0.0)
assert test2[1] == 'younes'
it's younes, the distance is 0.5992949 it's younes, the distance is 0.5992949 it's younes, the distance is 0.0
Expected Output:
it's Younes, the distance is 0.5992946 | (0.5992946, 'younes') |
You can change "camera_0.jpg" (picture of Younes) to "camera_1.jpg" (picture of Bertrand) and see the result.
Congratulations! You've completed this assignment, and your face recognition system is working well! It not only lets in authorized persons, but now people don't need to carry an ID card around anymore!
You've now seen how a state-of-the-art face recognition system works, and can describe the difference between face recognition and face verification. Here's a quick recap of what you've accomplished:
Great work!
What you should remember:
Face verification solves an easier 1:1 matching problem; face recognition addresses a harder 1:K matching problem.
Triplet loss is an effective loss function for training a neural network to learn an encoding of a face image.
The same encoding can be used for verification and recognition. Measuring distances between two images' encodings allows you to determine whether they are pictures of the same person.
Ways to improve your facial recognition model:
Although you won't implement these here, here are some ways to further improve the algorithm:
Put more images of each person (under different lighting conditions, taken on different days, etc.) into the database. Then, given a new image, compare the new face to multiple pictures of the person. This would increase accuracy.
Crop the images to contain just the face, and less of the "border" region around the face. This preprocessing removes some of the irrelevant pixels around the face, and also makes the algorithm more robust.
Florian Schroff, Dmitry Kalenichenko, James Philbin (2015). FaceNet: A Unified Embedding for Face Recognition and Clustering
Yaniv Taigman, Ming Yang, Marc'Aurelio Ranzato, Lior Wolf (2014). DeepFace: Closing the gap to human-level performance in face verification
This implementation also took a lot of inspiration from the official FaceNet github repository: https://github.com/davidsandberg/facenet
Further inspiration was found here: https://machinelearningmastery.com/how-to-develop-a-face-recognition-system-using-facenet-in-keras-and-an-svm-classifier/
And here: https://github.com/nyoki-mtl/keras-facenet/blob/master/notebook/tf_to_keras.ipynb