import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F

__weights_dict = dict()

def load_weights(weight_file):
    if weight_file == None:
        return

    try:
        weights_dict = np.load(weight_file).item()
    except:
        weights_dict = np.load(weight_file, encoding='bytes').item()

    return weights_dict

class KitModel(nn.Module):

    def __init__(self, weight_file):
        super(KitModel, self).__init__()
        global __weights_dict
        __weights_dict = load_weights(weight_file)

        self.MobilenetV2_Conv_Conv2D = self.__conv(2, name='MobilenetV2/Conv/Conv2D', in_channels=3, out_channels=32, kernel_size=(3, 3), stride=(2, 2), groups=1, bias=None)
        self.MobilenetV2_Conv_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/Conv/BatchNorm/FusedBatchNorm', num_features=32, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_depthwise_depthwise = self.__conv(2, name='MobilenetV2/expanded_conv/depthwise/depthwise', in_channels=32, out_channels=32, kernel_size=(3, 3), stride=(1, 1), groups=32, bias=None)
        self.MobilenetV2_expanded_conv_depthwise_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv/depthwise/BatchNorm/FusedBatchNorm', num_features=32, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_project_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv/project/Conv2D', in_channels=32, out_channels=16, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_project_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv/project/BatchNorm/FusedBatchNorm', num_features=16, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_1_expand_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_1/expand/Conv2D', in_channels=16, out_channels=96, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_1_expand_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_1/expand/BatchNorm/FusedBatchNorm', num_features=96, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_1_depthwise_depthwise = self.__conv(2, name='MobilenetV2/expanded_conv_1/depthwise/depthwise', in_channels=96, out_channels=96, kernel_size=(3, 3), stride=(2, 2), groups=96, bias=None)
        self.MobilenetV2_expanded_conv_1_depthwise_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_1/depthwise/BatchNorm/FusedBatchNorm', num_features=96, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_1_project_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_1/project/Conv2D', in_channels=96, out_channels=24, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_1_project_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_1/project/BatchNorm/FusedBatchNorm', num_features=24, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_2_expand_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_2/expand/Conv2D', in_channels=24, out_channels=144, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_2_expand_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_2/expand/BatchNorm/FusedBatchNorm', num_features=144, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_2_depthwise_depthwise = self.__conv(2, name='MobilenetV2/expanded_conv_2/depthwise/depthwise', in_channels=144, out_channels=144, kernel_size=(3, 3), stride=(1, 1), groups=144, bias=None)
        self.MobilenetV2_expanded_conv_2_depthwise_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_2/depthwise/BatchNorm/FusedBatchNorm', num_features=144, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_2_project_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_2/project/Conv2D', in_channels=144, out_channels=24, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_2_project_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_2/project/BatchNorm/FusedBatchNorm', num_features=24, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_3_expand_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_3/expand/Conv2D', in_channels=24, out_channels=144, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_3_expand_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_3/expand/BatchNorm/FusedBatchNorm', num_features=144, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_3_depthwise_depthwise = self.__conv(2, name='MobilenetV2/expanded_conv_3/depthwise/depthwise', in_channels=144, out_channels=144, kernel_size=(3, 3), stride=(2, 2), groups=144, bias=None)
        self.MobilenetV2_expanded_conv_3_depthwise_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_3/depthwise/BatchNorm/FusedBatchNorm', num_features=144, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_3_project_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_3/project/Conv2D', in_channels=144, out_channels=32, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_3_project_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_3/project/BatchNorm/FusedBatchNorm', num_features=32, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_4_expand_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_4/expand/Conv2D', in_channels=32, out_channels=192, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_4_expand_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_4/expand/BatchNorm/FusedBatchNorm', num_features=192, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_4_depthwise_depthwise = self.__conv(2, name='MobilenetV2/expanded_conv_4/depthwise/depthwise', in_channels=192, out_channels=192, kernel_size=(3, 3), stride=(1, 1), groups=192, bias=None)
        self.MobilenetV2_expanded_conv_4_depthwise_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_4/depthwise/BatchNorm/FusedBatchNorm', num_features=192, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_4_project_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_4/project/Conv2D', in_channels=192, out_channels=32, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_4_project_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_4/project/BatchNorm/FusedBatchNorm', num_features=32, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_5_expand_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_5/expand/Conv2D', in_channels=32, out_channels=192, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_5_expand_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_5/expand/BatchNorm/FusedBatchNorm', num_features=192, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_5_depthwise_depthwise = self.__conv(2, name='MobilenetV2/expanded_conv_5/depthwise/depthwise', in_channels=192, out_channels=192, kernel_size=(3, 3), stride=(1, 1), groups=192, bias=None)
        self.MobilenetV2_expanded_conv_5_depthwise_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_5/depthwise/BatchNorm/FusedBatchNorm', num_features=192, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_5_project_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_5/project/Conv2D', in_channels=192, out_channels=32, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_5_project_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_5/project/BatchNorm/FusedBatchNorm', num_features=32, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_6_expand_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_6/expand/Conv2D', in_channels=32, out_channels=192, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_6_expand_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_6/expand/BatchNorm/FusedBatchNorm', num_features=192, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_6_depthwise_depthwise = self.__conv(2, name='MobilenetV2/expanded_conv_6/depthwise/depthwise', in_channels=192, out_channels=192, kernel_size=(3, 3), stride=(2, 2), groups=192, bias=None)
        self.MobilenetV2_expanded_conv_6_depthwise_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_6/depthwise/BatchNorm/FusedBatchNorm', num_features=192, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_6_project_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_6/project/Conv2D', in_channels=192, out_channels=64, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_6_project_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_6/project/BatchNorm/FusedBatchNorm', num_features=64, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_7_expand_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_7/expand/Conv2D', in_channels=64, out_channels=384, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_7_expand_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_7/expand/BatchNorm/FusedBatchNorm', num_features=384, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_7_depthwise_depthwise = self.__conv(2, name='MobilenetV2/expanded_conv_7/depthwise/depthwise', in_channels=384, out_channels=384, kernel_size=(3, 3), stride=(1, 1), groups=384, bias=None)
        self.MobilenetV2_expanded_conv_7_depthwise_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_7/depthwise/BatchNorm/FusedBatchNorm', num_features=384, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_7_project_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_7/project/Conv2D', in_channels=384, out_channels=64, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_7_project_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_7/project/BatchNorm/FusedBatchNorm', num_features=64, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_8_expand_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_8/expand/Conv2D', in_channels=64, out_channels=384, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_8_expand_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_8/expand/BatchNorm/FusedBatchNorm', num_features=384, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_8_depthwise_depthwise = self.__conv(2, name='MobilenetV2/expanded_conv_8/depthwise/depthwise', in_channels=384, out_channels=384, kernel_size=(3, 3), stride=(1, 1), groups=384, bias=None)
        self.MobilenetV2_expanded_conv_8_depthwise_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_8/depthwise/BatchNorm/FusedBatchNorm', num_features=384, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_8_project_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_8/project/Conv2D', in_channels=384, out_channels=64, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_8_project_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_8/project/BatchNorm/FusedBatchNorm', num_features=64, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_9_expand_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_9/expand/Conv2D', in_channels=64, out_channels=384, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_9_expand_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_9/expand/BatchNorm/FusedBatchNorm', num_features=384, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_9_depthwise_depthwise = self.__conv(2, name='MobilenetV2/expanded_conv_9/depthwise/depthwise', in_channels=384, out_channels=384, kernel_size=(3, 3), stride=(1, 1), groups=384, bias=None)
        self.MobilenetV2_expanded_conv_9_depthwise_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_9/depthwise/BatchNorm/FusedBatchNorm', num_features=384, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_9_project_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_9/project/Conv2D', in_channels=384, out_channels=64, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_9_project_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_9/project/BatchNorm/FusedBatchNorm', num_features=64, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_10_expand_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_10/expand/Conv2D', in_channels=64, out_channels=384, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_10_expand_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_10/expand/BatchNorm/FusedBatchNorm', num_features=384, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_10_depthwise_depthwise = self.__conv(2, name='MobilenetV2/expanded_conv_10/depthwise/depthwise', in_channels=384, out_channels=384, kernel_size=(3, 3), stride=(1, 1), groups=384, bias=None)
        self.MobilenetV2_expanded_conv_10_depthwise_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_10/depthwise/BatchNorm/FusedBatchNorm', num_features=384, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_10_project_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_10/project/Conv2D', in_channels=384, out_channels=96, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_10_project_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_10/project/BatchNorm/FusedBatchNorm', num_features=96, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_11_expand_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_11/expand/Conv2D', in_channels=96, out_channels=576, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_11_expand_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_11/expand/BatchNorm/FusedBatchNorm', num_features=576, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_11_depthwise_depthwise = self.__conv(2, name='MobilenetV2/expanded_conv_11/depthwise/depthwise', in_channels=576, out_channels=576, kernel_size=(3, 3), stride=(1, 1), groups=576, bias=None)
        self.MobilenetV2_expanded_conv_11_depthwise_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_11/depthwise/BatchNorm/FusedBatchNorm', num_features=576, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_11_project_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_11/project/Conv2D', in_channels=576, out_channels=96, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_11_project_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_11/project/BatchNorm/FusedBatchNorm', num_features=96, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_12_expand_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_12/expand/Conv2D', in_channels=96, out_channels=576, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_12_expand_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_12/expand/BatchNorm/FusedBatchNorm', num_features=576, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_12_depthwise_depthwise = self.__conv(2, name='MobilenetV2/expanded_conv_12/depthwise/depthwise', in_channels=576, out_channels=576, kernel_size=(3, 3), stride=(1, 1), groups=576, bias=None)
        self.MobilenetV2_expanded_conv_12_depthwise_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_12/depthwise/BatchNorm/FusedBatchNorm', num_features=576, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_12_project_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_12/project/Conv2D', in_channels=576, out_channels=96, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_12_project_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_12/project/BatchNorm/FusedBatchNorm', num_features=96, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_13_expand_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_13/expand/Conv2D', in_channels=96, out_channels=576, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_13_expand_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_13/expand/BatchNorm/FusedBatchNorm', num_features=576, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_13_depthwise_depthwise = self.__conv(2, name='MobilenetV2/expanded_conv_13/depthwise/depthwise', in_channels=576, out_channels=576, kernel_size=(3, 3), stride=(2, 2), groups=576, bias=None)
        self.MobilenetV2_expanded_conv_13_depthwise_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_13/depthwise/BatchNorm/FusedBatchNorm', num_features=576, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_13_project_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_13/project/Conv2D', in_channels=576, out_channels=160, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_13_project_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_13/project/BatchNorm/FusedBatchNorm', num_features=160, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_14_expand_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_14/expand/Conv2D', in_channels=160, out_channels=960, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_14_expand_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_14/expand/BatchNorm/FusedBatchNorm', num_features=960, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_14_depthwise_depthwise = self.__conv(2, name='MobilenetV2/expanded_conv_14/depthwise/depthwise', in_channels=960, out_channels=960, kernel_size=(3, 3), stride=(1, 1), groups=960, bias=None)
        self.MobilenetV2_expanded_conv_14_depthwise_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_14/depthwise/BatchNorm/FusedBatchNorm', num_features=960, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_14_project_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_14/project/Conv2D', in_channels=960, out_channels=160, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_14_project_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_14/project/BatchNorm/FusedBatchNorm', num_features=160, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_15_expand_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_15/expand/Conv2D', in_channels=160, out_channels=960, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_15_expand_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_15/expand/BatchNorm/FusedBatchNorm', num_features=960, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_15_depthwise_depthwise = self.__conv(2, name='MobilenetV2/expanded_conv_15/depthwise/depthwise', in_channels=960, out_channels=960, kernel_size=(3, 3), stride=(1, 1), groups=960, bias=None)
        self.MobilenetV2_expanded_conv_15_depthwise_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_15/depthwise/BatchNorm/FusedBatchNorm', num_features=960, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_15_project_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_15/project/Conv2D', in_channels=960, out_channels=160, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_15_project_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_15/project/BatchNorm/FusedBatchNorm', num_features=160, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_16_expand_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_16/expand/Conv2D', in_channels=160, out_channels=960, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_16_expand_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_16/expand/BatchNorm/FusedBatchNorm', num_features=960, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_16_depthwise_depthwise = self.__conv(2, name='MobilenetV2/expanded_conv_16/depthwise/depthwise', in_channels=960, out_channels=960, kernel_size=(3, 3), stride=(1, 1), groups=960, bias=None)
        self.MobilenetV2_expanded_conv_16_depthwise_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_16/depthwise/BatchNorm/FusedBatchNorm', num_features=960, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_expanded_conv_16_project_Conv2D = self.__conv(2, name='MobilenetV2/expanded_conv_16/project/Conv2D', in_channels=960, out_channels=320, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_expanded_conv_16_project_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/expanded_conv_16/project/BatchNorm/FusedBatchNorm', num_features=320, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_Conv_1_Conv2D = self.__conv(2, name='MobilenetV2/Conv_1/Conv2D', in_channels=320, out_channels=1280, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=None)
        self.MobilenetV2_Conv_1_BatchNorm_FusedBatchNorm = self.__batch_normalization(2, 'MobilenetV2/Conv_1/BatchNorm/FusedBatchNorm', num_features=1280, eps=0.0010000000474974513, momentum=0.0)
        self.MobilenetV2_Logits_Conv2d_1c_1x1_Conv2D = self.__conv(2, name='MobilenetV2/Logits/Conv2d_1c_1x1/Conv2D', in_channels=1280, out_channels=1001, kernel_size=(1, 1), stride=(1, 1), groups=1, bias=True)

    def forward(self, x):
        MobilenetV2_Conv_Conv2D_pad = F.pad(x, (0, 1, 0, 1))
        MobilenetV2_Conv_Conv2D = self.MobilenetV2_Conv_Conv2D(MobilenetV2_Conv_Conv2D_pad)
        MobilenetV2_Conv_BatchNorm_FusedBatchNorm = self.MobilenetV2_Conv_BatchNorm_FusedBatchNorm(MobilenetV2_Conv_Conv2D)
        MobilenetV2_Conv_Relu6 = F.relu6(MobilenetV2_Conv_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_depthwise_depthwise_pad = F.pad(MobilenetV2_Conv_Relu6, (1, 1, 1, 1))
        MobilenetV2_expanded_conv_depthwise_depthwise = self.MobilenetV2_expanded_conv_depthwise_depthwise(MobilenetV2_expanded_conv_depthwise_depthwise_pad)
        MobilenetV2_expanded_conv_depthwise_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_depthwise_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_depthwise_depthwise)
        MobilenetV2_expanded_conv_depthwise_Relu6 = F.relu6(MobilenetV2_expanded_conv_depthwise_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_project_Conv2D = self.MobilenetV2_expanded_conv_project_Conv2D(MobilenetV2_expanded_conv_depthwise_Relu6)
        MobilenetV2_expanded_conv_project_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_project_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_project_Conv2D)
        MobilenetV2_expanded_conv_1_expand_Conv2D = self.MobilenetV2_expanded_conv_1_expand_Conv2D(MobilenetV2_expanded_conv_project_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_1_expand_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_1_expand_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_1_expand_Conv2D)
        MobilenetV2_expanded_conv_1_expand_Relu6 = F.relu6(MobilenetV2_expanded_conv_1_expand_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_1_depthwise_depthwise_pad = F.pad(MobilenetV2_expanded_conv_1_expand_Relu6, (0, 1, 0, 1))
        MobilenetV2_expanded_conv_1_depthwise_depthwise = self.MobilenetV2_expanded_conv_1_depthwise_depthwise(MobilenetV2_expanded_conv_1_depthwise_depthwise_pad)
        MobilenetV2_expanded_conv_1_depthwise_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_1_depthwise_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_1_depthwise_depthwise)
        MobilenetV2_expanded_conv_1_depthwise_Relu6 = F.relu6(MobilenetV2_expanded_conv_1_depthwise_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_1_project_Conv2D = self.MobilenetV2_expanded_conv_1_project_Conv2D(MobilenetV2_expanded_conv_1_depthwise_Relu6)
        MobilenetV2_expanded_conv_1_project_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_1_project_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_1_project_Conv2D)
        MobilenetV2_expanded_conv_2_expand_Conv2D = self.MobilenetV2_expanded_conv_2_expand_Conv2D(MobilenetV2_expanded_conv_1_project_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_2_expand_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_2_expand_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_2_expand_Conv2D)
        MobilenetV2_expanded_conv_2_expand_Relu6 = F.relu6(MobilenetV2_expanded_conv_2_expand_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_2_depthwise_depthwise_pad = F.pad(MobilenetV2_expanded_conv_2_expand_Relu6, (1, 1, 1, 1))
        MobilenetV2_expanded_conv_2_depthwise_depthwise = self.MobilenetV2_expanded_conv_2_depthwise_depthwise(MobilenetV2_expanded_conv_2_depthwise_depthwise_pad)
        MobilenetV2_expanded_conv_2_depthwise_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_2_depthwise_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_2_depthwise_depthwise)
        MobilenetV2_expanded_conv_2_depthwise_Relu6 = F.relu6(MobilenetV2_expanded_conv_2_depthwise_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_2_project_Conv2D = self.MobilenetV2_expanded_conv_2_project_Conv2D(MobilenetV2_expanded_conv_2_depthwise_Relu6)
        MobilenetV2_expanded_conv_2_project_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_2_project_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_2_project_Conv2D)
        MobilenetV2_expanded_conv_2_add = MobilenetV2_expanded_conv_2_project_BatchNorm_FusedBatchNorm + MobilenetV2_expanded_conv_1_project_BatchNorm_FusedBatchNorm
        MobilenetV2_expanded_conv_3_expand_Conv2D = self.MobilenetV2_expanded_conv_3_expand_Conv2D(MobilenetV2_expanded_conv_2_add)
        MobilenetV2_expanded_conv_3_expand_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_3_expand_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_3_expand_Conv2D)
        MobilenetV2_expanded_conv_3_expand_Relu6 = F.relu6(MobilenetV2_expanded_conv_3_expand_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_3_depthwise_depthwise_pad = F.pad(MobilenetV2_expanded_conv_3_expand_Relu6, (0, 1, 0, 1))
        MobilenetV2_expanded_conv_3_depthwise_depthwise = self.MobilenetV2_expanded_conv_3_depthwise_depthwise(MobilenetV2_expanded_conv_3_depthwise_depthwise_pad)
        MobilenetV2_expanded_conv_3_depthwise_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_3_depthwise_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_3_depthwise_depthwise)
        MobilenetV2_expanded_conv_3_depthwise_Relu6 = F.relu6(MobilenetV2_expanded_conv_3_depthwise_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_3_project_Conv2D = self.MobilenetV2_expanded_conv_3_project_Conv2D(MobilenetV2_expanded_conv_3_depthwise_Relu6)
        MobilenetV2_expanded_conv_3_project_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_3_project_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_3_project_Conv2D)
        MobilenetV2_expanded_conv_4_expand_Conv2D = self.MobilenetV2_expanded_conv_4_expand_Conv2D(MobilenetV2_expanded_conv_3_project_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_4_expand_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_4_expand_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_4_expand_Conv2D)
        MobilenetV2_expanded_conv_4_expand_Relu6 = F.relu6(MobilenetV2_expanded_conv_4_expand_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_4_depthwise_depthwise_pad = F.pad(MobilenetV2_expanded_conv_4_expand_Relu6, (1, 1, 1, 1))
        MobilenetV2_expanded_conv_4_depthwise_depthwise = self.MobilenetV2_expanded_conv_4_depthwise_depthwise(MobilenetV2_expanded_conv_4_depthwise_depthwise_pad)
        MobilenetV2_expanded_conv_4_depthwise_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_4_depthwise_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_4_depthwise_depthwise)
        MobilenetV2_expanded_conv_4_depthwise_Relu6 = F.relu6(MobilenetV2_expanded_conv_4_depthwise_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_4_project_Conv2D = self.MobilenetV2_expanded_conv_4_project_Conv2D(MobilenetV2_expanded_conv_4_depthwise_Relu6)
        MobilenetV2_expanded_conv_4_project_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_4_project_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_4_project_Conv2D)
        MobilenetV2_expanded_conv_4_add = MobilenetV2_expanded_conv_4_project_BatchNorm_FusedBatchNorm + MobilenetV2_expanded_conv_3_project_BatchNorm_FusedBatchNorm
        MobilenetV2_expanded_conv_5_expand_Conv2D = self.MobilenetV2_expanded_conv_5_expand_Conv2D(MobilenetV2_expanded_conv_4_add)
        MobilenetV2_expanded_conv_5_expand_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_5_expand_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_5_expand_Conv2D)
        MobilenetV2_expanded_conv_5_expand_Relu6 = F.relu6(MobilenetV2_expanded_conv_5_expand_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_5_depthwise_depthwise_pad = F.pad(MobilenetV2_expanded_conv_5_expand_Relu6, (1, 1, 1, 1))
        MobilenetV2_expanded_conv_5_depthwise_depthwise = self.MobilenetV2_expanded_conv_5_depthwise_depthwise(MobilenetV2_expanded_conv_5_depthwise_depthwise_pad)
        MobilenetV2_expanded_conv_5_depthwise_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_5_depthwise_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_5_depthwise_depthwise)
        MobilenetV2_expanded_conv_5_depthwise_Relu6 = F.relu6(MobilenetV2_expanded_conv_5_depthwise_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_5_project_Conv2D = self.MobilenetV2_expanded_conv_5_project_Conv2D(MobilenetV2_expanded_conv_5_depthwise_Relu6)
        MobilenetV2_expanded_conv_5_project_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_5_project_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_5_project_Conv2D)
        MobilenetV2_expanded_conv_5_add = MobilenetV2_expanded_conv_5_project_BatchNorm_FusedBatchNorm + MobilenetV2_expanded_conv_4_add
        MobilenetV2_expanded_conv_6_expand_Conv2D = self.MobilenetV2_expanded_conv_6_expand_Conv2D(MobilenetV2_expanded_conv_5_add)
        MobilenetV2_expanded_conv_6_expand_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_6_expand_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_6_expand_Conv2D)
        MobilenetV2_expanded_conv_6_expand_Relu6 = F.relu6(MobilenetV2_expanded_conv_6_expand_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_6_depthwise_depthwise_pad = F.pad(MobilenetV2_expanded_conv_6_expand_Relu6, (0, 1, 0, 1))
        MobilenetV2_expanded_conv_6_depthwise_depthwise = self.MobilenetV2_expanded_conv_6_depthwise_depthwise(MobilenetV2_expanded_conv_6_depthwise_depthwise_pad)
        MobilenetV2_expanded_conv_6_depthwise_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_6_depthwise_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_6_depthwise_depthwise)
        MobilenetV2_expanded_conv_6_depthwise_Relu6 = F.relu6(MobilenetV2_expanded_conv_6_depthwise_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_6_project_Conv2D = self.MobilenetV2_expanded_conv_6_project_Conv2D(MobilenetV2_expanded_conv_6_depthwise_Relu6)
        MobilenetV2_expanded_conv_6_project_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_6_project_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_6_project_Conv2D)
        MobilenetV2_expanded_conv_7_expand_Conv2D = self.MobilenetV2_expanded_conv_7_expand_Conv2D(MobilenetV2_expanded_conv_6_project_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_7_expand_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_7_expand_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_7_expand_Conv2D)
        MobilenetV2_expanded_conv_7_expand_Relu6 = F.relu6(MobilenetV2_expanded_conv_7_expand_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_7_depthwise_depthwise_pad = F.pad(MobilenetV2_expanded_conv_7_expand_Relu6, (1, 1, 1, 1))
        MobilenetV2_expanded_conv_7_depthwise_depthwise = self.MobilenetV2_expanded_conv_7_depthwise_depthwise(MobilenetV2_expanded_conv_7_depthwise_depthwise_pad)
        MobilenetV2_expanded_conv_7_depthwise_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_7_depthwise_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_7_depthwise_depthwise)
        MobilenetV2_expanded_conv_7_depthwise_Relu6 = F.relu6(MobilenetV2_expanded_conv_7_depthwise_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_7_project_Conv2D = self.MobilenetV2_expanded_conv_7_project_Conv2D(MobilenetV2_expanded_conv_7_depthwise_Relu6)
        MobilenetV2_expanded_conv_7_project_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_7_project_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_7_project_Conv2D)
        MobilenetV2_expanded_conv_7_add = MobilenetV2_expanded_conv_7_project_BatchNorm_FusedBatchNorm + MobilenetV2_expanded_conv_6_project_BatchNorm_FusedBatchNorm
        MobilenetV2_expanded_conv_8_expand_Conv2D = self.MobilenetV2_expanded_conv_8_expand_Conv2D(MobilenetV2_expanded_conv_7_add)
        MobilenetV2_expanded_conv_8_expand_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_8_expand_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_8_expand_Conv2D)
        MobilenetV2_expanded_conv_8_expand_Relu6 = F.relu6(MobilenetV2_expanded_conv_8_expand_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_8_depthwise_depthwise_pad = F.pad(MobilenetV2_expanded_conv_8_expand_Relu6, (1, 1, 1, 1))
        MobilenetV2_expanded_conv_8_depthwise_depthwise = self.MobilenetV2_expanded_conv_8_depthwise_depthwise(MobilenetV2_expanded_conv_8_depthwise_depthwise_pad)
        MobilenetV2_expanded_conv_8_depthwise_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_8_depthwise_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_8_depthwise_depthwise)
        MobilenetV2_expanded_conv_8_depthwise_Relu6 = F.relu6(MobilenetV2_expanded_conv_8_depthwise_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_8_project_Conv2D = self.MobilenetV2_expanded_conv_8_project_Conv2D(MobilenetV2_expanded_conv_8_depthwise_Relu6)
        MobilenetV2_expanded_conv_8_project_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_8_project_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_8_project_Conv2D)
        MobilenetV2_expanded_conv_8_add = MobilenetV2_expanded_conv_8_project_BatchNorm_FusedBatchNorm + MobilenetV2_expanded_conv_7_add
        MobilenetV2_expanded_conv_9_expand_Conv2D = self.MobilenetV2_expanded_conv_9_expand_Conv2D(MobilenetV2_expanded_conv_8_add)
        MobilenetV2_expanded_conv_9_expand_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_9_expand_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_9_expand_Conv2D)
        MobilenetV2_expanded_conv_9_expand_Relu6 = F.relu6(MobilenetV2_expanded_conv_9_expand_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_9_depthwise_depthwise_pad = F.pad(MobilenetV2_expanded_conv_9_expand_Relu6, (1, 1, 1, 1))
        MobilenetV2_expanded_conv_9_depthwise_depthwise = self.MobilenetV2_expanded_conv_9_depthwise_depthwise(MobilenetV2_expanded_conv_9_depthwise_depthwise_pad)
        MobilenetV2_expanded_conv_9_depthwise_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_9_depthwise_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_9_depthwise_depthwise)
        MobilenetV2_expanded_conv_9_depthwise_Relu6 = F.relu6(MobilenetV2_expanded_conv_9_depthwise_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_9_project_Conv2D = self.MobilenetV2_expanded_conv_9_project_Conv2D(MobilenetV2_expanded_conv_9_depthwise_Relu6)
        MobilenetV2_expanded_conv_9_project_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_9_project_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_9_project_Conv2D)
        MobilenetV2_expanded_conv_9_add = MobilenetV2_expanded_conv_9_project_BatchNorm_FusedBatchNorm + MobilenetV2_expanded_conv_8_add
        MobilenetV2_expanded_conv_10_expand_Conv2D = self.MobilenetV2_expanded_conv_10_expand_Conv2D(MobilenetV2_expanded_conv_9_add)
        MobilenetV2_expanded_conv_10_expand_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_10_expand_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_10_expand_Conv2D)
        MobilenetV2_expanded_conv_10_expand_Relu6 = F.relu6(MobilenetV2_expanded_conv_10_expand_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_10_depthwise_depthwise_pad = F.pad(MobilenetV2_expanded_conv_10_expand_Relu6, (1, 1, 1, 1))
        MobilenetV2_expanded_conv_10_depthwise_depthwise = self.MobilenetV2_expanded_conv_10_depthwise_depthwise(MobilenetV2_expanded_conv_10_depthwise_depthwise_pad)
        MobilenetV2_expanded_conv_10_depthwise_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_10_depthwise_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_10_depthwise_depthwise)
        MobilenetV2_expanded_conv_10_depthwise_Relu6 = F.relu6(MobilenetV2_expanded_conv_10_depthwise_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_10_project_Conv2D = self.MobilenetV2_expanded_conv_10_project_Conv2D(MobilenetV2_expanded_conv_10_depthwise_Relu6)
        MobilenetV2_expanded_conv_10_project_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_10_project_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_10_project_Conv2D)
        MobilenetV2_expanded_conv_11_expand_Conv2D = self.MobilenetV2_expanded_conv_11_expand_Conv2D(MobilenetV2_expanded_conv_10_project_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_11_expand_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_11_expand_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_11_expand_Conv2D)
        MobilenetV2_expanded_conv_11_expand_Relu6 = F.relu6(MobilenetV2_expanded_conv_11_expand_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_11_depthwise_depthwise_pad = F.pad(MobilenetV2_expanded_conv_11_expand_Relu6, (1, 1, 1, 1))
        MobilenetV2_expanded_conv_11_depthwise_depthwise = self.MobilenetV2_expanded_conv_11_depthwise_depthwise(MobilenetV2_expanded_conv_11_depthwise_depthwise_pad)
        MobilenetV2_expanded_conv_11_depthwise_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_11_depthwise_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_11_depthwise_depthwise)
        MobilenetV2_expanded_conv_11_depthwise_Relu6 = F.relu6(MobilenetV2_expanded_conv_11_depthwise_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_11_project_Conv2D = self.MobilenetV2_expanded_conv_11_project_Conv2D(MobilenetV2_expanded_conv_11_depthwise_Relu6)
        MobilenetV2_expanded_conv_11_project_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_11_project_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_11_project_Conv2D)
        MobilenetV2_expanded_conv_11_add = MobilenetV2_expanded_conv_11_project_BatchNorm_FusedBatchNorm + MobilenetV2_expanded_conv_10_project_BatchNorm_FusedBatchNorm
        MobilenetV2_expanded_conv_12_expand_Conv2D = self.MobilenetV2_expanded_conv_12_expand_Conv2D(MobilenetV2_expanded_conv_11_add)
        MobilenetV2_expanded_conv_12_expand_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_12_expand_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_12_expand_Conv2D)
        MobilenetV2_expanded_conv_12_expand_Relu6 = F.relu6(MobilenetV2_expanded_conv_12_expand_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_12_depthwise_depthwise_pad = F.pad(MobilenetV2_expanded_conv_12_expand_Relu6, (1, 1, 1, 1))
        MobilenetV2_expanded_conv_12_depthwise_depthwise = self.MobilenetV2_expanded_conv_12_depthwise_depthwise(MobilenetV2_expanded_conv_12_depthwise_depthwise_pad)
        MobilenetV2_expanded_conv_12_depthwise_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_12_depthwise_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_12_depthwise_depthwise)
        MobilenetV2_expanded_conv_12_depthwise_Relu6 = F.relu6(MobilenetV2_expanded_conv_12_depthwise_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_12_project_Conv2D = self.MobilenetV2_expanded_conv_12_project_Conv2D(MobilenetV2_expanded_conv_12_depthwise_Relu6)
        MobilenetV2_expanded_conv_12_project_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_12_project_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_12_project_Conv2D)
        MobilenetV2_expanded_conv_12_add = MobilenetV2_expanded_conv_12_project_BatchNorm_FusedBatchNorm + MobilenetV2_expanded_conv_11_add
        MobilenetV2_expanded_conv_13_expand_Conv2D = self.MobilenetV2_expanded_conv_13_expand_Conv2D(MobilenetV2_expanded_conv_12_add)
        MobilenetV2_expanded_conv_13_expand_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_13_expand_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_13_expand_Conv2D)
        MobilenetV2_expanded_conv_13_expand_Relu6 = F.relu6(MobilenetV2_expanded_conv_13_expand_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_13_depthwise_depthwise_pad = F.pad(MobilenetV2_expanded_conv_13_expand_Relu6, (0, 1, 0, 1))
        MobilenetV2_expanded_conv_13_depthwise_depthwise = self.MobilenetV2_expanded_conv_13_depthwise_depthwise(MobilenetV2_expanded_conv_13_depthwise_depthwise_pad)
        MobilenetV2_expanded_conv_13_depthwise_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_13_depthwise_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_13_depthwise_depthwise)
        MobilenetV2_expanded_conv_13_depthwise_Relu6 = F.relu6(MobilenetV2_expanded_conv_13_depthwise_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_13_project_Conv2D = self.MobilenetV2_expanded_conv_13_project_Conv2D(MobilenetV2_expanded_conv_13_depthwise_Relu6)
        MobilenetV2_expanded_conv_13_project_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_13_project_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_13_project_Conv2D)
        MobilenetV2_expanded_conv_14_expand_Conv2D = self.MobilenetV2_expanded_conv_14_expand_Conv2D(MobilenetV2_expanded_conv_13_project_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_14_expand_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_14_expand_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_14_expand_Conv2D)
        MobilenetV2_expanded_conv_14_expand_Relu6 = F.relu6(MobilenetV2_expanded_conv_14_expand_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_14_depthwise_depthwise_pad = F.pad(MobilenetV2_expanded_conv_14_expand_Relu6, (1, 1, 1, 1))
        MobilenetV2_expanded_conv_14_depthwise_depthwise = self.MobilenetV2_expanded_conv_14_depthwise_depthwise(MobilenetV2_expanded_conv_14_depthwise_depthwise_pad)
        MobilenetV2_expanded_conv_14_depthwise_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_14_depthwise_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_14_depthwise_depthwise)
        MobilenetV2_expanded_conv_14_depthwise_Relu6 = F.relu6(MobilenetV2_expanded_conv_14_depthwise_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_14_project_Conv2D = self.MobilenetV2_expanded_conv_14_project_Conv2D(MobilenetV2_expanded_conv_14_depthwise_Relu6)
        MobilenetV2_expanded_conv_14_project_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_14_project_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_14_project_Conv2D)
        MobilenetV2_expanded_conv_14_add = MobilenetV2_expanded_conv_14_project_BatchNorm_FusedBatchNorm + MobilenetV2_expanded_conv_13_project_BatchNorm_FusedBatchNorm
        MobilenetV2_expanded_conv_15_expand_Conv2D = self.MobilenetV2_expanded_conv_15_expand_Conv2D(MobilenetV2_expanded_conv_14_add)
        MobilenetV2_expanded_conv_15_expand_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_15_expand_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_15_expand_Conv2D)
        MobilenetV2_expanded_conv_15_expand_Relu6 = F.relu6(MobilenetV2_expanded_conv_15_expand_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_15_depthwise_depthwise_pad = F.pad(MobilenetV2_expanded_conv_15_expand_Relu6, (1, 1, 1, 1))
        MobilenetV2_expanded_conv_15_depthwise_depthwise = self.MobilenetV2_expanded_conv_15_depthwise_depthwise(MobilenetV2_expanded_conv_15_depthwise_depthwise_pad)
        MobilenetV2_expanded_conv_15_depthwise_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_15_depthwise_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_15_depthwise_depthwise)
        MobilenetV2_expanded_conv_15_depthwise_Relu6 = F.relu6(MobilenetV2_expanded_conv_15_depthwise_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_15_project_Conv2D = self.MobilenetV2_expanded_conv_15_project_Conv2D(MobilenetV2_expanded_conv_15_depthwise_Relu6)
        MobilenetV2_expanded_conv_15_project_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_15_project_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_15_project_Conv2D)
        MobilenetV2_expanded_conv_15_add = MobilenetV2_expanded_conv_15_project_BatchNorm_FusedBatchNorm + MobilenetV2_expanded_conv_14_add
        MobilenetV2_expanded_conv_16_expand_Conv2D = self.MobilenetV2_expanded_conv_16_expand_Conv2D(MobilenetV2_expanded_conv_15_add)
        MobilenetV2_expanded_conv_16_expand_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_16_expand_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_16_expand_Conv2D)
        MobilenetV2_expanded_conv_16_expand_Relu6 = F.relu6(MobilenetV2_expanded_conv_16_expand_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_16_depthwise_depthwise_pad = F.pad(MobilenetV2_expanded_conv_16_expand_Relu6, (1, 1, 1, 1))
        MobilenetV2_expanded_conv_16_depthwise_depthwise = self.MobilenetV2_expanded_conv_16_depthwise_depthwise(MobilenetV2_expanded_conv_16_depthwise_depthwise_pad)
        MobilenetV2_expanded_conv_16_depthwise_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_16_depthwise_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_16_depthwise_depthwise)
        MobilenetV2_expanded_conv_16_depthwise_Relu6 = F.relu6(MobilenetV2_expanded_conv_16_depthwise_BatchNorm_FusedBatchNorm)
        MobilenetV2_expanded_conv_16_project_Conv2D = self.MobilenetV2_expanded_conv_16_project_Conv2D(MobilenetV2_expanded_conv_16_depthwise_Relu6)
        MobilenetV2_expanded_conv_16_project_BatchNorm_FusedBatchNorm = self.MobilenetV2_expanded_conv_16_project_BatchNorm_FusedBatchNorm(MobilenetV2_expanded_conv_16_project_Conv2D)
        MobilenetV2_Conv_1_Conv2D = self.MobilenetV2_Conv_1_Conv2D(MobilenetV2_expanded_conv_16_project_BatchNorm_FusedBatchNorm)
        MobilenetV2_Conv_1_BatchNorm_FusedBatchNorm = self.MobilenetV2_Conv_1_BatchNorm_FusedBatchNorm(MobilenetV2_Conv_1_Conv2D)
        MobilenetV2_Conv_1_Relu6 = F.relu6(MobilenetV2_Conv_1_BatchNorm_FusedBatchNorm)
        MobilenetV2_Logits_AvgPool = F.avg_pool2d(MobilenetV2_Conv_1_Relu6, kernel_size=(7, 7), stride=(1, 1), padding=(0,), ceil_mode=False)
        MobilenetV2_Logits_Conv2d_1c_1x1_Conv2D = self.MobilenetV2_Logits_Conv2d_1c_1x1_Conv2D(MobilenetV2_Logits_AvgPool)
        MobilenetV2_Logits_Squeeze = torch.squeeze(MobilenetV2_Logits_Conv2d_1c_1x1_Conv2D)
        MMdnn_Output    = torch.squeeze(MobilenetV2_Logits_Squeeze)
        return MMdnn_Output

    @staticmethod
    def __conv(dim, name, **kwargs):
        if   dim == 1:  layer = nn.Conv1d(**kwargs)
        elif dim == 2:  layer = nn.Conv2d(**kwargs)
        elif dim == 3:  layer = nn.Conv3d(**kwargs)
        else:           raise NotImplementedError()

        layer.state_dict()['weight'].copy_(torch.from_numpy(__weights_dict[name]['weights']))
        if 'bias' in __weights_dict[name]:
            layer.state_dict()['bias'].copy_(torch.from_numpy(__weights_dict[name]['bias']))
        return layer

    @staticmethod
    def __batch_normalization(dim, name, **kwargs):
        if   dim == 1:  layer = nn.BatchNorm1d(**kwargs)
        elif dim == 2:  layer = nn.BatchNorm2d(**kwargs)
        elif dim == 3:  layer = nn.BatchNorm3d(**kwargs)
        else:           raise NotImplementedError()

        if 'scale' in __weights_dict[name]:
            layer.state_dict()['weight'].copy_(torch.from_numpy(__weights_dict[name]['scale']))
        else:
            layer.weight.data.fill_(1)

        if 'bias' in __weights_dict[name]:
            layer.state_dict()['bias'].copy_(torch.from_numpy(__weights_dict[name]['bias']))
        else:
            layer.bias.data.fill_(0)

        layer.state_dict()['running_mean'].copy_(torch.from_numpy(__weights_dict[name]['mean']))
        layer.state_dict()['running_var'].copy_(torch.from_numpy(__weights_dict[name]['var']))
        return layer


# --------------------------------------------------------
# R-C3D
# Copyright (c) 2017 Boston University
# Licensed under The MIT License [see LICENSE for details]
# Written by Huijuan Xu
# --------------------------------------------------------

import sys, os, errno
import numpy as np
import csv
import json
import copy
import argparse

THIS_DIR = os.path.dirname(os.path.abspath(__file__))

def nms(dets, thresh=0.4):
    """Pure Python NMS baseline."""
    if len(dets) == 0: return []
    x1 = dets[:, 0]
    x2 = dets[:, 1]
    scores = dets[:, 2]
    lengths = x2 - x1
    order = scores.argsort()[::-1]
    keep = []
    while order.size > 0:
        i = order[0]
        keep.append(i)
        xx1 = np.maximum(x1[i], x1[order[1:]])
        xx2 = np.minimum(x2[i], x2[order[1:]])
        inter = np.maximum(0.0, xx2 - xx1)
        ovr = inter / (lengths[i] + lengths[order[1:]] - inter)
        inds = np.where(ovr <= thresh)[0]
        order = order[inds + 1]
    return keep

def generate_classes(meta_file):
    #META_FILE = '../../preprocess/activitynet/activity_net.v1-3.min.json'
    data = json.load(open(meta_file))
    class_list = []
    for vid, vinfo in data['database'].items():
        for item in vinfo['annotations']:
            class_list.append(item['label'])

    class_list = list(set(class_list))
    class_list = sorted(class_list)
    classes = {0: 'Background'}
    for i,cls in enumerate(class_list):
        classes[i+1] = cls
    return classes

def get_segments(data, thresh, framerate):
    segments = []
    vid = 'Background'
    find_next = False
    tmp = {'label' : 0, 'score': 0, 'segment': [0, 0]}
    for l in data:
        # video name and sliding window length
        if "fg_name:" in l:
            vid = l.split('/')[-1]

        # frame index, time, confident score
        elif "frames:" in l:
            start_frame=int(l.split()[3])
            end_frame=int(l.split()[4])
            stride = int(l.split()[5].split(']')[0])

        elif "activity:" in l:
            label = int(l.split()[1])
            tmp['label'] = label
            find_next = True

        elif "im_detect" in l:
            return vid, segments

        elif find_next:
            try:
                left_frame = float(l.split()[0].split('[')[-1])*stride + start_frame
                right_frame = float(l.split()[1])*stride + start_frame
            except:
                left_frame = float(l.split()[1])*stride + start_frame
                right_frame = float(l.split()[2])*stride + start_frame

            try:
                score = float(l.split()[-1].split(']')[0])
            except:
                score = float(l.split()[-2])

            if (left_frame >= right_frame):
                print("???", l)
                continue

            if right_frame > end_frame:
                #print("right out", right_frame, end_frame)
                right_frame = end_frame

            left  = left_frame / framerate
            right = right_frame / framerate
            if score > thresh:
                tmp1 = copy.deepcopy(tmp)
                tmp1['score'] = score
                tmp1['segment'] = [left, right]
                segments.append(tmp1)

def analysis_log(logfile, thresh, framerate):
    with open(logfile, 'r') as f:
        lines = f.read().splitlines()
    predict_data = []
    res = {}
    for l in lines:
        if "frames:" in l:
            predict_data = []
        predict_data.append(l)
        if "im_detect:" in l:
            vid, segments = get_segments(predict_data, thresh, framerate)
            if vid not in res:
                res[vid] = []
            res[vid] += segments
    return res

def select_top(segmentations, nms_thresh=0.99999, num_cls=0, topk=0):
    res = {}
    for vid, vinfo in segmentations.items():
        # select most likely classes
        if num_cls > 0:
            ave_scores = np.zeros(201)
            for i in range(1, 201):
                ave_scores[i] = np.sum([d['score'] for d in vinfo if d['label']==i])
            labels = list(ave_scores.argsort()[::-1][:num_cls])
        else:
            labels = list(set([d['label'] for d in vinfo]))

        # NMS
        res_nms = []
        for lab in labels:
            nms_in = [d['segment'] + [d['score']] for d in vinfo if d['label'] == lab]
            keep = nms(np.array(nms_in), nms_thresh)
            for i in keep:
                tmp = {'label':classes[lab], 'score':nms_in[i][2], 'segment': nms_in[i][0:2]}
                res_nms.append(tmp)

        # select topk
        scores = [d['score'] for d in res_nms]
        sortid = np.argsort(scores)[-topk:]
        res[vid] = [res_nms[id] for id in sortid]
    return res

parser = argparse.ArgumentParser(description="log analysis.py")
parser.add_argument('log_file', type=str, help="test log file path")
parser.add_argument('--framerate', type=int, help="frame rate of videos extract by ffmpeg")
parser.add_argument('--thresh', type=float, default=0.0005, help="filter those dets low than the thresh, default=0.0005")
parser.add_argument('--nms_thresh', type=float, default=0.3, help="nms thresh, default=0.3")
parser.add_argument('--topk', type=int, default=200, help="select topk dets, default=200")
parser.add_argument('--num_cls', type=int, default=0, help="select most likely classes, default=0")

parser.add_argument('--ground_truth_filename', type=str, default='./Evaluation/data/activity_net.v1-3.min.json',
               help='Full path to json file containing the ground truth.')
parser.add_argument('--prediction_filename', type=str, default='results.json',
               help='Full path to json file containing the predictions.')
parser.add_argument('--subset', default='validation',
               help=('String indicating subset to evaluate: '
                     '(training, validation)'))
parser.add_argument('--tiou_thresholds', type=float, default=np.linspace(0.5, 0.95, 10),
               help='Temporal intersection over union threshold.')
parser.add_argument('--verbose', type=bool, default=True)
parser.add_argument('--check_status', type=bool, default=True)

args = parser.parse_args()
args.ground_truth_filename = os.path.join(THIS_DIR, args.ground_truth_filename)

classes = generate_classes(args.ground_truth_filename)
segmentations = analysis_log(args.log_file, thresh = args.thresh, framerate=args.framerate)
segmentations = select_top(segmentations, nms_thresh=args.nms_thresh, num_cls=args.num_cls, topk=args.topk)

res = {'version': 'VERSION 1.3',
       'external_data': {'used': True, 'details': 'C3D pre-trained on sport-1M training set'},
       'results': {}}
for vid, vinfo in segmentations.items():
    res['results'][vid] = vinfo

with open(args.prediction_filename, 'w') as outfile:
    json.dump(res, outfile)

from Evaluation.eval_detection import ANETdetection

def main(ground_truth_filename, prediction_filename,
         subset='validation', tiou_thresholds=np.linspace(0.5, 0.95, 10),
         verbose=True, check_status=True):

    anet_detection = ANETdetection(ground_truth_filename, prediction_filename,
                                   subset=subset, tiou_thresholds=tiou_thresholds,
                                   verbose=verbose, check_status=check_status)
    anet_detection.evaluate()

print(args)
main(args.ground_truth_filename, args.prediction_filename, args.subset, args.tiou_thresholds, args.verbose, args.check_status)


#encoding=utf-8
import sys
from numpy import *
import bayes

bayes.spamTest()


import cv2
import numpy as np
from keras.preprocessing import image
import warnings
warnings.filterwarnings("ignore")
from keras.preprocessing.image import load_img, img_to_array
from keras.models import  load_model
import matplotlib.pyplot as plt
import numpy as np

# load model
model = load_model("best_model.h5")

face_haar_cascade = cv2.CascadeClassifier(cv2.data.haarcascades + 'haarcascade_frontalface_default.xml')

cap = cv2.VideoCapture(0)

while True:
    f = open("emotions.txt", "w")
    ret, test_img = cap.read()  # captures frame and returns boolean value and captured image
    if not ret:
        continue
    gray_img = cv2.cvtColor(test_img, cv2.COLOR_BGR2RGB)

    faces_detected = face_haar_cascade.detectMultiScale(gray_img, 1.32, 5)

    for (x, y, w, h) in faces_detected:
        cv2.rectangle(test_img, (x, y), (x + w, y + h), (255, 0, 0), thickness=6)
        roi_gray = gray_img[y:y + w, x:x + h]  # cropping region of interest i.e. face area from  image
        roi_gray = cv2.resize(roi_gray, (224, 224))
        img_pixels = image.img_to_array(roi_gray)
        img_pixels = np.expand_dims(img_pixels, axis=0)
        img_pixels /= 255

        predictions = model.predict(img_pixels)

        # find max indexed arra y
        max_index = np.argmax(predictions[0])

        emotions = ('angry', 'disgust', 'fear', 'happy', 'sad', 'surprise', 'neutral')
        predicted_emotion = emotions[max_index]
        f.write(emotions[max_index] + "\n")
        # manipulate this code here, modify to our need
        # have it output in variables, do if emotion == "one of the options"

        cv2.putText(test_img, predicted_emotion, (int(x), int(y)), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2)

    resized_img = cv2.resize(test_img, (1000, 700))
    cv2.imshow('Facial emotion analysis ', resized_img)
    if cv2.waitKey(10) == ord('q'):  # wait until 'q' key is pressed
        f.close()
        break

cap.release()
cv2.destroyAllWindows