# **BMI Prediction From Human Photograph**
---

```python
!pip install ninja
!pip install git+git://github.com/stared/livelossplot.git

!git clone https://github.com/PeikeLi/Self-Correction-Human-Parsing
%cd /content/Self-Correction-Human-Parsing
!mkdir checkpoints
!mkdir inputs
!mkdir outputs
%cd /content

```

```python

import cv2
import time
import gdown
import numpy
import pandas

from pathlib import Path
from keras import backend as K
from livelossplot import PlotLossesKeras
from sklearn.model_selection import KFold

import keras
from keras import layers
from keras.models import Sequential
from keras.preprocessing import image

import matplotlib.pyplot as plt
%matplotlib inline

input_shape = (224, 224, 3)
```

## 1.Gathering Data

Datasets contains total of 2,272 images but consider as outlier 444 images so there is 1,828 images available for training and testing.

Sources:
*   Half of the data collectd from *The Photographic Height-Weight Chart* (www.height-weight-chart.com/heightweight.html) via python script.
*   Other half is celebrity body image download via python sctipt by recognites celebrity's name from their face which get from a paper "*Show me your face and I will tell you your height, weight and body mass index*" (https://hal.inria.fr/hal-01799574/document) and use their name to download their body image from Google Images.
*   A small data from *Face-to-height-weight-BMI-estimation* by abhaymise. (https://github.com/abhaymise/Face-to-height-weight-BMI-estimation-)

A data we have got is measured in Imperial system so we use:
\begin{equation}
BMI = \frac{Pound * 703}{(Foot * 12 + Inch)^2}
\end{equation}
To produce a BMI of each images.

```python

%cd /content/BMI-prediction-from-Human-Photograph

hwcd_df = pandas.read_csv("height-weight-chart_dataset.csv")
celeb_df = pandas.read_csv("celeb_datasets.csv")

df = hwcd_df.append(celeb_df, ignore_index=True)
bmi = df["weight"] * 703 / (df["foot"] * 12 + df["inch"]) ** 2

foot = df["foot"] + df["inch"] / 12
df_display = df.drop(columns=["foot", "inch"])
df_display = df_display.assign(foot=foot, bmi=bmi)
df_display.hist()
print(f"Total of datasets: {len(bmi.index)}")
print(f"Mean of BMI: {bmi.mean()}")
print(f"standard Deviation of BMI: {bmi.std()}")

df.assign(bmi=bmi)

```

## 2.Preparing the data

We are preparing the data by using *Self Correction for Human Parsing* (https://github.com/PeikeLi/Self-Correction-Human-Parsing) by only extract a human body from raw dataset which the result of this model has shown below.

      Original Image:

      Preprocessed Image using a model:

And we use a preprocessed image as a filter to get rid of the background by convert all of its colors pixel to 1 and multiply them to original image.

      Filter Image:

      Labeled Image:

Then we resize a labeled image to 244 x 244 x 3 to suit the Resnet152 recommend input tensor.

```python

# def rgb2gray(rgb):
#     return numpy.dot(rgb[..., :3], [0.2989, 0.5870, 0.1140])

def preprocess_df(x, y):
  x = x.reset_index()
  X = []
  Y = []
  for i in range(x.shape[0]):

    image_filename = Path(x['image_filename'][i]).stem

    raw_filepath = 'raw_datasets/' + image_filename + ".jpg"
    preprocessed_filepath = 'raw_datasets_preprocessed/' + image_filename + ".png"
    if not Path(raw_filepath).is_file():
      raw_filepath = 'celeb_datasets/' + image_filename + ".jpg"
      preprocessed_filepath = 'celeb_datasets_preprocessed/' + image_filename + ".png"

    if Path(raw_filepath).is_file() and Path(preprocessed_filepath).is_file():
      raw_img = image.load_img(raw_filepath, target_size=(600, 400))
      raw_img = image.img_to_array(raw_img)
      preprocessed_img = image.load_img(preprocessed_filepath, target_size=(600, 400))
      preprocessed_img = image.img_to_array(preprocessed_img)

      preprocessed_img[preprocessed_img[:,:,0] > 0] = 1
      preprocessed_img[preprocessed_img[:,:,1] > 0] = 1
      preprocessed_img[preprocessed_img[:,:,2] > 0] = 1
      # img[numpy.all(img == (128, 128, 128), axis=-1)] = (0, 0, 128) # replace gray with blue
      # img[numpy.all(img == (0, 64, 0), axis=-1)] = (0, 0, 0) # replace green with black
      # img[numpy.all(img == (128, 0, 128), axis=-1)] = (0, 128, 128) # replace purple with cyan
      # img = rgb2gray(img).reshape(input_shape)

      # plt.imshow((raw_img * preprocessed_img).astype(int))
      # break

      X.append(cv2.resize(raw_img * preprocessed_img, (input_shape[0], input_shape[1])))
      Y.append(y.iloc[i])

  X = numpy.array(X)
  Y = numpy.array(Y)
  return [X, Y]

start = time.clock()
X, Y = preprocess_df(df, bmi)
end = time.clock()
print(f"{end - start:.2f} seconds process time")

```

    /usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:44: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead

    46.61 seconds process time

    /usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:46: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead

### Data Normalization and Augmentation

We use ImageDataGenerator to normalize a labeled and to be augmented by rotating, shifting and horizontal flipling.

```python

train_datagen = image.ImageDataGenerator(
  samplewise_center=True,
  rotation_range=2,
  width_shift_range=0.02,
  # height_shift_range=0.02,
  # shear_range=0.02,
  # zoom_range=0.02,
  horizontal_flip=True
)
j = 0
for batch in train_datagen.flow(X, batch_size=5):
  for b in batch:
    plt.figure(j)
    plt.imshow(image.array_to_img(b))
    j += 1
  break

test_datagen = image.ImageDataGenerator(
  samplewise_center=True,
)
```

## 3.Choosing a model

* From the experiments, we decide to use ResNet152 for the best results.
* We use pre-trained weight called "imagenet" to initialize a model.
* By using it, we mean that we use it for extract a feature of human from an image so we freeze an entire model and feed an output to Fully-Connected Layer.
* A Fully-Connected Layer contains 256 neurons and using ReLu function as activation function.
* We use dropout layer with probability 0.25
* An output layer consist of only one neuron which uses linear activation function.

```python
base_model = keras.applications.ResNet152(
    include_top=False,
    weights="imagenet",
    input_shape=input_shape,
    pooling="avg"
)

base_model.trainable = False
base_model.summary()
```

    Downloading data from https://storage.googleapis.com/tensorflow/keras-applications/resnet/resnet152_weights_tf_dim_ordering_tf_kernels_notop.h5
    234700800/234698864 [==============================] - 4s 0us/step
    Model: "resnet152"
    __________________________________________________________________________________________________
    Layer (type)                    Output Shape         Param #     Connected to
    ==================================================================================================
    input_1 (InputLayer)            [(None, 224, 224, 3) 0
    __________________________________________________________________________________________________
    conv1_pad (ZeroPadding2D)       (None, 230, 230, 3)  0           input_1[0][0]
    __________________________________________________________________________________________________
    conv1_conv (Conv2D)             (None, 112, 112, 64) 9472        conv1_pad[0][0]
    __________________________________________________________________________________________________
    conv1_bn (BatchNormalization)   (None, 112, 112, 64) 256         conv1_conv[0][0]
    __________________________________________________________________________________________________
    conv1_relu (Activation)         (None, 112, 112, 64) 0           conv1_bn[0][0]
    __________________________________________________________________________________________________
    pool1_pad (ZeroPadding2D)       (None, 114, 114, 64) 0           conv1_relu[0][0]
    __________________________________________________________________________________________________
    pool1_pool (MaxPooling2D)       (None, 56, 56, 64)   0           pool1_pad[0][0]
    __________________________________________________________________________________________________
    conv2_block1_1_conv (Conv2D)    (None, 56, 56, 64)   4160        pool1_pool[0][0]
    __________________________________________________________________________________________________
    conv2_block1_1_bn (BatchNormali (None, 56, 56, 64)   256         conv2_block1_1_conv[0][0]
    __________________________________________________________________________________________________
    conv2_block1_1_relu (Activation (None, 56, 56, 64)   0           conv2_block1_1_bn[0][0]
    __________________________________________________________________________________________________
    conv2_block1_2_conv (Conv2D)    (None, 56, 56, 64)   36928       conv2_block1_1_relu[0][0]
    __________________________________________________________________________________________________
    conv2_block1_2_bn (BatchNormali (None, 56, 56, 64)   256         conv2_block1_2_conv[0][0]
    __________________________________________________________________________________________________
    conv2_block1_2_relu (Activation (None, 56, 56, 64)   0           conv2_block1_2_bn[0][0]
    __________________________________________________________________________________________________
    conv2_block1_0_conv (Conv2D)    (None, 56, 56, 256)  16640       pool1_pool[0][0]
    __________________________________________________________________________________________________
    conv2_block1_3_conv (Conv2D)    (None, 56, 56, 256)  16640       conv2_block1_2_relu[0][0]
    __________________________________________________________________________________________________
    conv2_block1_0_bn (BatchNormali (None, 56, 56, 256)  1024        conv2_block1_0_conv[0][0]
    __________________________________________________________________________________________________
    conv2_block1_3_bn (BatchNormali (None, 56, 56, 256)  1024        conv2_block1_3_conv[0][0]
    __________________________________________________________________________________________________
    conv2_block1_add (Add)          (None, 56, 56, 256)  0           conv2_block1_0_bn[0][0]
                                                                     conv2_block1_3_bn[0][0]
    __________________________________________________________________________________________________
    conv2_block1_out (Activation)   (None, 56, 56, 256)  0           conv2_block1_add[0][0]
    __________________________________________________________________________________________________
    conv2_block2_1_conv (Conv2D)    (None, 56, 56, 64)   16448       conv2_block1_out[0][0]
    __________________________________________________________________________________________________
    conv2_block2_1_bn (BatchNormali (None, 56, 56, 64)   256         conv2_block2_1_conv[0][0]
    __________________________________________________________________________________________________
    conv2_block2_1_relu (Activation (None, 56, 56, 64)   0           conv2_block2_1_bn[0][0]
    __________________________________________________________________________________________________
    conv2_block2_2_conv (Conv2D)    (None, 56, 56, 64)   36928       conv2_block2_1_relu[0][0]
    __________________________________________________________________________________________________
    conv2_block2_2_bn (BatchNormali (None, 56, 56, 64)   256         conv2_block2_2_conv[0][0]
    __________________________________________________________________________________________________
    conv2_block2_2_relu (Activation (None, 56, 56, 64)   0           conv2_block2_2_bn[0][0]
    __________________________________________________________________________________________________
    conv2_block2_3_conv (Conv2D)    (None, 56, 56, 256)  16640       conv2_block2_2_relu[0][0]
    __________________________________________________________________________________________________
    conv2_block2_3_bn (BatchNormali (None, 56, 56, 256)  1024        conv2_block2_3_conv[0][0]
    __________________________________________________________________________________________________
    conv2_block2_add (Add)          (None, 56, 56, 256)  0           conv2_block1_out[0][0]
                                                                     conv2_block2_3_bn[0][0]
    __________________________________________________________________________________________________
    conv2_block2_out (Activation)   (None, 56, 56, 256)  0           conv2_block2_add[0][0]
    __________________________________________________________________________________________________
    conv2_block3_1_conv (Conv2D)    (None, 56, 56, 64)   16448       conv2_block2_out[0][0]
    __________________________________________________________________________________________________
    conv2_block3_1_bn (BatchNormali (None, 56, 56, 64)   256         conv2_block3_1_conv[0][0]
    __________________________________________________________________________________________________
    conv2_block3_1_relu (Activation (None, 56, 56, 64)   0           conv2_block3_1_bn[0][0]
    __________________________________________________________________________________________________
    conv2_block3_2_conv (Conv2D)    (None, 56, 56, 64)   36928       conv2_block3_1_relu[0][0]
    __________________________________________________________________________________________________
    conv2_block3_2_bn (BatchNormali (None, 56, 56, 64)   256         conv2_block3_2_conv[0][0]
    __________________________________________________________________________________________________
    conv2_block3_2_relu (Activation (None, 56, 56, 64)   0           conv2_block3_2_bn[0][0]
    __________________________________________________________________________________________________
    conv2_block3_3_conv (Conv2D)    (None, 56, 56, 256)  16640       conv2_block3_2_relu[0][0]
    __________________________________________________________________________________________________
    conv2_block3_3_bn (BatchNormali (None, 56, 56, 256)  1024        conv2_block3_3_conv[0][0]
    __________________________________________________________________________________________________
    conv2_block3_add (Add)          (None, 56, 56, 256)  0           conv2_block2_out[0][0]
                                                                     conv2_block3_3_bn[0][0]
    __________________________________________________________________________________________________
    conv2_block3_out (Activation)   (None, 56, 56, 256)  0           conv2_block3_add[0][0]
    __________________________________________________________________________________________________
    conv3_block1_1_conv (Conv2D)    (None, 28, 28, 128)  32896       conv2_block3_out[0][0]
    __________________________________________________________________________________________________
    conv3_block1_1_bn (BatchNormali (None, 28, 28, 128)  512         conv3_block1_1_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block1_1_relu (Activation (None, 28, 28, 128)  0           conv3_block1_1_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block1_2_conv (Conv2D)    (None, 28, 28, 128)  147584      conv3_block1_1_relu[0][0]
    __________________________________________________________________________________________________
    conv3_block1_2_bn (BatchNormali (None, 28, 28, 128)  512         conv3_block1_2_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block1_2_relu (Activation (None, 28, 28, 128)  0           conv3_block1_2_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block1_0_conv (Conv2D)    (None, 28, 28, 512)  131584      conv2_block3_out[0][0]
    __________________________________________________________________________________________________
    conv3_block1_3_conv (Conv2D)    (None, 28, 28, 512)  66048       conv3_block1_2_relu[0][0]
    __________________________________________________________________________________________________
    conv3_block1_0_bn (BatchNormali (None, 28, 28, 512)  2048        conv3_block1_0_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block1_3_bn (BatchNormali (None, 28, 28, 512)  2048        conv3_block1_3_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block1_add (Add)          (None, 28, 28, 512)  0           conv3_block1_0_bn[0][0]
                                                                     conv3_block1_3_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block1_out (Activation)   (None, 28, 28, 512)  0           conv3_block1_add[0][0]
    __________________________________________________________________________________________________
    conv3_block2_1_conv (Conv2D)    (None, 28, 28, 128)  65664       conv3_block1_out[0][0]
    __________________________________________________________________________________________________
    conv3_block2_1_bn (BatchNormali (None, 28, 28, 128)  512         conv3_block2_1_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block2_1_relu (Activation (None, 28, 28, 128)  0           conv3_block2_1_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block2_2_conv (Conv2D)    (None, 28, 28, 128)  147584      conv3_block2_1_relu[0][0]
    __________________________________________________________________________________________________
    conv3_block2_2_bn (BatchNormali (None, 28, 28, 128)  512         conv3_block2_2_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block2_2_relu (Activation (None, 28, 28, 128)  0           conv3_block2_2_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block2_3_conv (Conv2D)    (None, 28, 28, 512)  66048       conv3_block2_2_relu[0][0]
    __________________________________________________________________________________________________
    conv3_block2_3_bn (BatchNormali (None, 28, 28, 512)  2048        conv3_block2_3_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block2_add (Add)          (None, 28, 28, 512)  0           conv3_block1_out[0][0]
                                                                     conv3_block2_3_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block2_out (Activation)   (None, 28, 28, 512)  0           conv3_block2_add[0][0]
    __________________________________________________________________________________________________
    conv3_block3_1_conv (Conv2D)    (None, 28, 28, 128)  65664       conv3_block2_out[0][0]
    __________________________________________________________________________________________________
    conv3_block3_1_bn (BatchNormali (None, 28, 28, 128)  512         conv3_block3_1_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block3_1_relu (Activation (None, 28, 28, 128)  0           conv3_block3_1_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block3_2_conv (Conv2D)    (None, 28, 28, 128)  147584      conv3_block3_1_relu[0][0]
    __________________________________________________________________________________________________
    conv3_block3_2_bn (BatchNormali (None, 28, 28, 128)  512         conv3_block3_2_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block3_2_relu (Activation (None, 28, 28, 128)  0           conv3_block3_2_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block3_3_conv (Conv2D)    (None, 28, 28, 512)  66048       conv3_block3_2_relu[0][0]
    __________________________________________________________________________________________________
    conv3_block3_3_bn (BatchNormali (None, 28, 28, 512)  2048        conv3_block3_3_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block3_add (Add)          (None, 28, 28, 512)  0           conv3_block2_out[0][0]
                                                                     conv3_block3_3_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block3_out (Activation)   (None, 28, 28, 512)  0           conv3_block3_add[0][0]
    __________________________________________________________________________________________________
    conv3_block4_1_conv (Conv2D)    (None, 28, 28, 128)  65664       conv3_block3_out[0][0]
    __________________________________________________________________________________________________
    conv3_block4_1_bn (BatchNormali (None, 28, 28, 128)  512         conv3_block4_1_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block4_1_relu (Activation (None, 28, 28, 128)  0           conv3_block4_1_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block4_2_conv (Conv2D)    (None, 28, 28, 128)  147584      conv3_block4_1_relu[0][0]
    __________________________________________________________________________________________________
    conv3_block4_2_bn (BatchNormali (None, 28, 28, 128)  512         conv3_block4_2_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block4_2_relu (Activation (None, 28, 28, 128)  0           conv3_block4_2_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block4_3_conv (Conv2D)    (None, 28, 28, 512)  66048       conv3_block4_2_relu[0][0]
    __________________________________________________________________________________________________
    conv3_block4_3_bn (BatchNormali (None, 28, 28, 512)  2048        conv3_block4_3_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block4_add (Add)          (None, 28, 28, 512)  0           conv3_block3_out[0][0]
                                                                     conv3_block4_3_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block4_out (Activation)   (None, 28, 28, 512)  0           conv3_block4_add[0][0]
    __________________________________________________________________________________________________
    conv3_block5_1_conv (Conv2D)    (None, 28, 28, 128)  65664       conv3_block4_out[0][0]
    __________________________________________________________________________________________________
    conv3_block5_1_bn (BatchNormali (None, 28, 28, 128)  512         conv3_block5_1_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block5_1_relu (Activation (None, 28, 28, 128)  0           conv3_block5_1_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block5_2_conv (Conv2D)    (None, 28, 28, 128)  147584      conv3_block5_1_relu[0][0]
    __________________________________________________________________________________________________
    conv3_block5_2_bn (BatchNormali (None, 28, 28, 128)  512         conv3_block5_2_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block5_2_relu (Activation (None, 28, 28, 128)  0           conv3_block5_2_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block5_3_conv (Conv2D)    (None, 28, 28, 512)  66048       conv3_block5_2_relu[0][0]
    __________________________________________________________________________________________________
    conv3_block5_3_bn (BatchNormali (None, 28, 28, 512)  2048        conv3_block5_3_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block5_add (Add)          (None, 28, 28, 512)  0           conv3_block4_out[0][0]
                                                                     conv3_block5_3_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block5_out (Activation)   (None, 28, 28, 512)  0           conv3_block5_add[0][0]
    __________________________________________________________________________________________________
    conv3_block6_1_conv (Conv2D)    (None, 28, 28, 128)  65664       conv3_block5_out[0][0]
    __________________________________________________________________________________________________
    conv3_block6_1_bn (BatchNormali (None, 28, 28, 128)  512         conv3_block6_1_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block6_1_relu (Activation (None, 28, 28, 128)  0           conv3_block6_1_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block6_2_conv (Conv2D)    (None, 28, 28, 128)  147584      conv3_block6_1_relu[0][0]
    __________________________________________________________________________________________________
    conv3_block6_2_bn (BatchNormali (None, 28, 28, 128)  512         conv3_block6_2_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block6_2_relu (Activation (None, 28, 28, 128)  0           conv3_block6_2_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block6_3_conv (Conv2D)    (None, 28, 28, 512)  66048       conv3_block6_2_relu[0][0]
    __________________________________________________________________________________________________
    conv3_block6_3_bn (BatchNormali (None, 28, 28, 512)  2048        conv3_block6_3_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block6_add (Add)          (None, 28, 28, 512)  0           conv3_block5_out[0][0]
                                                                     conv3_block6_3_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block6_out (Activation)   (None, 28, 28, 512)  0           conv3_block6_add[0][0]
    __________________________________________________________________________________________________
    conv3_block7_1_conv (Conv2D)    (None, 28, 28, 128)  65664       conv3_block6_out[0][0]
    __________________________________________________________________________________________________
    conv3_block7_1_bn (BatchNormali (None, 28, 28, 128)  512         conv3_block7_1_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block7_1_relu (Activation (None, 28, 28, 128)  0           conv3_block7_1_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block7_2_conv (Conv2D)    (None, 28, 28, 128)  147584      conv3_block7_1_relu[0][0]
    __________________________________________________________________________________________________
    conv3_block7_2_bn (BatchNormali (None, 28, 28, 128)  512         conv3_block7_2_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block7_2_relu (Activation (None, 28, 28, 128)  0           conv3_block7_2_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block7_3_conv (Conv2D)    (None, 28, 28, 512)  66048       conv3_block7_2_relu[0][0]
    __________________________________________________________________________________________________
    conv3_block7_3_bn (BatchNormali (None, 28, 28, 512)  2048        conv3_block7_3_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block7_add (Add)          (None, 28, 28, 512)  0           conv3_block6_out[0][0]
                                                                     conv3_block7_3_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block7_out (Activation)   (None, 28, 28, 512)  0           conv3_block7_add[0][0]
    __________________________________________________________________________________________________
    conv3_block8_1_conv (Conv2D)    (None, 28, 28, 128)  65664       conv3_block7_out[0][0]
    __________________________________________________________________________________________________
    conv3_block8_1_bn (BatchNormali (None, 28, 28, 128)  512         conv3_block8_1_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block8_1_relu (Activation (None, 28, 28, 128)  0           conv3_block8_1_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block8_2_conv (Conv2D)    (None, 28, 28, 128)  147584      conv3_block8_1_relu[0][0]
    __________________________________________________________________________________________________
    conv3_block8_2_bn (BatchNormali (None, 28, 28, 128)  512         conv3_block8_2_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block8_2_relu (Activation (None, 28, 28, 128)  0           conv3_block8_2_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block8_3_conv (Conv2D)    (None, 28, 28, 512)  66048       conv3_block8_2_relu[0][0]
    __________________________________________________________________________________________________
    conv3_block8_3_bn (BatchNormali (None, 28, 28, 512)  2048        conv3_block8_3_conv[0][0]
    __________________________________________________________________________________________________
    conv3_block8_add (Add)          (None, 28, 28, 512)  0           conv3_block7_out[0][0]
                                                                     conv3_block8_3_bn[0][0]
    __________________________________________________________________________________________________
    conv3_block8_out (Activation)   (None, 28, 28, 512)  0           conv3_block8_add[0][0]
    __________________________________________________________________________________________________
    conv4_block1_1_conv (Conv2D)    (None, 14, 14, 256)  131328      conv3_block8_out[0][0]
    __________________________________________________________________________________________________
    conv4_block1_1_bn (BatchNormali (None, 14, 14, 256)  1024        conv4_block1_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block1_1_relu (Activation (None, 14, 14, 256)  0           conv4_block1_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block1_2_conv (Conv2D)    (None, 14, 14, 256)  590080      conv4_block1_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block1_2_bn (BatchNormali (None, 14, 14, 256)  1024        conv4_block1_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block1_2_relu (Activation (None, 14, 14, 256)  0           conv4_block1_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block1_0_conv (Conv2D)    (None, 14, 14, 1024) 525312      conv3_block8_out[0][0]
    __________________________________________________________________________________________________
    conv4_block1_3_conv (Conv2D)    (None, 14, 14, 1024) 263168      conv4_block1_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block1_0_bn (BatchNormali (None, 14, 14, 1024) 4096        conv4_block1_0_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block1_3_bn (BatchNormali (None, 14, 14, 1024) 4096        conv4_block1_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block1_add (Add)          (None, 14, 14, 1024) 0           conv4_block1_0_bn[0][0]
                                                                     conv4_block1_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block1_out (Activation)   (None, 14, 14, 1024) 0           conv4_block1_add[0][0]
    __________________________________________________________________________________________________
    conv4_block2_1_conv (Conv2D)    (None, 14, 14, 256)  262400      conv4_block1_out[0][0]
    __________________________________________________________________________________________________
    conv4_block2_1_bn (BatchNormali (None, 14, 14, 256)  1024        conv4_block2_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block2_1_relu (Activation (None, 14, 14, 256)  0           conv4_block2_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block2_2_conv (Conv2D)    (None, 14, 14, 256)  590080      conv4_block2_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block2_2_bn (BatchNormali (None, 14, 14, 256)  1024        conv4_block2_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block2_2_relu (Activation (None, 14, 14, 256)  0           conv4_block2_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block2_3_conv (Conv2D)    (None, 14, 14, 1024) 263168      conv4_block2_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block2_3_bn (BatchNormali (None, 14, 14, 1024) 4096        conv4_block2_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block2_add (Add)          (None, 14, 14, 1024) 0           conv4_block1_out[0][0]
                                                                     conv4_block2_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block2_out (Activation)   (None, 14, 14, 1024) 0           conv4_block2_add[0][0]
    __________________________________________________________________________________________________
    conv4_block3_1_conv (Conv2D)    (None, 14, 14, 256)  262400      conv4_block2_out[0][0]
    __________________________________________________________________________________________________
    conv4_block3_1_bn (BatchNormali (None, 14, 14, 256)  1024        conv4_block3_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block3_1_relu (Activation (None, 14, 14, 256)  0           conv4_block3_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block3_2_conv (Conv2D)    (None, 14, 14, 256)  590080      conv4_block3_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block3_2_bn (BatchNormali (None, 14, 14, 256)  1024        conv4_block3_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block3_2_relu (Activation (None, 14, 14, 256)  0           conv4_block3_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block3_3_conv (Conv2D)    (None, 14, 14, 1024) 263168      conv4_block3_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block3_3_bn (BatchNormali (None, 14, 14, 1024) 4096        conv4_block3_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block3_add (Add)          (None, 14, 14, 1024) 0           conv4_block2_out[0][0]
                                                                     conv4_block3_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block3_out (Activation)   (None, 14, 14, 1024) 0           conv4_block3_add[0][0]
    __________________________________________________________________________________________________
    conv4_block4_1_conv (Conv2D)    (None, 14, 14, 256)  262400      conv4_block3_out[0][0]
    __________________________________________________________________________________________________
    conv4_block4_1_bn (BatchNormali (None, 14, 14, 256)  1024        conv4_block4_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block4_1_relu (Activation (None, 14, 14, 256)  0           conv4_block4_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block4_2_conv (Conv2D)    (None, 14, 14, 256)  590080      conv4_block4_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block4_2_bn (BatchNormali (None, 14, 14, 256)  1024        conv4_block4_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block4_2_relu (Activation (None, 14, 14, 256)  0           conv4_block4_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block4_3_conv (Conv2D)    (None, 14, 14, 1024) 263168      conv4_block4_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block4_3_bn (BatchNormali (None, 14, 14, 1024) 4096        conv4_block4_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block4_add (Add)          (None, 14, 14, 1024) 0           conv4_block3_out[0][0]
                                                                     conv4_block4_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block4_out (Activation)   (None, 14, 14, 1024) 0           conv4_block4_add[0][0]
    __________________________________________________________________________________________________
    conv4_block5_1_conv (Conv2D)    (None, 14, 14, 256)  262400      conv4_block4_out[0][0]
    __________________________________________________________________________________________________
    conv4_block5_1_bn (BatchNormali (None, 14, 14, 256)  1024        conv4_block5_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block5_1_relu (Activation (None, 14, 14, 256)  0           conv4_block5_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block5_2_conv (Conv2D)    (None, 14, 14, 256)  590080      conv4_block5_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block5_2_bn (BatchNormali (None, 14, 14, 256)  1024        conv4_block5_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block5_2_relu (Activation (None, 14, 14, 256)  0           conv4_block5_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block5_3_conv (Conv2D)    (None, 14, 14, 1024) 263168      conv4_block5_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block5_3_bn (BatchNormali (None, 14, 14, 1024) 4096        conv4_block5_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block5_add (Add)          (None, 14, 14, 1024) 0           conv4_block4_out[0][0]
                                                                     conv4_block5_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block5_out (Activation)   (None, 14, 14, 1024) 0           conv4_block5_add[0][0]
    __________________________________________________________________________________________________
    conv4_block6_1_conv (Conv2D)    (None, 14, 14, 256)  262400      conv4_block5_out[0][0]
    __________________________________________________________________________________________________
    conv4_block6_1_bn (BatchNormali (None, 14, 14, 256)  1024        conv4_block6_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block6_1_relu (Activation (None, 14, 14, 256)  0           conv4_block6_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block6_2_conv (Conv2D)    (None, 14, 14, 256)  590080      conv4_block6_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block6_2_bn (BatchNormali (None, 14, 14, 256)  1024        conv4_block6_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block6_2_relu (Activation (None, 14, 14, 256)  0           conv4_block6_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block6_3_conv (Conv2D)    (None, 14, 14, 1024) 263168      conv4_block6_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block6_3_bn (BatchNormali (None, 14, 14, 1024) 4096        conv4_block6_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block6_add (Add)          (None, 14, 14, 1024) 0           conv4_block5_out[0][0]
                                                                     conv4_block6_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block6_out (Activation)   (None, 14, 14, 1024) 0           conv4_block6_add[0][0]
    __________________________________________________________________________________________________
    conv4_block7_1_conv (Conv2D)    (None, 14, 14, 256)  262400      conv4_block6_out[0][0]
    __________________________________________________________________________________________________
    conv4_block7_1_bn (BatchNormali (None, 14, 14, 256)  1024        conv4_block7_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block7_1_relu (Activation (None, 14, 14, 256)  0           conv4_block7_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block7_2_conv (Conv2D)    (None, 14, 14, 256)  590080      conv4_block7_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block7_2_bn (BatchNormali (None, 14, 14, 256)  1024        conv4_block7_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block7_2_relu (Activation (None, 14, 14, 256)  0           conv4_block7_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block7_3_conv (Conv2D)    (None, 14, 14, 1024) 263168      conv4_block7_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block7_3_bn (BatchNormali (None, 14, 14, 1024) 4096        conv4_block7_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block7_add (Add)          (None, 14, 14, 1024) 0           conv4_block6_out[0][0]
                                                                     conv4_block7_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block7_out (Activation)   (None, 14, 14, 1024) 0           conv4_block7_add[0][0]
    __________________________________________________________________________________________________
    conv4_block8_1_conv (Conv2D)    (None, 14, 14, 256)  262400      conv4_block7_out[0][0]
    __________________________________________________________________________________________________
    conv4_block8_1_bn (BatchNormali (None, 14, 14, 256)  1024        conv4_block8_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block8_1_relu (Activation (None, 14, 14, 256)  0           conv4_block8_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block8_2_conv (Conv2D)    (None, 14, 14, 256)  590080      conv4_block8_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block8_2_bn (BatchNormali (None, 14, 14, 256)  1024        conv4_block8_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block8_2_relu (Activation (None, 14, 14, 256)  0           conv4_block8_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block8_3_conv (Conv2D)    (None, 14, 14, 1024) 263168      conv4_block8_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block8_3_bn (BatchNormali (None, 14, 14, 1024) 4096        conv4_block8_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block8_add (Add)          (None, 14, 14, 1024) 0           conv4_block7_out[0][0]
                                                                     conv4_block8_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block8_out (Activation)   (None, 14, 14, 1024) 0           conv4_block8_add[0][0]
    __________________________________________________________________________________________________
    conv4_block9_1_conv (Conv2D)    (None, 14, 14, 256)  262400      conv4_block8_out[0][0]
    __________________________________________________________________________________________________
    conv4_block9_1_bn (BatchNormali (None, 14, 14, 256)  1024        conv4_block9_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block9_1_relu (Activation (None, 14, 14, 256)  0           conv4_block9_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block9_2_conv (Conv2D)    (None, 14, 14, 256)  590080      conv4_block9_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block9_2_bn (BatchNormali (None, 14, 14, 256)  1024        conv4_block9_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block9_2_relu (Activation (None, 14, 14, 256)  0           conv4_block9_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block9_3_conv (Conv2D)    (None, 14, 14, 1024) 263168      conv4_block9_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block9_3_bn (BatchNormali (None, 14, 14, 1024) 4096        conv4_block9_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block9_add (Add)          (None, 14, 14, 1024) 0           conv4_block8_out[0][0]
                                                                     conv4_block9_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block9_out (Activation)   (None, 14, 14, 1024) 0           conv4_block9_add[0][0]
    __________________________________________________________________________________________________
    conv4_block10_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block9_out[0][0]
    __________________________________________________________________________________________________
    conv4_block10_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block10_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block10_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block10_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block10_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block10_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block10_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block10_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block10_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block10_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block10_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block10_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block10_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block10_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block10_add (Add)         (None, 14, 14, 1024) 0           conv4_block9_out[0][0]
                                                                     conv4_block10_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block10_out (Activation)  (None, 14, 14, 1024) 0           conv4_block10_add[0][0]
    __________________________________________________________________________________________________
    conv4_block11_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block10_out[0][0]
    __________________________________________________________________________________________________
    conv4_block11_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block11_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block11_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block11_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block11_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block11_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block11_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block11_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block11_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block11_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block11_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block11_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block11_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block11_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block11_add (Add)         (None, 14, 14, 1024) 0           conv4_block10_out[0][0]
                                                                     conv4_block11_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block11_out (Activation)  (None, 14, 14, 1024) 0           conv4_block11_add[0][0]
    __________________________________________________________________________________________________
    conv4_block12_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block11_out[0][0]
    __________________________________________________________________________________________________
    conv4_block12_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block12_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block12_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block12_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block12_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block12_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block12_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block12_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block12_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block12_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block12_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block12_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block12_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block12_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block12_add (Add)         (None, 14, 14, 1024) 0           conv4_block11_out[0][0]
                                                                     conv4_block12_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block12_out (Activation)  (None, 14, 14, 1024) 0           conv4_block12_add[0][0]
    __________________________________________________________________________________________________
    conv4_block13_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block12_out[0][0]
    __________________________________________________________________________________________________
    conv4_block13_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block13_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block13_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block13_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block13_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block13_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block13_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block13_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block13_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block13_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block13_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block13_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block13_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block13_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block13_add (Add)         (None, 14, 14, 1024) 0           conv4_block12_out[0][0]
                                                                     conv4_block13_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block13_out (Activation)  (None, 14, 14, 1024) 0           conv4_block13_add[0][0]
    __________________________________________________________________________________________________
    conv4_block14_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block13_out[0][0]
    __________________________________________________________________________________________________
    conv4_block14_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block14_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block14_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block14_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block14_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block14_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block14_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block14_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block14_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block14_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block14_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block14_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block14_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block14_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block14_add (Add)         (None, 14, 14, 1024) 0           conv4_block13_out[0][0]
                                                                     conv4_block14_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block14_out (Activation)  (None, 14, 14, 1024) 0           conv4_block14_add[0][0]
    __________________________________________________________________________________________________
    conv4_block15_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block14_out[0][0]
    __________________________________________________________________________________________________
    conv4_block15_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block15_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block15_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block15_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block15_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block15_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block15_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block15_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block15_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block15_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block15_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block15_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block15_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block15_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block15_add (Add)         (None, 14, 14, 1024) 0           conv4_block14_out[0][0]
                                                                     conv4_block15_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block15_out (Activation)  (None, 14, 14, 1024) 0           conv4_block15_add[0][0]
    __________________________________________________________________________________________________
    conv4_block16_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block15_out[0][0]
    __________________________________________________________________________________________________
    conv4_block16_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block16_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block16_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block16_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block16_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block16_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block16_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block16_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block16_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block16_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block16_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block16_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block16_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block16_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block16_add (Add)         (None, 14, 14, 1024) 0           conv4_block15_out[0][0]
                                                                     conv4_block16_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block16_out (Activation)  (None, 14, 14, 1024) 0           conv4_block16_add[0][0]
    __________________________________________________________________________________________________
    conv4_block17_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block16_out[0][0]
    __________________________________________________________________________________________________
    conv4_block17_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block17_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block17_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block17_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block17_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block17_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block17_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block17_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block17_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block17_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block17_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block17_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block17_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block17_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block17_add (Add)         (None, 14, 14, 1024) 0           conv4_block16_out[0][0]
                                                                     conv4_block17_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block17_out (Activation)  (None, 14, 14, 1024) 0           conv4_block17_add[0][0]
    __________________________________________________________________________________________________
    conv4_block18_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block17_out[0][0]
    __________________________________________________________________________________________________
    conv4_block18_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block18_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block18_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block18_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block18_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block18_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block18_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block18_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block18_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block18_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block18_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block18_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block18_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block18_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block18_add (Add)         (None, 14, 14, 1024) 0           conv4_block17_out[0][0]
                                                                     conv4_block18_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block18_out (Activation)  (None, 14, 14, 1024) 0           conv4_block18_add[0][0]
    __________________________________________________________________________________________________
    conv4_block19_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block18_out[0][0]
    __________________________________________________________________________________________________
    conv4_block19_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block19_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block19_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block19_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block19_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block19_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block19_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block19_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block19_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block19_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block19_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block19_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block19_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block19_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block19_add (Add)         (None, 14, 14, 1024) 0           conv4_block18_out[0][0]
                                                                     conv4_block19_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block19_out (Activation)  (None, 14, 14, 1024) 0           conv4_block19_add[0][0]
    __________________________________________________________________________________________________
    conv4_block20_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block19_out[0][0]
    __________________________________________________________________________________________________
    conv4_block20_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block20_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block20_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block20_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block20_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block20_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block20_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block20_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block20_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block20_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block20_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block20_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block20_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block20_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block20_add (Add)         (None, 14, 14, 1024) 0           conv4_block19_out[0][0]
                                                                     conv4_block20_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block20_out (Activation)  (None, 14, 14, 1024) 0           conv4_block20_add[0][0]
    __________________________________________________________________________________________________
    conv4_block21_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block20_out[0][0]
    __________________________________________________________________________________________________
    conv4_block21_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block21_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block21_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block21_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block21_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block21_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block21_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block21_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block21_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block21_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block21_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block21_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block21_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block21_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block21_add (Add)         (None, 14, 14, 1024) 0           conv4_block20_out[0][0]
                                                                     conv4_block21_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block21_out (Activation)  (None, 14, 14, 1024) 0           conv4_block21_add[0][0]
    __________________________________________________________________________________________________
    conv4_block22_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block21_out[0][0]
    __________________________________________________________________________________________________
    conv4_block22_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block22_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block22_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block22_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block22_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block22_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block22_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block22_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block22_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block22_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block22_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block22_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block22_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block22_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block22_add (Add)         (None, 14, 14, 1024) 0           conv4_block21_out[0][0]
                                                                     conv4_block22_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block22_out (Activation)  (None, 14, 14, 1024) 0           conv4_block22_add[0][0]
    __________________________________________________________________________________________________
    conv4_block23_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block22_out[0][0]
    __________________________________________________________________________________________________
    conv4_block23_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block23_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block23_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block23_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block23_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block23_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block23_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block23_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block23_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block23_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block23_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block23_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block23_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block23_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block23_add (Add)         (None, 14, 14, 1024) 0           conv4_block22_out[0][0]
                                                                     conv4_block23_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block23_out (Activation)  (None, 14, 14, 1024) 0           conv4_block23_add[0][0]
    __________________________________________________________________________________________________
    conv4_block24_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block23_out[0][0]
    __________________________________________________________________________________________________
    conv4_block24_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block24_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block24_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block24_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block24_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block24_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block24_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block24_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block24_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block24_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block24_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block24_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block24_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block24_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block24_add (Add)         (None, 14, 14, 1024) 0           conv4_block23_out[0][0]
                                                                     conv4_block24_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block24_out (Activation)  (None, 14, 14, 1024) 0           conv4_block24_add[0][0]
    __________________________________________________________________________________________________
    conv4_block25_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block24_out[0][0]
    __________________________________________________________________________________________________
    conv4_block25_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block25_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block25_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block25_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block25_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block25_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block25_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block25_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block25_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block25_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block25_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block25_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block25_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block25_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block25_add (Add)         (None, 14, 14, 1024) 0           conv4_block24_out[0][0]
                                                                     conv4_block25_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block25_out (Activation)  (None, 14, 14, 1024) 0           conv4_block25_add[0][0]
    __________________________________________________________________________________________________
    conv4_block26_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block25_out[0][0]
    __________________________________________________________________________________________________
    conv4_block26_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block26_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block26_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block26_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block26_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block26_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block26_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block26_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block26_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block26_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block26_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block26_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block26_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block26_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block26_add (Add)         (None, 14, 14, 1024) 0           conv4_block25_out[0][0]
                                                                     conv4_block26_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block26_out (Activation)  (None, 14, 14, 1024) 0           conv4_block26_add[0][0]
    __________________________________________________________________________________________________
    conv4_block27_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block26_out[0][0]
    __________________________________________________________________________________________________
    conv4_block27_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block27_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block27_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block27_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block27_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block27_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block27_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block27_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block27_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block27_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block27_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block27_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block27_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block27_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block27_add (Add)         (None, 14, 14, 1024) 0           conv4_block26_out[0][0]
                                                                     conv4_block27_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block27_out (Activation)  (None, 14, 14, 1024) 0           conv4_block27_add[0][0]
    __________________________________________________________________________________________________
    conv4_block28_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block27_out[0][0]
    __________________________________________________________________________________________________
    conv4_block28_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block28_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block28_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block28_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block28_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block28_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block28_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block28_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block28_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block28_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block28_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block28_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block28_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block28_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block28_add (Add)         (None, 14, 14, 1024) 0           conv4_block27_out[0][0]
                                                                     conv4_block28_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block28_out (Activation)  (None, 14, 14, 1024) 0           conv4_block28_add[0][0]
    __________________________________________________________________________________________________
    conv4_block29_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block28_out[0][0]
    __________________________________________________________________________________________________
    conv4_block29_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block29_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block29_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block29_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block29_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block29_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block29_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block29_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block29_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block29_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block29_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block29_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block29_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block29_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block29_add (Add)         (None, 14, 14, 1024) 0           conv4_block28_out[0][0]
                                                                     conv4_block29_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block29_out (Activation)  (None, 14, 14, 1024) 0           conv4_block29_add[0][0]
    __________________________________________________________________________________________________
    conv4_block30_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block29_out[0][0]
    __________________________________________________________________________________________________
    conv4_block30_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block30_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block30_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block30_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block30_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block30_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block30_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block30_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block30_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block30_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block30_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block30_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block30_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block30_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block30_add (Add)         (None, 14, 14, 1024) 0           conv4_block29_out[0][0]
                                                                     conv4_block30_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block30_out (Activation)  (None, 14, 14, 1024) 0           conv4_block30_add[0][0]
    __________________________________________________________________________________________________
    conv4_block31_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block30_out[0][0]
    __________________________________________________________________________________________________
    conv4_block31_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block31_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block31_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block31_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block31_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block31_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block31_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block31_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block31_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block31_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block31_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block31_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block31_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block31_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block31_add (Add)         (None, 14, 14, 1024) 0           conv4_block30_out[0][0]
                                                                     conv4_block31_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block31_out (Activation)  (None, 14, 14, 1024) 0           conv4_block31_add[0][0]
    __________________________________________________________________________________________________
    conv4_block32_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block31_out[0][0]
    __________________________________________________________________________________________________
    conv4_block32_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block32_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block32_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block32_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block32_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block32_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block32_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block32_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block32_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block32_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block32_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block32_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block32_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block32_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block32_add (Add)         (None, 14, 14, 1024) 0           conv4_block31_out[0][0]
                                                                     conv4_block32_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block32_out (Activation)  (None, 14, 14, 1024) 0           conv4_block32_add[0][0]
    __________________________________________________________________________________________________
    conv4_block33_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block32_out[0][0]
    __________________________________________________________________________________________________
    conv4_block33_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block33_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block33_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block33_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block33_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block33_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block33_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block33_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block33_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block33_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block33_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block33_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block33_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block33_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block33_add (Add)         (None, 14, 14, 1024) 0           conv4_block32_out[0][0]
                                                                     conv4_block33_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block33_out (Activation)  (None, 14, 14, 1024) 0           conv4_block33_add[0][0]
    __________________________________________________________________________________________________
    conv4_block34_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block33_out[0][0]
    __________________________________________________________________________________________________
    conv4_block34_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block34_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block34_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block34_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block34_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block34_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block34_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block34_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block34_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block34_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block34_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block34_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block34_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block34_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block34_add (Add)         (None, 14, 14, 1024) 0           conv4_block33_out[0][0]
                                                                     conv4_block34_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block34_out (Activation)  (None, 14, 14, 1024) 0           conv4_block34_add[0][0]
    __________________________________________________________________________________________________
    conv4_block35_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block34_out[0][0]
    __________________________________________________________________________________________________
    conv4_block35_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block35_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block35_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block35_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block35_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block35_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block35_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block35_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block35_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block35_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block35_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block35_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block35_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block35_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block35_add (Add)         (None, 14, 14, 1024) 0           conv4_block34_out[0][0]
                                                                     conv4_block35_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block35_out (Activation)  (None, 14, 14, 1024) 0           conv4_block35_add[0][0]
    __________________________________________________________________________________________________
    conv4_block36_1_conv (Conv2D)   (None, 14, 14, 256)  262400      conv4_block35_out[0][0]
    __________________________________________________________________________________________________
    conv4_block36_1_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block36_1_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block36_1_relu (Activatio (None, 14, 14, 256)  0           conv4_block36_1_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block36_2_conv (Conv2D)   (None, 14, 14, 256)  590080      conv4_block36_1_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block36_2_bn (BatchNormal (None, 14, 14, 256)  1024        conv4_block36_2_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block36_2_relu (Activatio (None, 14, 14, 256)  0           conv4_block36_2_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block36_3_conv (Conv2D)   (None, 14, 14, 1024) 263168      conv4_block36_2_relu[0][0]
    __________________________________________________________________________________________________
    conv4_block36_3_bn (BatchNormal (None, 14, 14, 1024) 4096        conv4_block36_3_conv[0][0]
    __________________________________________________________________________________________________
    conv4_block36_add (Add)         (None, 14, 14, 1024) 0           conv4_block35_out[0][0]
                                                                     conv4_block36_3_bn[0][0]
    __________________________________________________________________________________________________
    conv4_block36_out (Activation)  (None, 14, 14, 1024) 0           conv4_block36_add[0][0]
    __________________________________________________________________________________________________
    conv5_block1_1_conv (Conv2D)    (None, 7, 7, 512)    524800      conv4_block36_out[0][0]
    __________________________________________________________________________________________________
    conv5_block1_1_bn (BatchNormali (None, 7, 7, 512)    2048        conv5_block1_1_conv[0][0]
    __________________________________________________________________________________________________
    conv5_block1_1_relu (Activation (None, 7, 7, 512)    0           conv5_block1_1_bn[0][0]
    __________________________________________________________________________________________________
    conv5_block1_2_conv (Conv2D)    (None, 7, 7, 512)    2359808     conv5_block1_1_relu[0][0]
    __________________________________________________________________________________________________
    conv5_block1_2_bn (BatchNormali (None, 7, 7, 512)    2048        conv5_block1_2_conv[0][0]
    __________________________________________________________________________________________________
    conv5_block1_2_relu (Activation (None, 7, 7, 512)    0           conv5_block1_2_bn[0][0]
    __________________________________________________________________________________________________
    conv5_block1_0_conv (Conv2D)    (None, 7, 7, 2048)   2099200     conv4_block36_out[0][0]
    __________________________________________________________________________________________________
    conv5_block1_3_conv (Conv2D)    (None, 7, 7, 2048)   1050624     conv5_block1_2_relu[0][0]
    __________________________________________________________________________________________________
    conv5_block1_0_bn (BatchNormali (None, 7, 7, 2048)   8192        conv5_block1_0_conv[0][0]
    __________________________________________________________________________________________________
    conv5_block1_3_bn (BatchNormali (None, 7, 7, 2048)   8192        conv5_block1_3_conv[0][0]
    __________________________________________________________________________________________________
    conv5_block1_add (Add)          (None, 7, 7, 2048)   0           conv5_block1_0_bn[0][0]
                                                                     conv5_block1_3_bn[0][0]
    __________________________________________________________________________________________________
    conv5_block1_out (Activation)   (None, 7, 7, 2048)   0           conv5_block1_add[0][0]
    __________________________________________________________________________________________________
    conv5_block2_1_conv (Conv2D)    (None, 7, 7, 512)    1049088     conv5_block1_out[0][0]
    __________________________________________________________________________________________________
    conv5_block2_1_bn (BatchNormali (None, 7, 7, 512)    2048        conv5_block2_1_conv[0][0]
    __________________________________________________________________________________________________
    conv5_block2_1_relu (Activation (None, 7, 7, 512)    0           conv5_block2_1_bn[0][0]
    __________________________________________________________________________________________________
    conv5_block2_2_conv (Conv2D)    (None, 7, 7, 512)    2359808     conv5_block2_1_relu[0][0]
    __________________________________________________________________________________________________
    conv5_block2_2_bn (BatchNormali (None, 7, 7, 512)    2048        conv5_block2_2_conv[0][0]
    __________________________________________________________________________________________________
    conv5_block2_2_relu (Activation (None, 7, 7, 512)    0           conv5_block2_2_bn[0][0]
    __________________________________________________________________________________________________
    conv5_block2_3_conv (Conv2D)    (None, 7, 7, 2048)   1050624     conv5_block2_2_relu[0][0]
    __________________________________________________________________________________________________
    conv5_block2_3_bn (BatchNormali (None, 7, 7, 2048)   8192        conv5_block2_3_conv[0][0]
    __________________________________________________________________________________________________
    conv5_block2_add (Add)          (None, 7, 7, 2048)   0           conv5_block1_out[0][0]
                                                                     conv5_block2_3_bn[0][0]
    __________________________________________________________________________________________________
    conv5_block2_out (Activation)   (None, 7, 7, 2048)   0           conv5_block2_add[0][0]
    __________________________________________________________________________________________________
    conv5_block3_1_conv (Conv2D)    (None, 7, 7, 512)    1049088     conv5_block2_out[0][0]
    __________________________________________________________________________________________________
    conv5_block3_1_bn (BatchNormali (None, 7, 7, 512)    2048        conv5_block3_1_conv[0][0]
    __________________________________________________________________________________________________
    conv5_block3_1_relu (Activation (None, 7, 7, 512)    0           conv5_block3_1_bn[0][0]
    __________________________________________________________________________________________________
    conv5_block3_2_conv (Conv2D)    (None, 7, 7, 512)    2359808     conv5_block3_1_relu[0][0]
    __________________________________________________________________________________________________
    conv5_block3_2_bn (BatchNormali (None, 7, 7, 512)    2048        conv5_block3_2_conv[0][0]
    __________________________________________________________________________________________________
    conv5_block3_2_relu (Activation (None, 7, 7, 512)    0           conv5_block3_2_bn[0][0]
    __________________________________________________________________________________________________
    conv5_block3_3_conv (Conv2D)    (None, 7, 7, 2048)   1050624     conv5_block3_2_relu[0][0]
    __________________________________________________________________________________________________
    conv5_block3_3_bn (BatchNormali (None, 7, 7, 2048)   8192        conv5_block3_3_conv[0][0]
    __________________________________________________________________________________________________
    conv5_block3_add (Add)          (None, 7, 7, 2048)   0           conv5_block2_out[0][0]
                                                                     conv5_block3_3_bn[0][0]
    __________________________________________________________________________________________________
    conv5_block3_out (Activation)   (None, 7, 7, 2048)   0           conv5_block3_add[0][0]
    __________________________________________________________________________________________________
    avg_pool (GlobalAveragePooling2 (None, 2048)         0           conv5_block3_out[0][0]
    ==================================================================================================
    Total params: 58,370,944
    Trainable params: 0
    Non-trainable params: 58,370,944
    __________________________________________________________________________________________________

### Extract Features

* We use k-fold cross validation to train a model by we choose k=5 and in the meanwhile, we do a features extraction before initialize our own model.
* We keep all 5 fold in the list called train_features, train_labels, test_features and test_labels for not to repeated it.

```python
batch_size=32
def extract_features(x, y, sample_count, datagen):
    features = numpy.zeros(shape=(sample_count, 2048))
    labels = numpy.zeros(shape=(sample_count))
    generator = datagen.flow(
        x, y,
        batch_size=batch_size
    )
    total = 0
    left_index = 0
    for inputs_batch, labels_batch in generator:
        features_batch = base_model.predict(inputs_batch)
        gap = features_batch.shape[0]
        total += gap
        gap_diff = total - sample_count
        gap_diff = gap_diff if gap_diff > 0 else 0
        features[left_index : left_index + (gap-gap_diff)] = features_batch[0:gap-gap_diff]
        labels[left_index : left_index + (gap-gap_diff)] = labels_batch[0:gap-gap_diff]
        left_index += gap
        if total >= sample_count:
            # Note that since generators yield data indefinitely in a loop,
            # we must `break` after every image has been seen once.
            break
    return features, labels

train_features = [None]*5
train_labels = [None]*5
test_features = [None]*5
test_labels = [None]*5

k = 0
kf = KFold(n_splits=5, shuffle=True)
for train_index, test_index in kf.split(X):
  X_train, Y_train, X_test, Y_test = X[train_index], Y[train_index], X[test_index], Y[test_index]

  print(f"Extract features from fold number {k+1}")
  start = time.clock()
  train_features[k], train_labels[k] = extract_features(X_train, Y_train, 2000, datagen=train_datagen)
  test_features[k], test_labels[k] = extract_features(X_test, Y_test, 2000, datagen=test_datagen)
  end = time.clock()
  print(f"Finished with {end - start:.2f} seconds process time")
  k += 1
```

    Extract features from fold number 1

    /usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:37: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
    /usr/local/lib/python3.7/dist-packages/ipykernel_launcher.py:40: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead

    Finished with 102.62 seconds process time
    Extract features from fold number 2
    Finished with 91.60 seconds process time
    Extract features from fold number 3
    Finished with 91.55 seconds process time
    Extract features from fold number 4
    Finished with 91.74 seconds process time
    Extract features from fold number 5
    Finished with 91.96 seconds process time

## 4.Training
* Optimizer: The stochastic gradient descent (SGD) algorithm.
* Learning Rate: Start from 1e-5 and then we use the learning rate decay policy, which is implemented as follows:
\begin{equation}
LR = LR_{Base} (1 + \gamma * epoch)^{-power}
\end{equation}
where γ is 0.001 and power is 0.75. We use a momentum of 0.9
* Loss function: Huber function
* Metrics: Huber, Mean Absolute Error and R Squared

```python
def coeff_determination(y_true, y_pred):
    SS_res =  K.sum(K.square( y_true-y_pred ))
    SS_tot = K.sum(K.square( y_true - K.mean(y_true) ) )
    return ( 1 - SS_res/(SS_tot + K.epsilon()) )

def lr_scheduler(epoch, lr):
   return 1e-5 * (1 + 0.001 * epoch) ** (-0.75)
```

```python

VALIDAITON_LOSS = []

for j in range(5):
  model = Sequential()
  model.add(layers.Dense(256, activation='relu', input_dim=2048))
  model.add(layers.Dropout(0.25))
  model.add(layers.Dense(1, activation='linear'))

  model.compile(optimizer=keras.optimizers.SGD(
      learning_rate=1e-5,
      momentum=0.9
  ), loss=keras.losses.Huber(), metrics=["mean_absolute_error", coeff_determination])

  history = model.fit(train_features[j], train_labels[j], epochs=500,
    validation_data=(test_features[j], test_labels[j]),
    verbose=2,
    callbacks=[
          PlotLossesKeras(),
          keras.callbacks.LearningRateScheduler(lr_scheduler),
    ]
  )
  model.save(f"last_model{j}.h5")

  results = model.evaluate(test_features[j], test_labels[j])
  VALIDAITON_LOSS.append(results)

# plt.plot(history.history['loss'])
# plt.plot(history.history['val_loss'])
# plt.title('model loss')
# plt.ylabel('loss')
# plt.xlabel('epoch')
# plt.legend(['train', 'val'], loc='upper left')
# axes = plt.gca()
# axes.set_xlim([0, 25])
# plt.show()

# history = model.fit(train_datagen.flow(x_train, y_train, batch_size=16),
#                     epochs=1000,
#                     validation_data=test_datagen.flow(x_test, y_test, batch_size=32),
#                     verbose=2,
#                     callbacks=[
#                           PlotLossesKeras(),
#                           keras.callbacks.LearningRateScheduler(lr_scheduler),
#                           # keras.callbacks.EarlyStopping(
#                           #     monitor='val_loss',
#                           #     patience=5,
#                           #     restore_best_weights=True
#                           # )
#                     ]
# )

```

## 5.Evaluvate

[Huber loss, MAE, R Squared] of all 5-folds

```python
VALIDAITON_LOSS

```

    [[3.7254703044891357, 4.192523956298828, 0.2898770868778229],
     [3.853140115737915, 4.323094844818115, 0.3603218197822571],
     [3.4870858192443848, 3.9460318088531494, 0.3224889934062958],
     [3.5555806159973145, 4.03022575378418, 0.2583730220794678],
     [4.191390514373779, 4.6717939376831055, 0.23626717925071716]]

## 6.Test with your photo!

We have selected the best model which MAE is equal to 4.053

```python

%cd /content/Self-Correction-Human-Parsing
atr_dataset_url = 'https://drive.google.com/uc?id=1ruJg4lqR_jgQPj-9K0PP-L2vJERYOxLP'
gdown.download(atr_dataset_url, 'checkpoints/atr.pth', quiet=False)
```

    /content/Self-Correction-Human-Parsing

    Downloading...
    From: https://drive.google.com/uc?id=1ruJg4lqR_jgQPj-9K0PP-L2vJERYOxLP
    To: /content/Self-Correction-Human-Parsing/checkpoints/atr.pth
    267MB [00:04, 59.9MB/s]

    'checkpoints/atr.pth'

```python
%cd /content/Self-Correction-Human-Parsing/inputs
from google.colab import files
uploaded = files.upload()
```

    /content/Self-Correction-Human-Parsing/inputs

<input type="file" id="files-4c00dc67-6f81-489b-8df8-d4e42845fd4b" name="files[]" multiple disabled
   style="border:none" />
<output id="result-4c00dc67-6f81-489b-8df8-d4e42845fd4b">
 Upload widget is only available when the cell has been executed in the
 current browser session. Please rerun this cell to enable.
 </output>

    Saving skinny-person.jpg to skinny-person.jpg

```python
%cd /content/Self-Correction-Human-Parsing
!python3 simple_extractor.py --dataset 'atr' --model-restore 'checkpoints/atr.pth' --input-dir 'inputs' --output-dir 'outputs'

input_filename = Path(next(iter(uploaded))).stem

raw_input_image = cv2.imread("inputs/" +  next(iter(uploaded)))
raw_input_image = cv2.cvtColor(raw_input_image, cv2.COLOR_BGR2RGB)
raw_input_image = cv2.resize(raw_input_image, (input_shape[0], input_shape[1]))
plt.figure(0)
plt.imshow(raw_input_image)

preprocessed_input_image = image.load_img("outputs/" +  input_filename + ".png", target_size=input_shape)
preprocessed_input_image = image.img_to_array(preprocessed_input_image)
plt.figure(1)
plt.imshow(preprocessed_input_image.astype(int))

plt.figure(2)
preprocessed_input_image[preprocessed_input_image[:,:,0] > 0] = 1
preprocessed_input_image[preprocessed_input_image[:,:,1] > 0] = 1
preprocessed_input_image[preprocessed_input_image[:,:,2] > 0] = 1
plt.imshow(preprocessed_input_image)

plt.figure(3)
final_input_image = raw_input_image * preprocessed_input_image
plt.imshow(final_input_image.astype(int))

```

```python

test_datagen = image.ImageDataGenerator(
  samplewise_center=True,
)

generator = test_datagen.flow(
    numpy.expand_dims(final_input_image, axis=0),
    batch_size=1
)
features_batch = base_model.predict(generator)

dependencies = {
    'coeff_determination': coeff_determination
}
model = keras.models.load_model('/content/3.935_model.h5', custom_objects=dependencies)
preds = model.predict(features_batch)
bmi_pred = preds[0][0]
print(f"BMI: {bmi_pred}")
if bmi_pred < 15:
  print("Very severely underweight")
elif 15 <= bmi_pred < 16:
  print("Severely underweight")
elif 16 <= bmi_pred < 18.5:
  print("Underweight")
elif 18.5 <= bmi_pred < 25:
  print("Normal")
elif 25 <= bmi_pred < 30:
  print("Overweight")
elif 30 <= bmi_pred < 35:
  print("Moderately obese")
elif 35 <= bmi_pred < 40:
  print("Severely obese")
elif bmi_pred >= 40:
  print("Very severely obese")

```

    BMI: 16.805139541625977
    Underweight

**References**

- Self-Correction for Human Parsing (https://arxiv.org/pdf/1910.09777.pdf)

- Show me your face and I will tell you your height,
weight and body mass index (https://hal.inria.fr/hal-01799574/document)

- Estimation of Body Mass Index from
Photographs using Deep Convolutional Neural
Networks (https://arxiv.org/pdf/1908.11694v1.pdf)