Face detection, tracking and matching:

Import dependencies:


In [1]:
import face_recognition
import cv2

In [2]:
import os
from os.path import basename
import glob
import sys
import types
import subprocess
from random import randint
import json
import gc

In [3]:
import skvideo.io
import numpy as np
import scipy.misc
from skimage.transform import rescale, resize, downscale_local_mean

In [4]:
import PIL

In [5]:
import keras
from keras.preprocessing import image
from keras.models import model_from_json
from keras.optimizers import SGD, RMSprop, Adagrad
from keras.applications.inception_v3 import preprocess_input


/usr/local/lib/python3.6/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Using TensorFlow backend.

OpenCV version check:


In [6]:
(major_ver, minor_ver, subminor_ver) = (cv2.__version__).split('.')

if int(major_ver)  < 3 :
    print ("Update OpenCV ...")
    sys.exit(1)

Load video files:


In [7]:
source = '../video/One_Direction-Drag_Me_Down.mp4'

In [8]:
try:
    video_capture = cv2.VideoCapture(source)
    print ("Imported video using OpenCV ...")
except:
    video_capture =  skvideo.io.vread(source)
    print ("Imported video using sci-kit video ...")


Imported video using OpenCV ...

Initialize variables for video processing:


In [9]:
sgd = SGD(lr=1e-7, decay=0.5, momentum=1, nesterov=True)
rms = RMSprop(lr=1e-7, rho=0.9, epsilon=1e-08, decay=0.0)
ada = Adagrad(lr=1e-7, epsilon=1e-08, decay=0.0)
optimizer = sgd
IMG_HEIGHT = 299
IMG_WIDTH = 299

In [10]:
length = int(video_capture.get(cv2.CAP_PROP_FRAME_COUNT))

In [11]:
save_path = "../proc_vid.mp4"
save_audio = "../audio.wav"
save_path_w_audio = "../proc_vid_audio.mp4"
output_dir = '../output/'

In [12]:
face_locations = []
face_encodings = []
face_names = []
frame_number = 0
face_count = 0

In [13]:
w, h = int(video_capture.get(3)),int(video_capture.get(4))
print ("Source image width: "+ str(w))
print ("Source image height: "+ str(h))

fps = video_capture.get(cv2.CAP_PROP_FPS)
print ("Frames per second using video.get(cv2.CAP_PROP_FPS) : {0}".format(fps))


Source image width: 1280
Source image height: 720
Frames per second using video.get(cv2.CAP_PROP_FPS) : 23.976025018098067

In [14]:
fourcc = cv2.VideoWriter_fourcc(*'XVID')
video_writer = cv2.VideoWriter(save_path, fourcc, fps, (w,h), True)

In [15]:
reference_image_path = "../ref_img/"
file_list = glob.glob(reference_image_path + '/*.jpg')

In [16]:
n_proc_frames = length
resize_img = False
verbose = True
gen_train_img = True
interleaved = False
use_deep_learning = True
annotate = True
process_this_frame = True
inverse_scale_factor = 1

In [17]:
def compile_model(model):
    model.compile(optimizer=optimizer, loss='categorical_crossentropy', metrics=['accuracy'])

In [18]:
def load_prediction_model(args):
    try:
        with open(args.config_file[0]) as json_file:
              model_json = json_file.read()
        model = model_from_json(model_json)
    except:
          print ("Please specify a model configuration file ...")
          sys.exit(1)
    try:
          model.load_weights(args.weights_file[0])
          print ("Loaded model weights from: " + str(args.weights_file[0]))
    except:
          print ("Error loading model weights ...")
          sys.exit(1)
    try:
        with open(args.labels_file[0]) as json_file:
            labels = json.load(json_file)
        print ("Loaded labels from: " + str(args.labels_file[0]))
    except:
        print ("No labels loaded ...")
        sys.exit(1)
    return model, labels

In [19]:
def gen_predict(model):
    try:
        compile_model(model)
        print ("Model successfully compiled ...")
    except:
        print ("Model failed to compile ...")

    print ("Compiling predictor function ...")                                          # to avoid the delay during video capture.
    _ = model.predict(np.zeros((1, n, n, 3), dtype=np.float32), batch_size=1)
    print ("Compilation completed ...")

In [20]:
args = types.SimpleNamespace()
args.config_file = ['../model/trained_config.json']
args.weights_file = ['../model/trained_weights.model']
args.labels_file = ['../model/trained_labels.json']
args.output_dir = ['../output/']

In [21]:
model, labels = load_prediction_model(args)


Loaded model weights from: ../model/trained_weights.model
Loaded labels from: ../model/trained_labels.json

In OpenCV using: interpolation = cv2.INTER_CUBIC argument in cv2.resize, performs a bi-cubic interpolation over 4x4 pixel neighborhood.


In [22]:
while (video_capture.isOpened()):    
    ret, frame = video_capture.read() # Grab a single frame of video
    
    frame_number += 1
    
    if resize_img ==True:
        isf = inverse_scale_factor
        small_frame = cv2.resize(frame, (0, 0), fx=(1/isf), fy=(1/isf)) # Resize frame of video to 1/inverse_scale_factor size for faster processing
    else:
        isf = 1
        small_frame = frame
    if frame_number <=n_proc_frames:
        if ret ==True:
            if process_this_frame:
                face_locations = face_recognition.face_locations(small_frame) # Find all the faces and face encodings in the current frame of video
                face_encodings = face_recognition.face_encodings(small_frame, face_locations)
                face_names = []
                if annotate == True or gen_train_img == True:
                    for face_encoding in face_encodings:
                        for file_path in file_list:
                            reference_image = face_recognition.load_image_file(file_path)
                            try:
                                reference_face_encoding = face_recognition.face_encodings(reference_image)[0]
                                if verbose == True:
                                    print ("Processed face encodings ...")
                                else:
                                    pass
                            except:
                                if verbose == True:
                                    print("Failed processing face encodings ...")
                                else:
                                    pass
                            if annotate == True:
                                name_ID = (os.path.splitext(basename(file_path))[0])
                                name_ID = name_ID.replace("_", " ")
                                match = face_recognition.compare_faces([reference_face_encoding], face_encoding) # See if the face is a match for the known face(s)
                                name = "Unknown"
                                if match[0]:
                                    name = name_ID
                                face_names.append(name)
                            else:
                                pass
                else:
                    if verbose == True:
                        print ("Skipping face recognition mode ...")
                    else:
                        pass
            else:
                if verbose == True:
                    print ("Skipping frame ...")
                else:
                    pass
            if interleaved == True:
                process_this_frame = not process_this_frame # Only process every other frame of video to save time
            else:
                process_this_frame = process_this_frame

            # Display the results
            for (top, right, bottom, left), name in zip(face_locations, face_names):
                # Scale back up face locations since the frame we detected in was scaled to scaling factor size
                top *= int(isf)
                right *= int(isf)
                bottom *= int(isf)
                left *= int(isf)
                # Draw an ellipse around the face
                ex = left
                ey = top
                ew = int(abs(right - ex))
                eh = int(abs(bottom - ey))
                p1 = int(ew/2 + ex)
                p2 = int(eh/2 + ey)
                h1 = int(ew/2)
                h2 = int(eh/2)
                square = frame[max((ey-eh//2,0)):ey+3*eh//2, max((ex-ew//2,0)):ex+3*ew//2]
                if use_deep_learning == True and annotate == True:
                    preds_square = cv2.resize(square.astype(np.float32),    \
                                        dsize=(IMG_WIDTH, IMG_HEIGHT),\
                                        interpolation = cv2.INTER_CUBIC)
                    try:
                        _X_ = image.img_to_array(preds_square)
                        del (preds_square)
                        _X_ = np.expand_dims(_X_, axis=0)
                        _X_ = preprocess_input(_X_)
                        probabilities = model.predict(_X_, batch_size=1).flatten()
                        del (_X_)
                        prediction = labels[np.argmax(probabilities)]
                        name = (str(prediction)).replace("_", " ")
                        print ("Face recognition using deep-learning ...")
                        print (prediction + "\t" + "\t".join(map(lambda x: "%.2f" % x, probabilities)))
                        print (str(prediction))
                        del (prediction)
                        gc.collect()
                    except:
                        print ("Failed to create a prediction ...")         
                else:
                    pass
                if gen_train_img == True:
                    random_number = randint(10000000, 99999999)
                    random_number = str(random_number)
                    cv2.imwrite(os.path.join(output_dir + "//" + 
                                             str(name.replace("", "_")) +"_" + 
                                             str(random_number) +
                                             "_loc_" + str(p1) + "_" + 
                                             str(p2) + "_" +
                                             str(h1) + "_" +
                                             str(h2) + "_" +
                                             "_frame_%d.jpg" % face_count), square)
                    
                    if verbose == True:
                        print ("Saved frame: "+ str(face_count)+" with face detected ..." )
                        if name != "Unknown":
                            print ("Possible match for detected face: " + str(name))
                        else:
                            pass
                    else:
                        pass
                    cv2.ellipse(frame, (p1, p2), (h1,h2), 0,0,360, (0,255,0), 2)
                    del (square)
                    face_count += 1
                else:
                    pass
                if annotate == True:
                    font = cv2.FONT_HERSHEY_DUPLEX
                    cv2.rectangle(frame, (p1 - 100, bottom - 2), (p1 + 100, bottom + 33), (0, 0, 255), cv2.FILLED) 
                    cv2.putText(frame, name, (p1  - 94, bottom + 23 ), font, 0.75, (255, 255, 255), 1) # Draw a label with a name below the face
                else:
                    if verbose == True:
                        print ("No identifiers to annotate. Try setting annotate flag to True ...")
                    else:
                        pass
            try:
                video_writer.write(frame)
                if verbose == True:
                    print("Processed frame {} / {}".format(frame_number, length))
                else:
                    pass
            except:
                if verbose == True:
                    print("Failed writing frame {} / {}".format(frame_number, length))
                else:
                    pass
        else:
            if verbose == True:
                print("No frame to process ...")
            else:
                pass
    else:
        if verbose == True:
            print ("Processed "+ str(n_proc_frames) + " frames")
            print ("Detected " + str(face_count) + " faces" )
        else:
            print ("Detected " + str(face_count) + " faces" )
        break


Processed frame 1 / 50
Processed frame 2 / 50
Processed frame 3 / 50
Processed frame 4 / 50
Processed frame 5 / 50
Processed frame 6 / 50
Processed frame 7 / 50
Processed frame 8 / 50
Processed frame 9 / 50
Processed frame 10 / 50
Processed frame 11 / 50
Processed frame 12 / 50
Processed frame 13 / 50
Processed frame 14 / 50
Processed frame 15 / 50
Processed frame 16 / 50
Processed frame 17 / 50
Processed frame 18 / 50
Processed frame 19 / 50
Processed frame 20 / 50
Processed frame 21 / 50
Processed frame 22 / 50
Processed frame 23 / 50
Processed frame 24 / 50
Processed frame 25 / 50
Processed frame 26 / 50
Processed frame 27 / 50
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.07	0.28	0.08	0.45	0.11
Niall_Horan
Saved frame: 0 with face detected ...
Possible match for detected face: Niall Horan
Processed frame 28 / 50
Processed face encodings ...
Face recognition using deep-learning ...
Liam_Payne	0.06	0.60	0.06	0.25	0.03
Liam_Payne
Saved frame: 1 with face detected ...
Possible match for detected face: Liam Payne
Processed frame 29 / 50
Processed face encodings ...
Face recognition using deep-learning ...
Liam_Payne	0.02	0.91	0.02	0.03	0.01
Liam_Payne
Saved frame: 2 with face detected ...
Possible match for detected face: Liam Payne
Processed frame 30 / 50
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.03	0.10	0.02	0.85	0.00
Niall_Horan
Saved frame: 3 with face detected ...
Possible match for detected face: Niall Horan
Processed frame 31 / 50
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.04	0.01	0.01	0.93	0.01
Niall_Horan
Saved frame: 4 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Niall_Horan	0.00	0.09	0.03	0.79	0.09
Niall_Horan
Saved frame: 5 with face detected ...
Possible match for detected face: Niall Horan
Processed frame 32 / 50
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.04	0.03	0.01	0.91	0.02
Niall_Horan
Saved frame: 6 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Niall_Horan	0.01	0.11	0.05	0.61	0.23
Niall_Horan
Saved frame: 7 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Niall_Horan	0.08	0.04	0.24	0.62	0.02
Niall_Horan
Saved frame: 8 with face detected ...
Possible match for detected face: Niall Horan
Processed frame 33 / 50
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.02	0.07	0.03	0.81	0.07
Niall_Horan
Saved frame: 9 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Niall_Horan	0.16	0.01	0.13	0.69	0.01
Niall_Horan
Saved frame: 10 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Niall_Horan	0.01	0.07	0.03	0.80	0.09
Niall_Horan
Saved frame: 11 with face detected ...
Possible match for detected face: Niall Horan
Processed frame 34 / 50
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.00	0.02	0.02	0.96	0.01
Niall_Horan
Saved frame: 12 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Niall_Horan	0.07	0.01	0.19	0.71	0.02
Niall_Horan
Saved frame: 13 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Niall_Horan	0.01	0.09	0.07	0.76	0.06
Niall_Horan
Saved frame: 14 with face detected ...
Possible match for detected face: Niall Horan
Processed frame 35 / 50
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.02	0.22	0.05	0.64	0.07
Niall_Horan
Saved frame: 15 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Niall_Horan	0.02	0.02	0.16	0.77	0.03
Niall_Horan
Saved frame: 16 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Niall_Horan	0.00	0.21	0.10	0.67	0.02
Niall_Horan
Saved frame: 17 with face detected ...
Possible match for detected face: Niall Horan
Processed frame 36 / 50
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.00	0.02	0.01	0.95	0.01
Niall_Horan
Saved frame: 18 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Niall_Horan	0.03	0.05	0.23	0.52	0.17
Niall_Horan
Saved frame: 19 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Liam_Payne	0.02	0.43	0.15	0.29	0.11
Liam_Payne
Saved frame: 20 with face detected ...
Possible match for detected face: Liam Payne
Processed frame 37 / 50
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.00	0.03	0.03	0.93	0.01
Niall_Horan
Saved frame: 21 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Niall_Horan	0.01	0.07	0.15	0.57	0.20
Niall_Horan
Saved frame: 22 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Liam_Payne	0.02	0.49	0.12	0.35	0.02
Liam_Payne
Saved frame: 23 with face detected ...
Possible match for detected face: Liam Payne
Processed frame 38 / 50
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.01	0.01	0.02	0.95	0.00
Niall_Horan
Saved frame: 24 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Niall_Horan	0.03	0.08	0.29	0.47	0.13
Niall_Horan
Saved frame: 25 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Liam_Payne	0.03	0.40	0.13	0.39	0.05
Liam_Payne
Saved frame: 26 with face detected ...
Possible match for detected face: Liam Payne
Processed frame 39 / 50
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.05	0.02	0.03	0.86	0.04
Niall_Horan
Saved frame: 27 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Louis_Tomlinson	0.01	0.12	0.52	0.29	0.06
Louis_Tomlinson
Saved frame: 28 with face detected ...
Possible match for detected face: Louis Tomlinson
Face recognition using deep-learning ...
Niall_Horan	0.03	0.36	0.10	0.46	0.05
Niall_Horan
Saved frame: 29 with face detected ...
Possible match for detected face: Niall Horan
Processed frame 40 / 50
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.02	0.01	0.01	0.96	0.01
Niall_Horan
Saved frame: 30 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Louis_Tomlinson	0.06	0.28	0.41	0.16	0.09
Louis_Tomlinson
Saved frame: 31 with face detected ...
Possible match for detected face: Louis Tomlinson
Face recognition using deep-learning ...
Liam_Payne	0.03	0.53	0.16	0.25	0.03
Liam_Payne
Saved frame: 32 with face detected ...
Possible match for detected face: Liam Payne
Processed frame 41 / 50
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.01	0.01	0.01	0.97	0.00
Niall_Horan
Saved frame: 33 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Louis_Tomlinson	0.00	0.10	0.79	0.10	0.01
Louis_Tomlinson
Saved frame: 34 with face detected ...
Possible match for detected face: Louis Tomlinson
Face recognition using deep-learning ...
Niall_Horan	0.01	0.24	0.07	0.62	0.05
Niall_Horan
Saved frame: 35 with face detected ...
Possible match for detected face: Niall Horan
Processed frame 42 / 50
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.01	0.01	0.01	0.97	0.00
Niall_Horan
Saved frame: 36 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Louis_Tomlinson	0.01	0.12	0.75	0.11	0.01
Louis_Tomlinson
Saved frame: 37 with face detected ...
Possible match for detected face: Louis Tomlinson
Face recognition using deep-learning ...
Niall_Horan	0.02	0.22	0.08	0.60	0.08
Niall_Horan
Saved frame: 38 with face detected ...
Possible match for detected face: Niall Horan
Processed frame 43 / 50
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.01	0.01	0.01	0.96	0.01
Niall_Horan
Saved frame: 39 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Niall_Horan	0.07	0.11	0.05	0.68	0.08
Niall_Horan
Saved frame: 40 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Louis_Tomlinson	0.01	0.05	0.77	0.15	0.02
Louis_Tomlinson
Saved frame: 41 with face detected ...
Possible match for detected face: Louis Tomlinson
Processed frame 44 / 50
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.00	0.00	0.00	1.00	0.00
Niall_Horan
Saved frame: 42 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Niall_Horan	0.09	0.32	0.08	0.49	0.02
Niall_Horan
Saved frame: 43 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Louis_Tomlinson	0.02	0.15	0.63	0.14	0.06
Louis_Tomlinson
Saved frame: 44 with face detected ...
Possible match for detected face: Louis Tomlinson
Processed frame 45 / 50
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.00	0.00	0.00	1.00	0.00
Niall_Horan
Saved frame: 45 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Liam_Payne	0.03	0.68	0.12	0.17	0.01
Liam_Payne
Saved frame: 46 with face detected ...
Possible match for detected face: Liam Payne
Face recognition using deep-learning ...
Louis_Tomlinson	0.04	0.11	0.56	0.10	0.19
Louis_Tomlinson
Saved frame: 47 with face detected ...
Possible match for detected face: Louis Tomlinson
Processed frame 46 / 50
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.00	0.00	0.00	1.00	0.00
Niall_Horan
Saved frame: 48 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Louis_Tomlinson	0.01	0.22	0.60	0.05	0.12
Louis_Tomlinson
Saved frame: 49 with face detected ...
Possible match for detected face: Louis Tomlinson
Face recognition using deep-learning ...
Liam_Payne	0.01	0.75	0.11	0.08	0.04
Liam_Payne
Saved frame: 50 with face detected ...
Possible match for detected face: Liam Payne
Processed frame 47 / 50
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.00	0.00	0.00	1.00	0.00
Niall_Horan
Saved frame: 51 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Louis_Tomlinson	0.03	0.22	0.51	0.15	0.08
Louis_Tomlinson
Saved frame: 52 with face detected ...
Possible match for detected face: Louis Tomlinson
Face recognition using deep-learning ...
Liam_Payne	0.01	0.67	0.13	0.16	0.02
Liam_Payne
Saved frame: 53 with face detected ...
Possible match for detected face: Liam Payne
Processed frame 48 / 50
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.00	0.00	0.00	1.00	0.00
Niall_Horan
Saved frame: 54 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Liam_Payne	0.01	0.82	0.09	0.08	0.01
Liam_Payne
Saved frame: 55 with face detected ...
Possible match for detected face: Liam Payne
Face recognition using deep-learning ...
Unknown	0.02	0.18	0.30	0.16	0.34
Unknown
Saved frame: 56 with face detected ...
Processed frame 49 / 50
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Processed face encodings ...
Face recognition using deep-learning ...
Niall_Horan	0.00	0.00	0.00	1.00	0.00
Niall_Horan
Saved frame: 57 with face detected ...
Possible match for detected face: Niall Horan
Face recognition using deep-learning ...
Liam_Payne	0.00	0.88	0.07	0.03	0.01
Liam_Payne
Saved frame: 58 with face detected ...
Possible match for detected face: Liam Payne
Face recognition using deep-learning ...
Louis_Tomlinson	0.01	0.25	0.39	0.21	0.14
Louis_Tomlinson
Saved frame: 59 with face detected ...
Possible match for detected face: Louis Tomlinson
Face recognition using deep-learning ...
Harry_Styles	0.89	0.02	0.04	0.03	0.02
Harry_Styles
Saved frame: 60 with face detected ...
Possible match for detected face: Harry Styles
Processed frame 50 / 50
Processed 50 frames
Detected 61 faces

Release handle reading the video file or webcam:


In [23]:
video_capture.release()
video_writer.release()

Extract audio from a video file:


In [24]:
cmd = 'ffmpeg -i %s -ab 320000 -ac 2 -ar 44100 -vn %s' % (source, save_audio)
print (cmd)
subprocess.call(cmd, shell=True)


ffmpeg -i ../video/One_Direction-Drag_Me_Down.mp4 -ab 320000 -ac 2 -ar 44100 -vn ../audio.wav
Out[24]:
0

Copy audio track from one video to another:


In [25]:
cmd = 'ffmpeg -y -i %s -i %s -shortest -c:v copy -c:a aac -b:a 256k  %s' % (save_path, save_audio, save_path_w_audio)
print (cmd)
subprocess.call(cmd, shell=True)
print('Muxing completed ...')
print('Saved output file to: %s' % (save_path_w_audio))


ffmpeg -y -i ../proc_vid.mp4 -i ../audio.wav -shortest -c:v copy -c:a aac -b:a 256k  ../proc_vid_audio.mp4
Muxing completed ...
Saved output file to: ../proc_vid_audio.mp4

Visualize deep-learning model architecture:


In [26]:
from keras.utils import plot_model 
import pydot 
import graphviz # apt-get install -y graphviz libgraphviz-dev 
from IPython.display import SVG 
from keras.utils.vis_utils import model_to_dot

In [27]:
plot_model(model, to_file= os.path.join(args.output_dir[0] + '/model_face_detection.png')) 
SVG(model_to_dot(model).create(prog='dot', format='svg'))


Out[27]:
G 139911666510704 input_1: InputLayer 139911666510816 conv2d_1: Conv2D 139911666510704->139911666510816 139911666511544 batch_normalization_1: BatchNormalization 139911666510816->139911666511544 139911666511040 activation_1: Activation 139911666511544->139911666511040 139911666544992 conv2d_2: Conv2D 139911666511040->139911666544992 139911666545328 batch_normalization_2: BatchNormalization 139911666544992->139911666545328 139911666545664 activation_2: Activation 139911666545328->139911666545664 139911666545720 conv2d_3: Conv2D 139911666545664->139911666545720 139911666546056 batch_normalization_3: BatchNormalization 139911666545720->139911666546056 139911666546392 activation_3: Activation 139911666546056->139911666546392 139911666546448 max_pooling2d_1: MaxPooling2D 139911666546392->139911666546448 139911666546616 conv2d_4: Conv2D 139911666546448->139911666546616 139911666546952 batch_normalization_4: BatchNormalization 139911666546616->139911666546952 139911666547288 activation_4: Activation 139911666546952->139911666547288 139911666547344 conv2d_5: Conv2D 139911666547288->139911666547344 139911666547680 batch_normalization_5: BatchNormalization 139911666547344->139911666547680 139911666548016 activation_5: Activation 139911666547680->139911666548016 139911666548072 max_pooling2d_2: MaxPooling2D 139911666548016->139911666548072 139911666548240 conv2d_9: Conv2D 139911666548072->139911666548240 139911666573608 conv2d_7: Conv2D 139911666548072->139911666573608 139911666575064 average_pooling2d_1: AveragePooling2D 139911666548072->139911666575064 139911666575232 conv2d_6: Conv2D 139911666548072->139911666575232 139911666548576 batch_normalization_9: BatchNormalization 139911666548240->139911666548576 139911666510928 activation_9: Activation 139911666548576->139911666510928 139911666573944 conv2d_10: Conv2D 139911666510928->139911666573944 139911666574336 batch_normalization_7: BatchNormalization 139911666573608->139911666574336 139911666574672 batch_normalization_10: BatchNormalization 139911666573944->139911666574672 139911666574952 activation_7: Activation 139911666574336->139911666574952 139911666575008 activation_10: Activation 139911666574672->139911666575008 139911666575568 conv2d_8: Conv2D 139911666574952->139911666575568 139911666575960 conv2d_11: Conv2D 139911666575008->139911666575960 139911666576352 conv2d_12: Conv2D 139911666575064->139911666576352 139911666576744 batch_normalization_6: BatchNormalization 139911666575232->139911666576744 139911666577080 batch_normalization_8: BatchNormalization 139911666575568->139911666577080 139911666548688 batch_normalization_11: BatchNormalization 139911666575960->139911666548688 139911666589992 batch_normalization_12: BatchNormalization 139911666576352->139911666589992 139911666590272 activation_6: Activation 139911666576744->139911666590272 139911666590328 activation_8: Activation 139911666577080->139911666590328 139911666590384 activation_11: Activation 139911666548688->139911666590384 139911666590440 activation_12: Activation 139911666589992->139911666590440 139911666590496 mixed0: Concatenate 139911666590272->139911666590496 139911666590328->139911666590496 139911666590384->139911666590496 139911666590440->139911666590496 139911666590552 conv2d_16: Conv2D 139911666590496->139911666590552 139911666591280 conv2d_14: Conv2D 139911666590496->139911666591280 139911666592736 average_pooling2d_2: AveragePooling2D 139911666590496->139911666592736 139911666592904 conv2d_13: Conv2D 139911666590496->139911666592904 139911666590888 batch_normalization_16: BatchNormalization 139911666590552->139911666590888 139911666591224 activation_16: Activation 139911666590888->139911666591224 139911666591616 conv2d_17: Conv2D 139911666591224->139911666591616 139911666592008 batch_normalization_14: BatchNormalization 139911666591280->139911666592008 139911666592344 batch_normalization_17: BatchNormalization 139911666591616->139911666592344 139911666592624 activation_14: Activation 139911666592008->139911666592624 139911666592680 activation_17: Activation 139911666592344->139911666592680 139911666593240 conv2d_15: Conv2D 139911666592624->139911666593240 139911666593632 conv2d_18: Conv2D 139911666592680->139911666593632 139911665840424 conv2d_19: Conv2D 139911666592736->139911665840424 139911665840816 batch_normalization_13: BatchNormalization 139911666592904->139911665840816 139911665841152 batch_normalization_15: BatchNormalization 139911666593240->139911665841152 139911665841432 batch_normalization_18: BatchNormalization 139911666593632->139911665841432 139911665841712 batch_normalization_19: BatchNormalization 139911665840424->139911665841712 139911665841992 activation_13: Activation 139911665840816->139911665841992 139911665842048 activation_15: Activation 139911665841152->139911665842048 139911665842104 activation_18: Activation 139911665841432->139911665842104 139911665842160 activation_19: Activation 139911665841712->139911665842160 139911665842216 mixed1: Concatenate 139911665841992->139911665842216 139911665842048->139911665842216 139911665842104->139911665842216 139911665842160->139911665842216 139911665842272 conv2d_23: Conv2D 139911665842216->139911665842272 139911665843000 conv2d_21: Conv2D 139911665842216->139911665843000 139911665856808 average_pooling2d_3: AveragePooling2D 139911665842216->139911665856808 139911665856976 conv2d_20: Conv2D 139911665842216->139911665856976 139911665842608 batch_normalization_23: BatchNormalization 139911665842272->139911665842608 139911665842944 activation_23: Activation 139911665842608->139911665842944 139911665843336 conv2d_24: Conv2D 139911665842944->139911665843336 139911665843728 batch_normalization_21: BatchNormalization 139911665843000->139911665843728 139911665844064 batch_normalization_24: BatchNormalization 139911665843336->139911665844064 139911666577360 activation_21: Activation 139911665843728->139911666577360 139911665856752 activation_24: Activation 139911665844064->139911665856752 139911665857312 conv2d_22: Conv2D 139911666577360->139911665857312 139911665857704 conv2d_25: Conv2D 139911665856752->139911665857704 139911665858096 conv2d_26: Conv2D 139911665856808->139911665858096 139911665858488 batch_normalization_20: BatchNormalization 139911665856976->139911665858488 139911665858824 batch_normalization_22: BatchNormalization 139911665857312->139911665858824 139911665859104 batch_normalization_25: BatchNormalization 139911665857704->139911665859104 139911665859384 batch_normalization_26: BatchNormalization 139911665858096->139911665859384 139911665859664 activation_20: Activation 139911665858488->139911665859664 139911665859720 activation_22: Activation 139911665858824->139911665859720 139911665859776 activation_25: Activation 139911665859104->139911665859776 139911665859832 activation_26: Activation 139911665859384->139911665859832 139911665859888 mixed2: Concatenate 139911665859664->139911665859888 139911665859720->139911665859888 139911665859776->139911665859888 139911665859832->139911665859888 139911665859944 conv2d_28: Conv2D 139911665859888->139911665859944 139911665898328 conv2d_27: Conv2D 139911665859888->139911665898328 139911665899784 max_pooling2d_3: MaxPooling2D 139911665859888->139911665899784 139911665860280 batch_normalization_28: BatchNormalization 139911665859944->139911665860280 139911665844176 activation_28: Activation 139911665860280->139911665844176 139911665897600 conv2d_29: Conv2D 139911665844176->139911665897600 139911665897936 batch_normalization_29: BatchNormalization 139911665897600->139911665897936 139911665898272 activation_29: Activation 139911665897936->139911665898272 139911665898664 conv2d_30: Conv2D 139911665898272->139911665898664 139911665899056 batch_normalization_27: BatchNormalization 139911665898328->139911665899056 139911665899392 batch_normalization_30: BatchNormalization 139911665898664->139911665899392 139911665899672 activation_27: Activation 139911665899056->139911665899672 139911665899728 activation_30: Activation 139911665899392->139911665899728 139911665899952 mixed3: Concatenate 139911665899672->139911665899952 139911665899728->139911665899952 139911665899784->139911665899952 139911665900008 conv2d_35: Conv2D 139911665899952->139911665900008 139911665901464 conv2d_32: Conv2D 139911665899952->139911665901464 139911665945400 average_pooling2d_4: AveragePooling2D 139911665899952->139911665945400 139911665945568 conv2d_31: Conv2D 139911665899952->139911665945568 139911665900344 batch_normalization_35: BatchNormalization 139911665900008->139911665900344 139911665900680 activation_35: Activation 139911665900344->139911665900680 139911665900736 conv2d_36: Conv2D 139911665900680->139911665900736 139911665901072 batch_normalization_36: BatchNormalization 139911665900736->139911665901072 139911665901408 activation_36: Activation 139911665901072->139911665901408 139911665942824 conv2d_37: Conv2D 139911665901408->139911665942824 139911665943216 batch_normalization_32: BatchNormalization 139911665901464->139911665943216 139911665943552 batch_normalization_37: BatchNormalization 139911665942824->139911665943552 139911665943832 activation_32: Activation 139911665943216->139911665943832 139911665943888 activation_37: Activation 139911665943552->139911665943888 139911665943944 conv2d_33: Conv2D 139911665943832->139911665943944 139911665944280 conv2d_38: Conv2D 139911665943888->139911665944280 139911665944672 batch_normalization_33: BatchNormalization 139911665943944->139911665944672 139911665945008 batch_normalization_38: BatchNormalization 139911665944280->139911665945008 139911665945288 activation_33: Activation 139911665944672->139911665945288 139911665945344 activation_38: Activation 139911665945008->139911665945344 139911665945904 conv2d_34: Conv2D 139911665945288->139911665945904 139911665946296 conv2d_39: Conv2D 139911665945344->139911665946296 139911665860560 conv2d_40: Conv2D 139911665945400->139911665860560 139911665979912 batch_normalization_31: BatchNormalization 139911665945568->139911665979912 139911665980248 batch_normalization_34: BatchNormalization 139911665945904->139911665980248 139911665980528 batch_normalization_39: BatchNormalization 139911665946296->139911665980528 139911665980808 batch_normalization_40: BatchNormalization 139911665860560->139911665980808 139911665981088 activation_31: Activation 139911665979912->139911665981088 139911665981144 activation_34: Activation 139911665980248->139911665981144 139911665981200 activation_39: Activation 139911665980528->139911665981200 139911665981256 activation_40: Activation 139911665980808->139911665981256 139911665981312 mixed4: Concatenate 139911665981088->139911665981312 139911665981144->139911665981312 139911665981200->139911665981312 139911665981256->139911665981312 139911665981368 conv2d_45: Conv2D 139911665981312->139911665981368 139911665982824 conv2d_42: Conv2D 139911665981312->139911665982824 139911666010376 average_pooling2d_5: AveragePooling2D 139911665981312->139911666010376 139911666010544 conv2d_41: Conv2D 139911665981312->139911666010544 139911665981704 batch_normalization_45: BatchNormalization 139911665981368->139911665981704 139911665982040 activation_45: Activation 139911665981704->139911665982040 139911665982096 conv2d_46: Conv2D 139911665982040->139911665982096 139911665982432 batch_normalization_46: BatchNormalization 139911665982096->139911665982432 139911665982768 activation_46: Activation 139911665982432->139911665982768 139911665983160 conv2d_47: Conv2D 139911665982768->139911665983160 139911665946520 batch_normalization_42: BatchNormalization 139911665982824->139911665946520 139911666008528 batch_normalization_47: BatchNormalization 139911665983160->139911666008528 139911666008808 activation_42: Activation 139911665946520->139911666008808 139911666008864 activation_47: Activation 139911666008528->139911666008864 139911666008920 conv2d_43: Conv2D 139911666008808->139911666008920 139911666009256 conv2d_48: Conv2D 139911666008864->139911666009256 139911666009648 batch_normalization_43: BatchNormalization 139911666008920->139911666009648 139911666009984 batch_normalization_48: BatchNormalization 139911666009256->139911666009984 139911666010264 activation_43: Activation 139911666009648->139911666010264 139911666010320 activation_48: Activation 139911666009984->139911666010320 139911666010880 conv2d_44: Conv2D 139911666010264->139911666010880 139911666011272 conv2d_49: Conv2D 139911666010320->139911666011272 139911666011664 conv2d_50: Conv2D 139911666010376->139911666011664 139911665983384 batch_normalization_41: BatchNormalization 139911666010544->139911665983384 139911666041128 batch_normalization_44: BatchNormalization 139911666010880->139911666041128 139911666041408 batch_normalization_49: BatchNormalization 139911666011272->139911666041408 139911666041688 batch_normalization_50: BatchNormalization 139911666011664->139911666041688 139911666041968 activation_41: Activation 139911665983384->139911666041968 139911666042024 activation_44: Activation 139911666041128->139911666042024 139911666042080 activation_49: Activation 139911666041408->139911666042080 139911666042136 activation_50: Activation 139911666041688->139911666042136 139911666042192 mixed5: Concatenate 139911666041968->139911666042192 139911666042024->139911666042192 139911666042080->139911666042192 139911666042136->139911666042192 139911666042248 conv2d_55: Conv2D 139911666042192->139911666042248 139911666043704 conv2d_52: Conv2D 139911666042192->139911666043704 139911666067160 average_pooling2d_6: AveragePooling2D 139911666042192->139911666067160 139911666067328 conv2d_51: Conv2D 139911666042192->139911666067328 139911666042584 batch_normalization_55: BatchNormalization 139911666042248->139911666042584 139911666042920 activation_55: Activation 139911666042584->139911666042920 139911666042976 conv2d_56: Conv2D 139911666042920->139911666042976 139911666043312 batch_normalization_56: BatchNormalization 139911666042976->139911666043312 139911666043648 activation_56: Activation 139911666043312->139911666043648 139911666044040 conv2d_57: Conv2D 139911666043648->139911666044040 139911666044432 batch_normalization_52: BatchNormalization 139911666043704->139911666044432 139911666044768 batch_normalization_57: BatchNormalization 139911666044040->139911666044768 139911666012056 activation_52: Activation 139911666044432->139911666012056 139911666065648 activation_57: Activation 139911666044768->139911666065648 139911666065704 conv2d_53: Conv2D 139911666012056->139911666065704 139911666066040 conv2d_58: Conv2D 139911666065648->139911666066040 139911666066432 batch_normalization_53: BatchNormalization 139911666065704->139911666066432 139911666066768 batch_normalization_58: BatchNormalization 139911666066040->139911666066768 139911666067048 activation_53: Activation 139911666066432->139911666067048 139911666067104 activation_58: Activation 139911666066768->139911666067104 139911666067664 conv2d_54: Conv2D 139911666067048->139911666067664 139911666068056 conv2d_59: Conv2D 139911666067104->139911666068056 139911666068448 conv2d_60: Conv2D 139911666067160->139911666068448 139911666068840 batch_normalization_51: BatchNormalization 139911666067328->139911666068840 139911666069176 batch_normalization_54: BatchNormalization 139911666067664->139911666069176 139911666044880 batch_normalization_59: BatchNormalization 139911666068056->139911666044880 139911666987304 batch_normalization_60: BatchNormalization 139911666068448->139911666987304 139911666987584 activation_51: Activation 139911666068840->139911666987584 139911666987640 activation_54: Activation 139911666069176->139911666987640 139911666987696 activation_59: Activation 139911666044880->139911666987696 139911666987752 activation_60: Activation 139911666987304->139911666987752 139911666987808 mixed6: Concatenate 139911666987584->139911666987808 139911666987640->139911666987808 139911666987696->139911666987808 139911666987752->139911666987808 139911666987864 conv2d_65: Conv2D 139911666987808->139911666987864 139911666989320 conv2d_62: Conv2D 139911666987808->139911666989320 139911666889896 average_pooling2d_7: AveragePooling2D 139911666987808->139911666889896 139911666890064 conv2d_61: Conv2D 139911666987808->139911666890064 139911666988200 batch_normalization_65: BatchNormalization 139911666987864->139911666988200 139911666988536 activation_65: Activation 139911666988200->139911666988536 139911666988592 conv2d_66: Conv2D 139911666988536->139911666988592 139911666988928 batch_normalization_66: BatchNormalization 139911666988592->139911666988928 139911666989264 activation_66: Activation 139911666988928->139911666989264 139911666989656 conv2d_67: Conv2D 139911666989264->139911666989656 139911666990048 batch_normalization_62: BatchNormalization 139911666989320->139911666990048 139911666990384 batch_normalization_67: BatchNormalization 139911666989656->139911666990384 139911666990664 activation_62: Activation 139911666990048->139911666990664 139911666990720 activation_67: Activation 139911666990384->139911666990720 139911666990776 conv2d_63: Conv2D 139911666990664->139911666990776 139911666069456 conv2d_68: Conv2D 139911666990720->139911666069456 139911666889168 batch_normalization_63: BatchNormalization 139911666990776->139911666889168 139911666889504 batch_normalization_68: BatchNormalization 139911666069456->139911666889504 139911666889784 activation_63: Activation 139911666889168->139911666889784 139911666889840 activation_68: Activation 139911666889504->139911666889840 139911666890400 conv2d_64: Conv2D 139911666889784->139911666890400 139911666890792 conv2d_69: Conv2D 139911666889840->139911666890792 139911666891184 conv2d_70: Conv2D 139911666889896->139911666891184 139911666891576 batch_normalization_61: BatchNormalization 139911666890064->139911666891576 139911666891912 batch_normalization_64: BatchNormalization 139911666890400->139911666891912 139911666892192 batch_normalization_69: BatchNormalization 139911666890792->139911666892192 139911666892472 batch_normalization_70: BatchNormalization 139911666891184->139911666892472 139911666990944 activation_61: Activation 139911666891576->139911666990944 139911667114056 activation_64: Activation 139911666891912->139911667114056 139911667114112 activation_69: Activation 139911666892192->139911667114112 139911667114168 activation_70: Activation 139911666892472->139911667114168 139911667114224 mixed7: Concatenate 139911666990944->139911667114224 139911667114056->139911667114224 139911667114112->139911667114224 139911667114168->139911667114224 139911667114280 conv2d_73: Conv2D 139911667114224->139911667114280 139911667115736 conv2d_71: Conv2D 139911667114224->139911667115736 139911666950776 max_pooling2d_4: MaxPooling2D 139911667114224->139911666950776 139911667114616 batch_normalization_73: BatchNormalization 139911667114280->139911667114616 139911667114952 activation_73: Activation 139911667114616->139911667114952 139911667115008 conv2d_74: Conv2D 139911667114952->139911667115008 139911667115344 batch_normalization_74: BatchNormalization 139911667115008->139911667115344 139911667115680 activation_74: Activation 139911667115344->139911667115680 139911667116072 conv2d_75: Conv2D 139911667115680->139911667116072 139911667116464 batch_normalization_71: BatchNormalization 139911667115736->139911667116464 139911667116800 batch_normalization_75: BatchNormalization 139911667116072->139911667116800 139911667117080 activation_71: Activation 139911667116464->139911667117080 139911667117136 activation_75: Activation 139911667116800->139911667117136 139911667117192 conv2d_72: Conv2D 139911667117080->139911667117192 139911667117528 conv2d_76: Conv2D 139911667117136->139911667117528 139911667117920 batch_normalization_72: BatchNormalization 139911667117192->139911667117920 139911666892752 batch_normalization_76: BatchNormalization 139911667117528->139911666892752 139911666950664 activation_72: Activation 139911667117920->139911666950664 139911666950720 activation_76: Activation 139911666892752->139911666950720 139911666950944 mixed8: Concatenate 139911666950664->139911666950944 139911666950720->139911666950944 139911666950776->139911666950944 139911666951000 conv2d_81: Conv2D 139911666950944->139911666951000 139911666951728 conv2d_78: Conv2D 139911666950944->139911666951728 139911667008008 average_pooling2d_8: AveragePooling2D 139911666950944->139911667008008 139911667008232 conv2d_77: Conv2D 139911666950944->139911667008232 139911666951336 batch_normalization_81: BatchNormalization 139911666951000->139911666951336 139911666951672 activation_81: Activation 139911666951336->139911666951672 139911666952064 conv2d_82: Conv2D 139911666951672->139911666952064 139911666952456 batch_normalization_78: BatchNormalization 139911666951728->139911666952456 139911666952792 batch_normalization_82: BatchNormalization 139911666952064->139911666952792 139911666953072 activation_78: Activation 139911666952456->139911666953072 139911666953128 activation_82: Activation 139911666952792->139911666953128 139911666953184 conv2d_79: Conv2D 139911666953072->139911666953184 139911666953520 conv2d_80: Conv2D 139911666953072->139911666953520 139911666953912 conv2d_83: Conv2D 139911666953128->139911666953912 139911667118032 conv2d_84: Conv2D 139911666953128->139911667118032 139911667008568 batch_normalization_79: BatchNormalization 139911666953184->139911667008568 139911667008904 batch_normalization_80: BatchNormalization 139911666953520->139911667008904 139911667009184 batch_normalization_83: BatchNormalization 139911666953912->139911667009184 139911667009464 batch_normalization_84: BatchNormalization 139911667118032->139911667009464 139911667009744 conv2d_85: Conv2D 139911667008008->139911667009744 139911667010080 batch_normalization_77: BatchNormalization 139911667008232->139911667010080 139911667010416 activation_79: Activation 139911667008568->139911667010416 139911667010472 activation_80: Activation 139911667008904->139911667010472 139911667010528 activation_83: Activation 139911667009184->139911667010528 139911667010584 activation_84: Activation 139911667009464->139911667010584 139911667010640 batch_normalization_85: BatchNormalization 139911667009744->139911667010640 139911667010920 activation_77: Activation 139911667010080->139911667010920 139911667010976 mixed9_0: Concatenate 139911667010416->139911667010976 139911667010472->139911667010976 139911667011032 concatenate_1: Concatenate 139911667010528->139911667011032 139911667010584->139911667011032 139911667011088 activation_85: Activation 139911667010640->139911667011088 139911667011144 mixed9: Concatenate 139911667010920->139911667011144 139911667010976->139911667011144 139911667011032->139911667011144 139911667011088->139911667011144 139911667011200 conv2d_90: Conv2D 139911667011144->139911667011200 139911667024280 conv2d_87: Conv2D 139911667011144->139911667024280 139911667027248 average_pooling2d_9: AveragePooling2D 139911667011144->139911667027248 139911667027472 conv2d_86: Conv2D 139911667011144->139911667027472 139911666954136 batch_normalization_90: BatchNormalization 139911667011200->139911666954136 139911667024224 activation_90: Activation 139911666954136->139911667024224 139911667024616 conv2d_91: Conv2D 139911667024224->139911667024616 139911667025008 batch_normalization_87: BatchNormalization 139911667024280->139911667025008 139911667025344 batch_normalization_91: BatchNormalization 139911667024616->139911667025344 139911667025624 activation_87: Activation 139911667025008->139911667025624 139911667025680 activation_91: Activation 139911667025344->139911667025680 139911667025736 conv2d_88: Conv2D 139911667025624->139911667025736 139911667026072 conv2d_89: Conv2D 139911667025624->139911667026072 139911667026464 conv2d_92: Conv2D 139911667025680->139911667026464 139911667026856 conv2d_93: Conv2D 139911667025680->139911667026856 139911667027808 batch_normalization_88: BatchNormalization 139911667025736->139911667027808 139911667011536 batch_normalization_89: BatchNormalization 139911667026072->139911667011536 139911667057160 batch_normalization_92: BatchNormalization 139911667026464->139911667057160 139911667057440 batch_normalization_93: BatchNormalization 139911667026856->139911667057440 139911667057720 conv2d_94: Conv2D 139911667027248->139911667057720 139911667058056 batch_normalization_86: BatchNormalization 139911667027472->139911667058056 139911667058392 activation_88: Activation 139911667027808->139911667058392 139911667058448 activation_89: Activation 139911667011536->139911667058448 139911667058504 activation_92: Activation 139911667057160->139911667058504 139911667058560 activation_93: Activation 139911667057440->139911667058560 139911667058616 batch_normalization_94: BatchNormalization 139911667057720->139911667058616 139911667058896 activation_86: Activation 139911667058056->139911667058896 139911667058952 mixed9_1: Concatenate 139911667058392->139911667058952 139911667058448->139911667058952 139911667059008 concatenate_2: Concatenate 139911667058504->139911667059008 139911667058560->139911667059008 139911667059064 activation_94: Activation 139911667058616->139911667059064 139911667059120 mixed10: Concatenate 139911667058896->139911667059120 139911667058952->139911667059120 139911667059008->139911667059120 139911667059064->139911667059120 139911667059176 dropout_1: Dropout 139911667059120->139911667059176 139911667103336 global_avg_pooling2: GlobalAveragePooling2D 139911667059120->139911667103336 139911667059232 global_average_pooling2d_1: GlobalAveragePooling2D 139911667059176->139911667059232 139911667059344 dropout_2: Dropout 139911667059232->139911667059344 139911667059400 batch_normalization_95: BatchNormalization 139911667059344->139911667059400 139911667059680 dense_1: Dense 139911667059400->139911667059680 139911667060016 dropout_3: Dropout 139911667059680->139911667060016 139911667060072 fc_dense1: Dense 139911667060016->139911667060072 139911667060408 fc_dense3: Dense 139911667060016->139911667060408 139911667101768 dropout1: Dropout 139911667060072->139911667101768 139911667101824 dropout3: Dropout 139911667060408->139911667101824 139911667101880 fc_batch_norm1: BatchNormalization 139911667101768->139911667101880 139911667102160 fc_batch_norm2: BatchNormalization 139911667101824->139911667102160 139911667102440 fc_dense2: Dense 139911667101880->139911667102440 139911667102776 fc_dense4: Dense 139911667102160->139911667102776 139911667103112 dropout2: Dropout 139911667102440->139911667103112 139911667103168 dropout4: Dropout 139911667102776->139911667103168 139911667103224 mixed11: Concatenate 139911667103112->139911667103224 139911667103168->139911667103224 139911667103280 dropout5: Dropout 139911667103224->139911667103280 139911667103448 fc_dense5: Dense 139911667103280->139911667103448 139911667103784 fc_dense7: Dense 139911667103336->139911667103784 139911667104120 dropout6: Dropout 139911667103448->139911667104120 139911667104176 dropout8: Dropout 139911667103784->139911667104176 139911667104232 fc_batch_norm3: BatchNormalization 139911667104120->139911667104232 139911667104512 fc_batch_norm4: BatchNormalization 139911667104176->139911667104512 139911667104792 fc_dense6: Dense 139911667104232->139911667104792 139911667105128 fc_dense8: Dense 139911667104512->139911667105128 139911667105464 dropout7: Dropout 139911667104792->139911667105464 139911667105520 dropout9: Dropout 139911667105128->139911667105520 139911667105576 mixed12: Concatenate 139911667105464->139911667105576 139911667105520->139911667105576 139911667105632 fc_dense9: Dense 139911667105576->139911667105632 139911668723952 dropout10: Dropout 139911667105632->139911668723952 139911668724008 prediction: Dense 139911668723952->139911668724008

In [ ]: