第J5周:DenseNet+SE-Net实战(TensorFlow版)

 >- **🍨 本文为[🔗365天深度学习训练营]中的学习记录博客**
>- **🍖 原作者:[K同学啊]**

📌 本周任务:
●1. 在DenseNet系列算法中插入SE-Net通道注意力机制,并完成猴痘病识别(数据集链接)
●2. 改进思路是否可以迁移到其他地方呢
●3. 测试集accuracy到达89%(拔高,可选)

🚀我的环境:

  • 语言环境:Python3.11.7
  • 编译器:jupyter notebook
  • 深度学习框架:TensorFlow2.13.0

       本文完全根据  第J5周:DenseNet+SE-Net实战(pytorch版) 中的内容转换为TensorFlow,所以前述性的内容不在一一重复,仅就TensorFlow的内容进行叙述。

一、前期工作 

1、设置CPU(也可以是GPU)

import tensorflow as tf
gpus=tf.config.list_physical_devices("GPU")if gpus:tf.config.experimental.set_memory_growth(gpus[0],True)tf.config.set_visible_devices([gpus[0]],"GPU")

2、导入数据

import pathlibdata_dir=r'D:\THE MNIST DATABASE\P4-data'
data_dir=pathlib.Path(data_dir)

3、查看数据

image_count=len(list(data_dir.glob('*/*')))
print("图片总数为:",image_count)

运行结果:

图片总数为: 2142

二、数据预处理

1、加载数据

加载训练集:

train_ds=tf.keras.preprocessing.image_dataset_from_directory(data_dir,validation_split=0.2,subset="training",seed=123,image_size=(224,224),batch_size=8
)

运行结果:

Found 2142 files belonging to 2 classes.
Using 1714 files for training.

 加载验证集:

val_ds=tf.keras.preprocessing.image_dataset_from_directory(data_dir,validation_split=0.2,subset="validation",seed=123,image_size=(224,224),batch_size=8
)

运行结果:

Found 2142 files belonging to 2 classes.
Using 428 files for validation.

 查看分类名称

classNames=train_ds.class_names
classNames

运行结果:

['Monkeypox', 'Others']

2、可视化数据

import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['SimHei'] #正常显示中文标签
plt.rcParams['axes.unicode_minus']=False #正常显示负号plt.figure(figsize=(10,5))
plt.suptitle("OreoCC的案例")for images,labels in train_ds.take(1):for i in range(8):ax=plt.subplot(2,4,i+1)plt.imshow(images[i].numpy().astype("uint8"))plt.title(classNames[labels[i]])plt.axis("off")

运行结果:


单独查看其中一张图片

plt.imshow(images[1].numpy().astype("uint8"))

 运行结果:

3、再次检查数据

for image_batch,labels_batch in train_ds:print(image_batch.shape)print(labels_batch.shape)break

运行结果:

(8, 224, 224, 3)
(8,)

image_batch是形状的张量(8,224,224,3)。这是一批形状224*224*4的8张图片(最后一维指的是彩色通道RGB)

labels_batch是形状(8,)的张量,这些标签对应8张图片。

4、配置数据集

shuffle() : 打乱数据,关于此函数的详细介绍可以参考:https://zhuanlan.zhihu.com/p/42417456
prefetch() :预取数据,加速运行,其详细介绍可以参考前面文章,里面都有讲解。
cache() :将数据集缓存到内存当中,加速运行

AUTOTUNE=tf.data.AUTOTUNEtrain_ds=train_ds.cache().shuffle(1000).prefetch(buffer_size=AUTOTUNE)
val_ds=val_ds.prefetch(buffer_size=AUTOTUNE)

三、构建DenseNet网络模型

1、搭建SE-Net模块

from tensorflow import keras
from keras.layers import Input,Reshape,Activation,BatchNormalization,GlobalAveragePooling2D,Dense
from keras.models import Model# SE-Net
class SqueezeExcitationLayer(Model):def __init__(self,filter_sq):# filter_sq是Excitation中第一个卷积过程中卷积核的个数super.__init__()self.avgpool=GlobalAveragePooling2D()self.dense=Dense(filter_sq)self.relu=Activation('relu')self.sigmoid=Activation('sigmoid')def call(self,inputs):x=self.avgpool(inputs)x=self.dense(x)x=self.relu(x)x=Dense(inputs.shape[-1])(x)x=self.sigmoid(x)x=Reshape((1,1,inputs.shape[-1]))(x)scale=inputs*xreturn scale

2、搭建DenseLayer

from keras.layers import Input,Activation,BatchNormalization,Flatten
from keras.layers import Dense,Conv2D,MaxPooling2D,ZeroPadding2D,AveragePooling2D
from keras.models import Model# DenseLayer
def DenseLayer(x,growth_rate):f=BatchNormalization()(x)f=Activation('relu')(x)f=Conv2D(4*growth_rate,kernel_size=1,strides=1,padding='same',use_bias=False)(f)f=BatchNormalization()(f)f=Activation('relu')(f)f=Conv2D(growth_rate,kernel_size=3,strides=1,padding='same',use_bias=False)(f)return layers.Concatenate(axis=3)([x,f])

3、搭建DenseBlock模块

# DenseBlock
def DenseBlock(x,block,growth_rate=32):for i in range(block):x=DenseLayer(x,growth_rate)return x

4、搭建TransitionBlock模块

# Transition
k=keras.backend
def Transition(x,theta):f=BatchNormalization()(x)f=Activation('relu')(f)f=Conv2D(int(k.int_shape(x)[3]*theta),kernel_size=1,strides=1,use_bias=False)(f)f=AveragePooling2D(pool_size=(2,2),strides=2,padding='valid')(f)return f

5、搭建DenseNet+SE 网络模型

# DenseNet
def DenseNet(input_shape,block,num_classes=4):# 56*56*64img_input=Input(shape=input_shape)x=Conv2D(64,kernel_size=(7,7),strides=2,padding='same',use_bias=False)(img_input)x=BatchNormalization()(x)x=MaxPooling2D(pool_size=3,strides=2,padding='same')(x)x=DenseBlock(x,block[0])x=Transition(x,0.5)  #28*28x=DenseBlock(x,block[1])x=Transition(x,0.5) #14*14x=DenseBlock(x,block[2])x=Transition(x,0.5) #7*7x=DenseBlock(x,block[3])#加入SE注意力机制x=SqueezeExcitationLayer(16)(x)# final bn+ReLUx=BatchNormalization()(x)x=Activation('relu')(x)x=GlobalAveragePooling2D()(x)outputs=Dense(num_classes,activation='softmax')(x)model=Model(inputs=[img_input],outputs=[outputs])return model

6、建立DenseNet-121模型

# DenseNet 121
DenseNet121=DenseNet([224,224,3],[6,12,24,16])  # DenseNet-121
DenseNet169=DenseNet([224,224,3],[6,12,32,32])  # DenseNet-169
DenseNet201=DenseNet([224,224,3],[6,12,48,32])  # DenseNet-201
DenseNet269=DenseNet([224,224,3],[6,12,64,48])  # DenseNet-269
model=DenseNet121
model.summary()

运行结果:

Model: "model"
__________________________________________________________________________________________________Layer (type)                Output Shape                 Param #   Connected to                  
==================================================================================================input_1 (InputLayer)        [(None, 224, 224, 3)]        0         []                            conv2d (Conv2D)             (None, 112, 112, 64)         9408      ['input_1[0][0]']             batch_normalization (Batch  (None, 112, 112, 64)         256       ['conv2d[0][0]']              Normalization)                                                                                   max_pooling2d (MaxPooling2  (None, 56, 56, 64)           0         ['batch_normalization[0][0]'] D)                                                                                               activation (Activation)     (None, 56, 56, 64)           0         ['max_pooling2d[0][0]']       conv2d_1 (Conv2D)           (None, 56, 56, 128)          8192      ['activation[0][0]']          batch_normalization_2 (Bat  (None, 56, 56, 128)          512       ['conv2d_1[0][0]']            chNormalization)                                                                                 activation_1 (Activation)   (None, 56, 56, 128)          0         ['batch_normalization_2[0][0]']                             conv2d_2 (Conv2D)           (None, 56, 56, 32)           36864     ['activation_1[0][0]']        concatenate (Concatenate)   (None, 56, 56, 96)           0         ['max_pooling2d[0][0]',       'conv2d_2[0][0]']            activation_2 (Activation)   (None, 56, 56, 96)           0         ['concatenate[0][0]']         conv2d_3 (Conv2D)           (None, 56, 56, 128)          12288     ['activation_2[0][0]']        batch_normalization_4 (Bat  (None, 56, 56, 128)          512       ['conv2d_3[0][0]']            chNormalization)                                                                                 activation_3 (Activation)   (None, 56, 56, 128)          0         ['batch_normalization_4[0][0]']                             conv2d_4 (Conv2D)           (None, 56, 56, 32)           36864     ['activation_3[0][0]']        concatenate_1 (Concatenate  (None, 56, 56, 128)          0         ['concatenate[0][0]',         )                                                                   'conv2d_4[0][0]']            activation_4 (Activation)   (None, 56, 56, 128)          0         ['concatenate_1[0][0]']       conv2d_5 (Conv2D)           (None, 56, 56, 128)          16384     ['activation_4[0][0]']        batch_normalization_6 (Bat  (None, 56, 56, 128)          512       ['conv2d_5[0][0]']            chNormalization)                                                                                 activation_5 (Activation)   (None, 56, 56, 128)          0         ['batch_normalization_6[0][0]']                             conv2d_6 (Conv2D)           (None, 56, 56, 32)           36864     ['activation_5[0][0]']        concatenate_2 (Concatenate  (None, 56, 56, 160)          0         ['concatenate_1[0][0]',       )                                                                   'conv2d_6[0][0]']            activation_6 (Activation)   (None, 56, 56, 160)          0         ['concatenate_2[0][0]']       conv2d_7 (Conv2D)           (None, 56, 56, 128)          20480     ['activation_6[0][0]']        batch_normalization_8 (Bat  (None, 56, 56, 128)          512       ['conv2d_7[0][0]']            chNormalization)                                                                                 activation_7 (Activation)   (None, 56, 56, 128)          0         ['batch_normalization_8[0][0]']                             conv2d_8 (Conv2D)           (None, 56, 56, 32)           36864     ['activation_7[0][0]']        concatenate_3 (Concatenate  (None, 56, 56, 192)          0         ['concatenate_2[0][0]',       )                                                                   'conv2d_8[0][0]']            activation_8 (Activation)   (None, 56, 56, 192)          0         ['concatenate_3[0][0]']       conv2d_9 (Conv2D)           (None, 56, 56, 128)          24576     ['activation_8[0][0]']        batch_normalization_10 (Ba  (None, 56, 56, 128)          512       ['conv2d_9[0][0]']            tchNormalization)                                                                                activation_9 (Activation)   (None, 56, 56, 128)          0         ['batch_normalization_10[0][0]']                            conv2d_10 (Conv2D)          (None, 56, 56, 32)           36864     ['activation_9[0][0]']        concatenate_4 (Concatenate  (None, 56, 56, 224)          0         ['concatenate_3[0][0]',       )                                                                   'conv2d_10[0][0]']           activation_10 (Activation)  (None, 56, 56, 224)          0         ['concatenate_4[0][0]']       conv2d_11 (Conv2D)          (None, 56, 56, 128)          28672     ['activation_10[0][0]']       batch_normalization_12 (Ba  (None, 56, 56, 128)          512       ['conv2d_11[0][0]']           tchNormalization)                                                                                activation_11 (Activation)  (None, 56, 56, 128)          0         ['batch_normalization_12[0][0]']                            conv2d_12 (Conv2D)          (None, 56, 56, 32)           36864     ['activation_11[0][0]']       concatenate_5 (Concatenate  (None, 56, 56, 256)          0         ['concatenate_4[0][0]',       )                                                                   'conv2d_12[0][0]']           batch_normalization_13 (Ba  (None, 56, 56, 256)          1024      ['concatenate_5[0][0]']       tchNormalization)                                                                                activation_12 (Activation)  (None, 56, 56, 256)          0         ['batch_normalization_13[0][0]']                            conv2d_13 (Conv2D)          (None, 56, 56, 128)          32768     ['activation_12[0][0]']       average_pooling2d (Average  (None, 28, 28, 128)          0         ['conv2d_13[0][0]']           Pooling2D)                                                                                       activation_13 (Activation)  (None, 28, 28, 128)          0         ['average_pooling2d[0][0]']   conv2d_14 (Conv2D)          (None, 28, 28, 128)          16384     ['activation_13[0][0]']       batch_normalization_15 (Ba  (None, 28, 28, 128)          512       ['conv2d_14[0][0]']           tchNormalization)                                                                                activation_14 (Activation)  (None, 28, 28, 128)          0         ['batch_normalization_15[0][0]']                            conv2d_15 (Conv2D)          (None, 28, 28, 32)           36864     ['activation_14[0][0]']       concatenate_6 (Concatenate  (None, 28, 28, 160)          0         ['average_pooling2d[0][0]',   )                                                                   'conv2d_15[0][0]']           activation_15 (Activation)  (None, 28, 28, 160)          0         ['concatenate_6[0][0]']       conv2d_16 (Conv2D)          (None, 28, 28, 128)          20480     ['activation_15[0][0]']       batch_normalization_17 (Ba  (None, 28, 28, 128)          512       ['conv2d_16[0][0]']           tchNormalization)                                                                                activation_16 (Activation)  (None, 28, 28, 128)          0         ['batch_normalization_17[0][0]']                            conv2d_17 (Conv2D)          (None, 28, 28, 32)           36864     ['activation_16[0][0]']       concatenate_7 (Concatenate  (None, 28, 28, 192)          0         ['concatenate_6[0][0]',       )                                                                   'conv2d_17[0][0]']           activation_17 (Activation)  (None, 28, 28, 192)          0         ['concatenate_7[0][0]']       conv2d_18 (Conv2D)          (None, 28, 28, 128)          24576     ['activation_17[0][0]']       batch_normalization_19 (Ba  (None, 28, 28, 128)          512       ['conv2d_18[0][0]']           tchNormalization)                                                                                activation_18 (Activation)  (None, 28, 28, 128)          0         ['batch_normalization_19[0][0]']                            conv2d_19 (Conv2D)          (None, 28, 28, 32)           36864     ['activation_18[0][0]']       concatenate_8 (Concatenate  (None, 28, 28, 224)          0         ['concatenate_7[0][0]',       )                                                                   'conv2d_19[0][0]']           activation_19 (Activation)  (None, 28, 28, 224)          0         ['concatenate_8[0][0]']       conv2d_20 (Conv2D)          (None, 28, 28, 128)          28672     ['activation_19[0][0]']       batch_normalization_21 (Ba  (None, 28, 28, 128)          512       ['conv2d_20[0][0]']           tchNormalization)                                                                                activation_20 (Activation)  (None, 28, 28, 128)          0         ['batch_normalization_21[0][0]']                            conv2d_21 (Conv2D)          (None, 28, 28, 32)           36864     ['activation_20[0][0]']       concatenate_9 (Concatenate  (None, 28, 28, 256)          0         ['concatenate_8[0][0]',       )                                                                   'conv2d_21[0][0]']           activation_21 (Activation)  (None, 28, 28, 256)          0         ['concatenate_9[0][0]']       conv2d_22 (Conv2D)          (None, 28, 28, 128)          32768     ['activation_21[0][0]']       batch_normalization_23 (Ba  (None, 28, 28, 128)          512       ['conv2d_22[0][0]']           tchNormalization)                                                                                activation_22 (Activation)  (None, 28, 28, 128)          0         ['batch_normalization_23[0][0]']                            conv2d_23 (Conv2D)          (None, 28, 28, 32)           36864     ['activation_22[0][0]']       concatenate_10 (Concatenat  (None, 28, 28, 288)          0         ['concatenate_9[0][0]',       e)                                                                  'conv2d_23[0][0]']           activation_23 (Activation)  (None, 28, 28, 288)          0         ['concatenate_10[0][0]']      conv2d_24 (Conv2D)          (None, 28, 28, 128)          36864     ['activation_23[0][0]']       batch_normalization_25 (Ba  (None, 28, 28, 128)          512       ['conv2d_24[0][0]']           tchNormalization)                                                                                activation_24 (Activation)  (None, 28, 28, 128)          0         ['batch_normalization_25[0][0]']                            conv2d_25 (Conv2D)          (None, 28, 28, 32)           36864     ['activation_24[0][0]']       concatenate_11 (Concatenat  (None, 28, 28, 320)          0         ['concatenate_10[0][0]',      e)                                                                  'conv2d_25[0][0]']           activation_25 (Activation)  (None, 28, 28, 320)          0         ['concatenate_11[0][0]']      conv2d_26 (Conv2D)          (None, 28, 28, 128)          40960     ['activation_25[0][0]']       batch_normalization_27 (Ba  (None, 28, 28, 128)          512       ['conv2d_26[0][0]']           tchNormalization)                                                                                activation_26 (Activation)  (None, 28, 28, 128)          0         ['batch_normalization_27[0][0]']                            conv2d_27 (Conv2D)          (None, 28, 28, 32)           36864     ['activation_26[0][0]']       concatenate_12 (Concatenat  (None, 28, 28, 352)          0         ['concatenate_11[0][0]',      e)                                                                  'conv2d_27[0][0]']           activation_27 (Activation)  (None, 28, 28, 352)          0         ['concatenate_12[0][0]']      conv2d_28 (Conv2D)          (None, 28, 28, 128)          45056     ['activation_27[0][0]']       batch_normalization_29 (Ba  (None, 28, 28, 128)          512       ['conv2d_28[0][0]']           tchNormalization)                                                                                activation_28 (Activation)  (None, 28, 28, 128)          0         ['batch_normalization_29[0][0]']                            conv2d_29 (Conv2D)          (None, 28, 28, 32)           36864     ['activation_28[0][0]']       concatenate_13 (Concatenat  (None, 28, 28, 384)          0         ['concatenate_12[0][0]',      e)                                                                  'conv2d_29[0][0]']           activation_29 (Activation)  (None, 28, 28, 384)          0         ['concatenate_13[0][0]']      conv2d_30 (Conv2D)          (None, 28, 28, 128)          49152     ['activation_29[0][0]']       batch_normalization_31 (Ba  (None, 28, 28, 128)          512       ['conv2d_30[0][0]']           tchNormalization)                                                                                activation_30 (Activation)  (None, 28, 28, 128)          0         ['batch_normalization_31[0][0]']                            conv2d_31 (Conv2D)          (None, 28, 28, 32)           36864     ['activation_30[0][0]']       concatenate_14 (Concatenat  (None, 28, 28, 416)          0         ['concatenate_13[0][0]',      e)                                                                  'conv2d_31[0][0]']           activation_31 (Activation)  (None, 28, 28, 416)          0         ['concatenate_14[0][0]']      conv2d_32 (Conv2D)          (None, 28, 28, 128)          53248     ['activation_31[0][0]']       batch_normalization_33 (Ba  (None, 28, 28, 128)          512       ['conv2d_32[0][0]']           tchNormalization)                                                                                activation_32 (Activation)  (None, 28, 28, 128)          0         ['batch_normalization_33[0][0]']                            conv2d_33 (Conv2D)          (None, 28, 28, 32)           36864     ['activation_32[0][0]']       concatenate_15 (Concatenat  (None, 28, 28, 448)          0         ['concatenate_14[0][0]',      e)                                                                  'conv2d_33[0][0]']           activation_33 (Activation)  (None, 28, 28, 448)          0         ['concatenate_15[0][0]']      conv2d_34 (Conv2D)          (None, 28, 28, 128)          57344     ['activation_33[0][0]']       batch_normalization_35 (Ba  (None, 28, 28, 128)          512       ['conv2d_34[0][0]']           tchNormalization)                                                                                activation_34 (Activation)  (None, 28, 28, 128)          0         ['batch_normalization_35[0][0]']                            conv2d_35 (Conv2D)          (None, 28, 28, 32)           36864     ['activation_34[0][0]']       concatenate_16 (Concatenat  (None, 28, 28, 480)          0         ['concatenate_15[0][0]',      e)                                                                  'conv2d_35[0][0]']           activation_35 (Activation)  (None, 28, 28, 480)          0         ['concatenate_16[0][0]']      conv2d_36 (Conv2D)          (None, 28, 28, 128)          61440     ['activation_35[0][0]']       batch_normalization_37 (Ba  (None, 28, 28, 128)          512       ['conv2d_36[0][0]']           tchNormalization)                                                                                activation_36 (Activation)  (None, 28, 28, 128)          0         ['batch_normalization_37[0][0]']                            conv2d_37 (Conv2D)          (None, 28, 28, 32)           36864     ['activation_36[0][0]']       concatenate_17 (Concatenat  (None, 28, 28, 512)          0         ['concatenate_16[0][0]',      e)                                                                  'conv2d_37[0][0]']           batch_normalization_38 (Ba  (None, 28, 28, 512)          2048      ['concatenate_17[0][0]']      tchNormalization)                                                                                activation_37 (Activation)  (None, 28, 28, 512)          0         ['batch_normalization_38[0][0]']                            conv2d_38 (Conv2D)          (None, 28, 28, 256)          131072    ['activation_37[0][0]']       average_pooling2d_1 (Avera  (None, 14, 14, 256)          0         ['conv2d_38[0][0]']           gePooling2D)                                                                                     activation_38 (Activation)  (None, 14, 14, 256)          0         ['average_pooling2d_1[0][0]'] conv2d_39 (Conv2D)          (None, 14, 14, 128)          32768     ['activation_38[0][0]']       batch_normalization_40 (Ba  (None, 14, 14, 128)          512       ['conv2d_39[0][0]']           tchNormalization)                                                                                activation_39 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_40[0][0]']                            conv2d_40 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_39[0][0]']       concatenate_18 (Concatenat  (None, 14, 14, 288)          0         ['average_pooling2d_1[0][0]', e)                                                                  'conv2d_40[0][0]']           activation_40 (Activation)  (None, 14, 14, 288)          0         ['concatenate_18[0][0]']      conv2d_41 (Conv2D)          (None, 14, 14, 128)          36864     ['activation_40[0][0]']       batch_normalization_42 (Ba  (None, 14, 14, 128)          512       ['conv2d_41[0][0]']           tchNormalization)                                                                                activation_41 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_42[0][0]']                            conv2d_42 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_41[0][0]']       concatenate_19 (Concatenat  (None, 14, 14, 320)          0         ['concatenate_18[0][0]',      e)                                                                  'conv2d_42[0][0]']           activation_42 (Activation)  (None, 14, 14, 320)          0         ['concatenate_19[0][0]']      conv2d_43 (Conv2D)          (None, 14, 14, 128)          40960     ['activation_42[0][0]']       batch_normalization_44 (Ba  (None, 14, 14, 128)          512       ['conv2d_43[0][0]']           tchNormalization)                                                                                activation_43 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_44[0][0]']                            conv2d_44 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_43[0][0]']       concatenate_20 (Concatenat  (None, 14, 14, 352)          0         ['concatenate_19[0][0]',      e)                                                                  'conv2d_44[0][0]']           activation_44 (Activation)  (None, 14, 14, 352)          0         ['concatenate_20[0][0]']      conv2d_45 (Conv2D)          (None, 14, 14, 128)          45056     ['activation_44[0][0]']       batch_normalization_46 (Ba  (None, 14, 14, 128)          512       ['conv2d_45[0][0]']           tchNormalization)                                                                                activation_45 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_46[0][0]']                            conv2d_46 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_45[0][0]']       concatenate_21 (Concatenat  (None, 14, 14, 384)          0         ['concatenate_20[0][0]',      e)                                                                  'conv2d_46[0][0]']           activation_46 (Activation)  (None, 14, 14, 384)          0         ['concatenate_21[0][0]']      conv2d_47 (Conv2D)          (None, 14, 14, 128)          49152     ['activation_46[0][0]']       batch_normalization_48 (Ba  (None, 14, 14, 128)          512       ['conv2d_47[0][0]']           tchNormalization)                                                                                activation_47 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_48[0][0]']                            conv2d_48 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_47[0][0]']       concatenate_22 (Concatenat  (None, 14, 14, 416)          0         ['concatenate_21[0][0]',      e)                                                                  'conv2d_48[0][0]']           activation_48 (Activation)  (None, 14, 14, 416)          0         ['concatenate_22[0][0]']      conv2d_49 (Conv2D)          (None, 14, 14, 128)          53248     ['activation_48[0][0]']       batch_normalization_50 (Ba  (None, 14, 14, 128)          512       ['conv2d_49[0][0]']           tchNormalization)                                                                                activation_49 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_50[0][0]']                            conv2d_50 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_49[0][0]']       concatenate_23 (Concatenat  (None, 14, 14, 448)          0         ['concatenate_22[0][0]',      e)                                                                  'conv2d_50[0][0]']           activation_50 (Activation)  (None, 14, 14, 448)          0         ['concatenate_23[0][0]']      conv2d_51 (Conv2D)          (None, 14, 14, 128)          57344     ['activation_50[0][0]']       batch_normalization_52 (Ba  (None, 14, 14, 128)          512       ['conv2d_51[0][0]']           tchNormalization)                                                                                activation_51 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_52[0][0]']                            conv2d_52 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_51[0][0]']       concatenate_24 (Concatenat  (None, 14, 14, 480)          0         ['concatenate_23[0][0]',      e)                                                                  'conv2d_52[0][0]']           activation_52 (Activation)  (None, 14, 14, 480)          0         ['concatenate_24[0][0]']      conv2d_53 (Conv2D)          (None, 14, 14, 128)          61440     ['activation_52[0][0]']       batch_normalization_54 (Ba  (None, 14, 14, 128)          512       ['conv2d_53[0][0]']           tchNormalization)                                                                                activation_53 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_54[0][0]']                            conv2d_54 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_53[0][0]']       concatenate_25 (Concatenat  (None, 14, 14, 512)          0         ['concatenate_24[0][0]',      e)                                                                  'conv2d_54[0][0]']           activation_54 (Activation)  (None, 14, 14, 512)          0         ['concatenate_25[0][0]']      conv2d_55 (Conv2D)          (None, 14, 14, 128)          65536     ['activation_54[0][0]']       batch_normalization_56 (Ba  (None, 14, 14, 128)          512       ['conv2d_55[0][0]']           tchNormalization)                                                                                activation_55 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_56[0][0]']                            conv2d_56 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_55[0][0]']       concatenate_26 (Concatenat  (None, 14, 14, 544)          0         ['concatenate_25[0][0]',      e)                                                                  'conv2d_56[0][0]']           activation_56 (Activation)  (None, 14, 14, 544)          0         ['concatenate_26[0][0]']      conv2d_57 (Conv2D)          (None, 14, 14, 128)          69632     ['activation_56[0][0]']       batch_normalization_58 (Ba  (None, 14, 14, 128)          512       ['conv2d_57[0][0]']           tchNormalization)                                                                                activation_57 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_58[0][0]']                            conv2d_58 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_57[0][0]']       concatenate_27 (Concatenat  (None, 14, 14, 576)          0         ['concatenate_26[0][0]',      e)                                                                  'conv2d_58[0][0]']           activation_58 (Activation)  (None, 14, 14, 576)          0         ['concatenate_27[0][0]']      conv2d_59 (Conv2D)          (None, 14, 14, 128)          73728     ['activation_58[0][0]']       batch_normalization_60 (Ba  (None, 14, 14, 128)          512       ['conv2d_59[0][0]']           tchNormalization)                                                                                activation_59 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_60[0][0]']                            conv2d_60 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_59[0][0]']       concatenate_28 (Concatenat  (None, 14, 14, 608)          0         ['concatenate_27[0][0]',      e)                                                                  'conv2d_60[0][0]']           activation_60 (Activation)  (None, 14, 14, 608)          0         ['concatenate_28[0][0]']      conv2d_61 (Conv2D)          (None, 14, 14, 128)          77824     ['activation_60[0][0]']       batch_normalization_62 (Ba  (None, 14, 14, 128)          512       ['conv2d_61[0][0]']           tchNormalization)                                                                                activation_61 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_62[0][0]']                            conv2d_62 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_61[0][0]']       concatenate_29 (Concatenat  (None, 14, 14, 640)          0         ['concatenate_28[0][0]',      e)                                                                  'conv2d_62[0][0]']           activation_62 (Activation)  (None, 14, 14, 640)          0         ['concatenate_29[0][0]']      conv2d_63 (Conv2D)          (None, 14, 14, 128)          81920     ['activation_62[0][0]']       batch_normalization_64 (Ba  (None, 14, 14, 128)          512       ['conv2d_63[0][0]']           tchNormalization)                                                                                activation_63 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_64[0][0]']                            conv2d_64 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_63[0][0]']       concatenate_30 (Concatenat  (None, 14, 14, 672)          0         ['concatenate_29[0][0]',      e)                                                                  'conv2d_64[0][0]']           activation_64 (Activation)  (None, 14, 14, 672)          0         ['concatenate_30[0][0]']      conv2d_65 (Conv2D)          (None, 14, 14, 128)          86016     ['activation_64[0][0]']       batch_normalization_66 (Ba  (None, 14, 14, 128)          512       ['conv2d_65[0][0]']           tchNormalization)                                                                                activation_65 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_66[0][0]']                            conv2d_66 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_65[0][0]']       concatenate_31 (Concatenat  (None, 14, 14, 704)          0         ['concatenate_30[0][0]',      e)                                                                  'conv2d_66[0][0]']           activation_66 (Activation)  (None, 14, 14, 704)          0         ['concatenate_31[0][0]']      conv2d_67 (Conv2D)          (None, 14, 14, 128)          90112     ['activation_66[0][0]']       batch_normalization_68 (Ba  (None, 14, 14, 128)          512       ['conv2d_67[0][0]']           tchNormalization)                                                                                activation_67 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_68[0][0]']                            conv2d_68 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_67[0][0]']       concatenate_32 (Concatenat  (None, 14, 14, 736)          0         ['concatenate_31[0][0]',      e)                                                                  'conv2d_68[0][0]']           activation_68 (Activation)  (None, 14, 14, 736)          0         ['concatenate_32[0][0]']      conv2d_69 (Conv2D)          (None, 14, 14, 128)          94208     ['activation_68[0][0]']       batch_normalization_70 (Ba  (None, 14, 14, 128)          512       ['conv2d_69[0][0]']           tchNormalization)                                                                                activation_69 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_70[0][0]']                            conv2d_70 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_69[0][0]']       concatenate_33 (Concatenat  (None, 14, 14, 768)          0         ['concatenate_32[0][0]',      e)                                                                  'conv2d_70[0][0]']           activation_70 (Activation)  (None, 14, 14, 768)          0         ['concatenate_33[0][0]']      conv2d_71 (Conv2D)          (None, 14, 14, 128)          98304     ['activation_70[0][0]']       batch_normalization_72 (Ba  (None, 14, 14, 128)          512       ['conv2d_71[0][0]']           tchNormalization)                                                                                activation_71 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_72[0][0]']                            conv2d_72 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_71[0][0]']       concatenate_34 (Concatenat  (None, 14, 14, 800)          0         ['concatenate_33[0][0]',      e)                                                                  'conv2d_72[0][0]']           activation_72 (Activation)  (None, 14, 14, 800)          0         ['concatenate_34[0][0]']      conv2d_73 (Conv2D)          (None, 14, 14, 128)          102400    ['activation_72[0][0]']       batch_normalization_74 (Ba  (None, 14, 14, 128)          512       ['conv2d_73[0][0]']           tchNormalization)                                                                                activation_73 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_74[0][0]']                            conv2d_74 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_73[0][0]']       concatenate_35 (Concatenat  (None, 14, 14, 832)          0         ['concatenate_34[0][0]',      e)                                                                  'conv2d_74[0][0]']           activation_74 (Activation)  (None, 14, 14, 832)          0         ['concatenate_35[0][0]']      conv2d_75 (Conv2D)          (None, 14, 14, 128)          106496    ['activation_74[0][0]']       batch_normalization_76 (Ba  (None, 14, 14, 128)          512       ['conv2d_75[0][0]']           tchNormalization)                                                                                activation_75 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_76[0][0]']                            conv2d_76 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_75[0][0]']       concatenate_36 (Concatenat  (None, 14, 14, 864)          0         ['concatenate_35[0][0]',      e)                                                                  'conv2d_76[0][0]']           activation_76 (Activation)  (None, 14, 14, 864)          0         ['concatenate_36[0][0]']      conv2d_77 (Conv2D)          (None, 14, 14, 128)          110592    ['activation_76[0][0]']       batch_normalization_78 (Ba  (None, 14, 14, 128)          512       ['conv2d_77[0][0]']           tchNormalization)                                                                                activation_77 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_78[0][0]']                            conv2d_78 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_77[0][0]']       concatenate_37 (Concatenat  (None, 14, 14, 896)          0         ['concatenate_36[0][0]',      e)                                                                  'conv2d_78[0][0]']           activation_78 (Activation)  (None, 14, 14, 896)          0         ['concatenate_37[0][0]']      conv2d_79 (Conv2D)          (None, 14, 14, 128)          114688    ['activation_78[0][0]']       batch_normalization_80 (Ba  (None, 14, 14, 128)          512       ['conv2d_79[0][0]']           tchNormalization)                                                                                activation_79 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_80[0][0]']                            conv2d_80 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_79[0][0]']       concatenate_38 (Concatenat  (None, 14, 14, 928)          0         ['concatenate_37[0][0]',      e)                                                                  'conv2d_80[0][0]']           activation_80 (Activation)  (None, 14, 14, 928)          0         ['concatenate_38[0][0]']      conv2d_81 (Conv2D)          (None, 14, 14, 128)          118784    ['activation_80[0][0]']       batch_normalization_82 (Ba  (None, 14, 14, 128)          512       ['conv2d_81[0][0]']           tchNormalization)                                                                                activation_81 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_82[0][0]']                            conv2d_82 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_81[0][0]']       concatenate_39 (Concatenat  (None, 14, 14, 960)          0         ['concatenate_38[0][0]',      e)                                                                  'conv2d_82[0][0]']           activation_82 (Activation)  (None, 14, 14, 960)          0         ['concatenate_39[0][0]']      conv2d_83 (Conv2D)          (None, 14, 14, 128)          122880    ['activation_82[0][0]']       batch_normalization_84 (Ba  (None, 14, 14, 128)          512       ['conv2d_83[0][0]']           tchNormalization)                                                                                activation_83 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_84[0][0]']                            conv2d_84 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_83[0][0]']       concatenate_40 (Concatenat  (None, 14, 14, 992)          0         ['concatenate_39[0][0]',      e)                                                                  'conv2d_84[0][0]']           activation_84 (Activation)  (None, 14, 14, 992)          0         ['concatenate_40[0][0]']      conv2d_85 (Conv2D)          (None, 14, 14, 128)          126976    ['activation_84[0][0]']       batch_normalization_86 (Ba  (None, 14, 14, 128)          512       ['conv2d_85[0][0]']           tchNormalization)                                                                                activation_85 (Activation)  (None, 14, 14, 128)          0         ['batch_normalization_86[0][0]']                            conv2d_86 (Conv2D)          (None, 14, 14, 32)           36864     ['activation_85[0][0]']       concatenate_41 (Concatenat  (None, 14, 14, 1024)         0         ['concatenate_40[0][0]',      e)                                                                  'conv2d_86[0][0]']           batch_normalization_87 (Ba  (None, 14, 14, 1024)         4096      ['concatenate_41[0][0]']      tchNormalization)                                                                                activation_86 (Activation)  (None, 14, 14, 1024)         0         ['batch_normalization_87[0][0]']                            conv2d_87 (Conv2D)          (None, 14, 14, 512)          524288    ['activation_86[0][0]']       average_pooling2d_2 (Avera  (None, 7, 7, 512)            0         ['conv2d_87[0][0]']           gePooling2D)                                                                                     activation_87 (Activation)  (None, 7, 7, 512)            0         ['average_pooling2d_2[0][0]'] conv2d_88 (Conv2D)          (None, 7, 7, 128)            65536     ['activation_87[0][0]']       batch_normalization_89 (Ba  (None, 7, 7, 128)            512       ['conv2d_88[0][0]']           tchNormalization)                                                                                activation_88 (Activation)  (None, 7, 7, 128)            0         ['batch_normalization_89[0][0]']                            conv2d_89 (Conv2D)          (None, 7, 7, 32)             36864     ['activation_88[0][0]']       concatenate_42 (Concatenat  (None, 7, 7, 544)            0         ['average_pooling2d_2[0][0]', e)                                                                  'conv2d_89[0][0]']           activation_89 (Activation)  (None, 7, 7, 544)            0         ['concatenate_42[0][0]']      conv2d_90 (Conv2D)          (None, 7, 7, 128)            69632     ['activation_89[0][0]']       batch_normalization_91 (Ba  (None, 7, 7, 128)            512       ['conv2d_90[0][0]']           tchNormalization)                                                                                activation_90 (Activation)  (None, 7, 7, 128)            0         ['batch_normalization_91[0][0]']                            conv2d_91 (Conv2D)          (None, 7, 7, 32)             36864     ['activation_90[0][0]']       concatenate_43 (Concatenat  (None, 7, 7, 576)            0         ['concatenate_42[0][0]',      e)                                                                  'conv2d_91[0][0]']           activation_91 (Activation)  (None, 7, 7, 576)            0         ['concatenate_43[0][0]']      conv2d_92 (Conv2D)          (None, 7, 7, 128)            73728     ['activation_91[0][0]']       batch_normalization_93 (Ba  (None, 7, 7, 128)            512       ['conv2d_92[0][0]']           tchNormalization)                                                                                activation_92 (Activation)  (None, 7, 7, 128)            0         ['batch_normalization_93[0][0]']                            conv2d_93 (Conv2D)          (None, 7, 7, 32)             36864     ['activation_92[0][0]']       concatenate_44 (Concatenat  (None, 7, 7, 608)            0         ['concatenate_43[0][0]',      e)                                                                  'conv2d_93[0][0]']           activation_93 (Activation)  (None, 7, 7, 608)            0         ['concatenate_44[0][0]']      conv2d_94 (Conv2D)          (None, 7, 7, 128)            77824     ['activation_93[0][0]']       batch_normalization_95 (Ba  (None, 7, 7, 128)            512       ['conv2d_94[0][0]']           tchNormalization)                                                                                activation_94 (Activation)  (None, 7, 7, 128)            0         ['batch_normalization_95[0][0]']                            conv2d_95 (Conv2D)          (None, 7, 7, 32)             36864     ['activation_94[0][0]']       concatenate_45 (Concatenat  (None, 7, 7, 640)            0         ['concatenate_44[0][0]',      e)                                                                  'conv2d_95[0][0]']           activation_95 (Activation)  (None, 7, 7, 640)            0         ['concatenate_45[0][0]']      conv2d_96 (Conv2D)          (None, 7, 7, 128)            81920     ['activation_95[0][0]']       batch_normalization_97 (Ba  (None, 7, 7, 128)            512       ['conv2d_96[0][0]']           tchNormalization)                                                                                activation_96 (Activation)  (None, 7, 7, 128)            0         ['batch_normalization_97[0][0]']                            conv2d_97 (Conv2D)          (None, 7, 7, 32)             36864     ['activation_96[0][0]']       concatenate_46 (Concatenat  (None, 7, 7, 672)            0         ['concatenate_45[0][0]',      e)                                                                  'conv2d_97[0][0]']           activation_97 (Activation)  (None, 7, 7, 672)            0         ['concatenate_46[0][0]']      conv2d_98 (Conv2D)          (None, 7, 7, 128)            86016     ['activation_97[0][0]']       batch_normalization_99 (Ba  (None, 7, 7, 128)            512       ['conv2d_98[0][0]']           tchNormalization)                                                                                activation_98 (Activation)  (None, 7, 7, 128)            0         ['batch_normalization_99[0][0]']                            conv2d_99 (Conv2D)          (None, 7, 7, 32)             36864     ['activation_98[0][0]']       concatenate_47 (Concatenat  (None, 7, 7, 704)            0         ['concatenate_46[0][0]',      e)                                                                  'conv2d_99[0][0]']           activation_99 (Activation)  (None, 7, 7, 704)            0         ['concatenate_47[0][0]']      conv2d_100 (Conv2D)         (None, 7, 7, 128)            90112     ['activation_99[0][0]']       batch_normalization_101 (B  (None, 7, 7, 128)            512       ['conv2d_100[0][0]']          atchNormalization)                                                                               activation_100 (Activation  (None, 7, 7, 128)            0         ['batch_normalization_101[0][0)                                                                  ]']                           conv2d_101 (Conv2D)         (None, 7, 7, 32)             36864     ['activation_100[0][0]']      concatenate_48 (Concatenat  (None, 7, 7, 736)            0         ['concatenate_47[0][0]',      e)                                                                  'conv2d_101[0][0]']          activation_101 (Activation  (None, 7, 7, 736)            0         ['concatenate_48[0][0]']      )                                                                                                conv2d_102 (Conv2D)         (None, 7, 7, 128)            94208     ['activation_101[0][0]']      batch_normalization_103 (B  (None, 7, 7, 128)            512       ['conv2d_102[0][0]']          atchNormalization)                                                                               activation_102 (Activation  (None, 7, 7, 128)            0         ['batch_normalization_103[0][0)                                                                  ]']                           conv2d_103 (Conv2D)         (None, 7, 7, 32)             36864     ['activation_102[0][0]']      concatenate_49 (Concatenat  (None, 7, 7, 768)            0         ['concatenate_48[0][0]',      e)                                                                  'conv2d_103[0][0]']          activation_103 (Activation  (None, 7, 7, 768)            0         ['concatenate_49[0][0]']      )                                                                                                conv2d_104 (Conv2D)         (None, 7, 7, 128)            98304     ['activation_103[0][0]']      batch_normalization_105 (B  (None, 7, 7, 128)            512       ['conv2d_104[0][0]']          atchNormalization)                                                                               activation_104 (Activation  (None, 7, 7, 128)            0         ['batch_normalization_105[0][0)                                                                  ]']                           conv2d_105 (Conv2D)         (None, 7, 7, 32)             36864     ['activation_104[0][0]']      concatenate_50 (Concatenat  (None, 7, 7, 800)            0         ['concatenate_49[0][0]',      e)                                                                  'conv2d_105[0][0]']          activation_105 (Activation  (None, 7, 7, 800)            0         ['concatenate_50[0][0]']      )                                                                                                conv2d_106 (Conv2D)         (None, 7, 7, 128)            102400    ['activation_105[0][0]']      batch_normalization_107 (B  (None, 7, 7, 128)            512       ['conv2d_106[0][0]']          atchNormalization)                                                                               activation_106 (Activation  (None, 7, 7, 128)            0         ['batch_normalization_107[0][0)                                                                  ]']                           conv2d_107 (Conv2D)         (None, 7, 7, 32)             36864     ['activation_106[0][0]']      concatenate_51 (Concatenat  (None, 7, 7, 832)            0         ['concatenate_50[0][0]',      e)                                                                  'conv2d_107[0][0]']          activation_107 (Activation  (None, 7, 7, 832)            0         ['concatenate_51[0][0]']      )                                                                                                conv2d_108 (Conv2D)         (None, 7, 7, 128)            106496    ['activation_107[0][0]']      batch_normalization_109 (B  (None, 7, 7, 128)            512       ['conv2d_108[0][0]']          atchNormalization)                                                                               activation_108 (Activation  (None, 7, 7, 128)            0         ['batch_normalization_109[0][0)                                                                  ]']                           conv2d_109 (Conv2D)         (None, 7, 7, 32)             36864     ['activation_108[0][0]']      concatenate_52 (Concatenat  (None, 7, 7, 864)            0         ['concatenate_51[0][0]',      e)                                                                  'conv2d_109[0][0]']          activation_109 (Activation  (None, 7, 7, 864)            0         ['concatenate_52[0][0]']      )                                                                                                conv2d_110 (Conv2D)         (None, 7, 7, 128)            110592    ['activation_109[0][0]']      batch_normalization_111 (B  (None, 7, 7, 128)            512       ['conv2d_110[0][0]']          atchNormalization)                                                                               activation_110 (Activation  (None, 7, 7, 128)            0         ['batch_normalization_111[0][0)                                                                  ]']                           conv2d_111 (Conv2D)         (None, 7, 7, 32)             36864     ['activation_110[0][0]']      concatenate_53 (Concatenat  (None, 7, 7, 896)            0         ['concatenate_52[0][0]',      e)                                                                  'conv2d_111[0][0]']          activation_111 (Activation  (None, 7, 7, 896)            0         ['concatenate_53[0][0]']      )                                                                                                conv2d_112 (Conv2D)         (None, 7, 7, 128)            114688    ['activation_111[0][0]']      batch_normalization_113 (B  (None, 7, 7, 128)            512       ['conv2d_112[0][0]']          atchNormalization)                                                                               activation_112 (Activation  (None, 7, 7, 128)            0         ['batch_normalization_113[0][0)                                                                  ]']                           conv2d_113 (Conv2D)         (None, 7, 7, 32)             36864     ['activation_112[0][0]']      concatenate_54 (Concatenat  (None, 7, 7, 928)            0         ['concatenate_53[0][0]',      e)                                                                  'conv2d_113[0][0]']          activation_113 (Activation  (None, 7, 7, 928)            0         ['concatenate_54[0][0]']      )                                                                                                conv2d_114 (Conv2D)         (None, 7, 7, 128)            118784    ['activation_113[0][0]']      batch_normalization_115 (B  (None, 7, 7, 128)            512       ['conv2d_114[0][0]']          atchNormalization)                                                                               activation_114 (Activation  (None, 7, 7, 128)            0         ['batch_normalization_115[0][0)                                                                  ]']                           conv2d_115 (Conv2D)         (None, 7, 7, 32)             36864     ['activation_114[0][0]']      concatenate_55 (Concatenat  (None, 7, 7, 960)            0         ['concatenate_54[0][0]',      e)                                                                  'conv2d_115[0][0]']          activation_115 (Activation  (None, 7, 7, 960)            0         ['concatenate_55[0][0]']      )                                                                                                conv2d_116 (Conv2D)         (None, 7, 7, 128)            122880    ['activation_115[0][0]']      batch_normalization_117 (B  (None, 7, 7, 128)            512       ['conv2d_116[0][0]']          atchNormalization)                                                                               activation_116 (Activation  (None, 7, 7, 128)            0         ['batch_normalization_117[0][0)                                                                  ]']                           conv2d_117 (Conv2D)         (None, 7, 7, 32)             36864     ['activation_116[0][0]']      concatenate_56 (Concatenat  (None, 7, 7, 992)            0         ['concatenate_55[0][0]',      e)                                                                  'conv2d_117[0][0]']          activation_117 (Activation  (None, 7, 7, 992)            0         ['concatenate_56[0][0]']      )                                                                                                conv2d_118 (Conv2D)         (None, 7, 7, 128)            126976    ['activation_117[0][0]']      batch_normalization_119 (B  (None, 7, 7, 128)            512       ['conv2d_118[0][0]']          atchNormalization)                                                                               activation_118 (Activation  (None, 7, 7, 128)            0         ['batch_normalization_119[0][0)                                                                  ]']                           conv2d_119 (Conv2D)         (None, 7, 7, 32)             36864     ['activation_118[0][0]']      concatenate_57 (Concatenat  (None, 7, 7, 1024)           0         ['concatenate_56[0][0]',      e)                                                                  'conv2d_119[0][0]']          batch_normalization_120 (B  (None, 7, 7, 1024)           4096      ['concatenate_57[0][0]']      atchNormalization)                                                                               activation_119 (Activation  (None, 7, 7, 1024)           0         ['batch_normalization_120[0][0)                                                                  ]']                           global_average_pooling2d (  (None, 1024)                 0         ['activation_119[0][0]']      GlobalAveragePooling2D)                                                                          dense (Dense)               (None, 4)                    4100      ['global_average_pooling2d[0][0]']                          ==================================================================================================
Total params: 6915524 (26.38 MB)
Trainable params: 6894916 (26.30 MB)
Non-trainable params: 20608 (80.50 KB)

四、编译

在准备对模型进行训练之前,还需要再对其进行一些设置。以下内容是在模型的编译步骤中添加的:

损失函数(loss):用于衡量模型在训练期间的准确率。
优化器(optimizer):决定模型如何根据其看到的数据和自身的损失函数进行更新。
指标(metrics):用于监控训练和测试步骤。以下示例使用了准确率,即被正确分类的图像的比率。

#设置优化器
opt=tf.keras.optimizers.Adam(learning_rate=1e-4)model.compile(optimizer=opt,loss=tf.keras.losses.SparseCategoricalCrossentropy(),metrics=['accuracy'])

五、训练模型

epochs=50history=model.fit(train_ds,validation_data=val_ds,epochs=epochs
)

运行结果:

Epoch 1/50
215/215 [==============================] - 503s 2s/step - loss: 0.7688 - accuracy: 0.6126 - val_loss: 0.8110 - val_accuracy: 0.5748
Epoch 2/50
215/215 [==============================] - 490s 2s/step - loss: 0.6243 - accuracy: 0.6663 - val_loss: 0.6839 - val_accuracy: 0.6565
Epoch 3/50
215/215 [==============================] - 502s 2s/step - loss: 0.5891 - accuracy: 0.6890 - val_loss: 0.7193 - val_accuracy: 0.6028
Epoch 4/50
215/215 [==============================] - 494s 2s/step - loss: 0.5257 - accuracy: 0.7410 - val_loss: 0.5903 - val_accuracy: 0.6425
Epoch 5/50
215/215 [==============================] - 500s 2s/step - loss: 0.4632 - accuracy: 0.7847 - val_loss: 1.7842 - val_accuracy: 0.5000
Epoch 6/50
215/215 [==============================] - 495s 2s/step - loss: 0.4211 - accuracy: 0.8104 - val_loss: 0.4504 - val_accuracy: 0.7991
Epoch 7/50
215/215 [==============================] - 518s 2s/step - loss: 0.3487 - accuracy: 0.8582 - val_loss: 0.6944 - val_accuracy: 0.6846
Epoch 8/50
215/215 [==============================] - 509s 2s/step - loss: 0.3126 - accuracy: 0.8641 - val_loss: 0.8508 - val_accuracy: 0.6308
Epoch 9/50
215/215 [==============================] - 501s 2s/step - loss: 0.2512 - accuracy: 0.8985 - val_loss: 0.4950 - val_accuracy: 0.7687
Epoch 10/50
215/215 [==============================] - 500s 2s/step - loss: 0.2143 - accuracy: 0.9166 - val_loss: 0.4202 - val_accuracy: 0.8294
Epoch 11/50
215/215 [==============================] - 492s 2s/step - loss: 0.2079 - accuracy: 0.9131 - val_loss: 0.5640 - val_accuracy: 0.8131
Epoch 12/50
215/215 [==============================] - 484s 2s/step - loss: 0.1664 - accuracy: 0.9347 - val_loss: 0.4795 - val_accuracy: 0.8505
Epoch 13/50
215/215 [==============================] - 485s 2s/step - loss: 0.1393 - accuracy: 0.9492 - val_loss: 0.7909 - val_accuracy: 0.7523
Epoch 14/50
215/215 [==============================] - 485s 2s/step - loss: 0.1140 - accuracy: 0.9586 - val_loss: 0.4867 - val_accuracy: 0.8107
Epoch 15/50
215/215 [==============================] - 485s 2s/step - loss: 0.1082 - accuracy: 0.9603 - val_loss: 0.7982 - val_accuracy: 0.7710
Epoch 16/50
215/215 [==============================] - 485s 2s/step - loss: 0.1145 - accuracy: 0.9603 - val_loss: 1.1198 - val_accuracy: 0.7313
Epoch 17/50
215/215 [==============================] - 486s 2s/step - loss: 0.1114 - accuracy: 0.9580 - val_loss: 1.0163 - val_accuracy: 0.7710
Epoch 18/50
215/215 [==============================] - 486s 2s/step - loss: 0.0773 - accuracy: 0.9732 - val_loss: 0.5634 - val_accuracy: 0.8224
Epoch 19/50
215/215 [==============================] - 486s 2s/step - loss: 0.0346 - accuracy: 0.9918 - val_loss: 0.3425 - val_accuracy: 0.9042
Epoch 20/50
215/215 [==============================] - 485s 2s/step - loss: 0.0222 - accuracy: 0.9959 - val_loss: 0.5660 - val_accuracy: 0.8575
Epoch 21/50
215/215 [==============================] - 486s 2s/step - loss: 0.0870 - accuracy: 0.9702 - val_loss: 1.0307 - val_accuracy: 0.6916
Epoch 22/50
215/215 [==============================] - 487s 2s/step - loss: 0.1677 - accuracy: 0.9364 - val_loss: 0.5578 - val_accuracy: 0.8411
Epoch 23/50
215/215 [==============================] - 487s 2s/step - loss: 0.0665 - accuracy: 0.9772 - val_loss: 0.3254 - val_accuracy: 0.9136
Epoch 24/50
215/215 [==============================] - 487s 2s/step - loss: 0.0269 - accuracy: 0.9930 - val_loss: 0.4259 - val_accuracy: 0.8902
Epoch 25/50
215/215 [==============================] - 487s 2s/step - loss: 0.0170 - accuracy: 0.9947 - val_loss: 0.7115 - val_accuracy: 0.8341
Epoch 26/50
215/215 [==============================] - 486s 2s/step - loss: 0.0301 - accuracy: 0.9912 - val_loss: 0.6561 - val_accuracy: 0.8598
Epoch 27/50
215/215 [==============================] - 486s 2s/step - loss: 0.0815 - accuracy: 0.9726 - val_loss: 0.5297 - val_accuracy: 0.8411
Epoch 28/50
215/215 [==============================] - 487s 2s/step - loss: 0.1141 - accuracy: 0.9562 - val_loss: 0.4161 - val_accuracy: 0.8879
Epoch 29/50
215/215 [==============================] - 487s 2s/step - loss: 0.0538 - accuracy: 0.9831 - val_loss: 0.5807 - val_accuracy: 0.8621
Epoch 30/50
215/215 [==============================] - 487s 2s/step - loss: 0.0309 - accuracy: 0.9907 - val_loss: 0.3173 - val_accuracy: 0.9112
Epoch 31/50
215/215 [==============================] - 486s 2s/step - loss: 0.0164 - accuracy: 0.9971 - val_loss: 0.5159 - val_accuracy: 0.8388
Epoch 32/50
215/215 [==============================] - 486s 2s/step - loss: 0.0107 - accuracy: 0.9982 - val_loss: 0.3212 - val_accuracy: 0.9136
Epoch 33/50
215/215 [==============================] - 486s 2s/step - loss: 0.0031 - accuracy: 1.0000 - val_loss: 0.3175 - val_accuracy: 0.9229
Epoch 34/50
215/215 [==============================] - 486s 2s/step - loss: 0.0017 - accuracy: 1.0000 - val_loss: 0.2970 - val_accuracy: 0.9299
Epoch 35/50
215/215 [==============================] - 486s 2s/step - loss: 0.0015 - accuracy: 1.0000 - val_loss: 0.2981 - val_accuracy: 0.9252
Epoch 36/50
215/215 [==============================] - 487s 2s/step - loss: 0.0010 - accuracy: 1.0000 - val_loss: 0.3011 - val_accuracy: 0.9346
Epoch 37/50
215/215 [==============================] - 487s 2s/step - loss: 7.4752e-04 - accuracy: 1.0000 - val_loss: 0.3011 - val_accuracy: 0.9252
Epoch 38/50
215/215 [==============================] - 488s 2s/step - loss: 6.3077e-04 - accuracy: 1.0000 - val_loss: 0.2992 - val_accuracy: 0.9299
Epoch 39/50
215/215 [==============================] - 487s 2s/step - loss: 5.4920e-04 - accuracy: 1.0000 - val_loss: 0.3016 - val_accuracy: 0.9322
Epoch 40/50
215/215 [==============================] - 487s 2s/step - loss: 4.8682e-04 - accuracy: 1.0000 - val_loss: 0.3070 - val_accuracy: 0.9299
Epoch 41/50
215/215 [==============================] - 487s 2s/step - loss: 4.2537e-04 - accuracy: 1.0000 - val_loss: 0.3102 - val_accuracy: 0.9322
Epoch 42/50
215/215 [==============================] - 486s 2s/step - loss: 3.8510e-04 - accuracy: 1.0000 - val_loss: 0.3175 - val_accuracy: 0.9346
Epoch 43/50
215/215 [==============================] - 487s 2s/step - loss: 3.3861e-04 - accuracy: 1.0000 - val_loss: 0.3138 - val_accuracy: 0.9346
Epoch 44/50
215/215 [==============================] - 487s 2s/step - loss: 3.0387e-04 - accuracy: 1.0000 - val_loss: 0.3171 - val_accuracy: 0.9346
Epoch 45/50
215/215 [==============================] - 487s 2s/step - loss: 2.7470e-04 - accuracy: 1.0000 - val_loss: 0.3214 - val_accuracy: 0.9346
Epoch 46/50
215/215 [==============================] - 487s 2s/step - loss: 2.4226e-04 - accuracy: 1.0000 - val_loss: 0.3259 - val_accuracy: 0.9346
Epoch 47/50
215/215 [==============================] - 487s 2s/step - loss: 2.1893e-04 - accuracy: 1.0000 - val_loss: 0.3270 - val_accuracy: 0.9346
Epoch 48/50
215/215 [==============================] - 487s 2s/step - loss: 1.9667e-04 - accuracy: 1.0000 - val_loss: 0.3309 - val_accuracy: 0.9346
Epoch 49/50
215/215 [==============================] - 487s 2s/step - loss: 1.7684e-04 - accuracy: 1.0000 - val_loss: 0.3371 - val_accuracy: 0.9299
Epoch 50/50
215/215 [==============================] - 487s 2s/step - loss: 1.6318e-04 - accuracy: 1.0000 - val_loss: 0.3378 - val_accuracy: 0.9322

六、模型评估

acc=history.history['accuracy']
val_acc=history.history['val_accuracy']loss=history.history['loss']
val_loss=history.history['val_loss']epochs_range=range(epochs)plt.figure(figsize=(12,4))
plt.suptitle("OreoCC")plt.subplot(1,2,1)
plt.plot(epochs_range,acc,label='Training Accuracy')
plt.plot(epochs_range,val_acc,label='Validation Accuracy')
plt.legend(loc='lower right')
plt.title('Training and Validation Accuracy')plt.subplot(1,2,2)
plt.plot(epochs_range,loss,label='Training Loss')
plt.plot(epochs_range,val_loss,label='Validation Loss')
plt.legend(loc='upper right')
plt.title('Training and Validation Loss')
plt.show()

运行结果:

七、预测

import numpy as np
#采用加载的模型(new_model)来看预测结果
plt.figure(figsize=(10,5))
plt.suptitle("OreoCC")for images,labels in val_ds.take(1):for i in range(8):ax=plt.subplot(2,4,i+1)#显示图片plt.imshow(images[i].numpy().astype("uint8"))#需要给图片增加一个维度img_array=tf.expand_dims(images[i],0)#使用模型预测图片中的人物predictions=model.predict(img_array)plt.title(classNames[np.argmax(predictions)])plt.axis("off")

 运行结果:

八、心得体会 

模型整体结果没有达到十分满意的程度,应该再次调整模型参数,但由于自身TensorFlow为CPU模式,时间耗费太久,留待以后再次进行修正。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/bicheng/56315.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Mysql(八) --- 视图

文章目录 前言1.什么是视图?2.创建视图3. 使用视图4. 修改数据4.1.注意事项 5. 删除视图6.视图的优点 前言 前面我们学习了索引,这次我们来学习视图 1.什么是视图? 视图是一个虚拟的表,它是基于一个或多个基本表或其他视图的查询…

Java:玩家打怪小游戏

今天,我们尝试用Java来做一个“打怪小游戏”,听名字就知道,我们是应该创建几个成员和怪物,还有知道知道成员和怪物的血量,一次攻击的伤害等等。。当然我们的游戏攻击模式是“回合制”(其实是别的方法&#…

Element-ui官方示例(Popover 弹出框)

Element-ui官方示例(Popover 弹出框),好用的弹出框。 使用 vue-cli3 我们为新版的 vue-cli 准备了相应的​Element 插件​,你可以用它们快速地搭建一个基于 Element 的项目。 使用 Starter Kit 我们提供了通用的项目模版&#…

SQLAlchemy入门:详细介绍SQLAlchemy的安装、配置及基本使用方法

SQLAlchemy是一个流行的Python SQL工具包和对象关系映射(ORM)框架,它为开发人员提供了一种高效、灵活的方式来与数据库进行交互。本文将详细介绍SQLAlchemy的安装、配置及基本使用方法,并通过代码示例和案例分析,帮助新…

数据使用方法:

MySQL的存储引擎: 存储引擎的类型 MyISAM、InnoDB 、Memory、CSV等9种。 设置表的存储引擎: 数据表的存储位置 将查询结果插入新表 更新数据: 数据更新 更新数据记录 UPDATE 表名SET 字段1值1,字段2值2,...,字段n值 n [WHERE 条件]; 示例&a…

论文笔记:Pre-training to Match for Unified Low-shot Relation Extraction

论文来源:ACL 2022 论文地址:https://aclanthology.org/2022.acl-long.397.pdf 论文代码:https://github.com/fc-liu/MCMN (笔记不易,请勿恶意转载抄袭!!!) 目录 A…

pnpm报错 cannot find package xxx,有的电脑正常运行,只有这个的电脑报错

pnpm build报错 cannot find package xxx,有的电脑正常运行,只有这一个报错 在网上查找各种资料发现是项目在电脑里的目录层级比较深导致的。 问题:在 Windows 系统上,文件路径过长(超过 260 个字符)可能…

VMware设置虚拟机与物理机在同一网段

1、设置虚拟网络编辑器 打开VMware编辑中的“虚拟网络编辑器...”菜单 将桥接模式选择为物理机的网卡。 2、设置虚拟机的网络适配器 打开“虚拟机|设置...”菜单,按下图设置。 3、查看Ubuntu的IP地址 输入命令: ip addr show 可查看ip地址是否与物…

2020前端面试 - JavaScript2.0篇

前言: 个人觉得面试其实是一个自我学习的过程,如果说短时间内找不到工作,那一定是你面的还不够多,不要气馁,不要放弃,在心底告诉自己,下一次面试,再下一次面试,一定能够拿…

基于Matlab使用蚁群算法寻找最优路径

基于Matlab使用蚁群算法寻找最优路径 与Dijkstra算法使用相同的地图。 每只蚂蚁都从起点出发,直到抵达终点。这与Example5_1.m 中解决旅行商问题不一样,旅行商问题中每一代的蚂蚁都是随机从一个节点出发。 文件说明 Example5_1.m 简单对参考资料2中的…

路由器原理和静态路由配置

一、路由器的工作原理 根据路由表转发数据 接收数据包→查看目的地址→与路由表进行匹配找到转发端口→转发到该端口 二、路由表的形成 它是路由器中维护的路由条目的集合,路由器根据路由表做路径选择,里面记录了网段ip地址和对应下一跳接口的接口号。…

uniapp学习(004-2 组件 Part.2生命周期)

零基础入门uniapp Vue3组合式API版本到咸虾米壁纸项目实战,开发打包微信小程序、抖音小程序、H5、安卓APP客户端等 总时长 23:40:00 共116P 此文章包含第31p-第p35的内容 文章目录 组件生命周期我们主要使用的三种生命周期setup(创建组件时执行)不可以操作dom节点…

最新CSS入门总结

CSS(层叠样式表)是一种用于网页样式设计的语言,它通过为 HTML 标签添加样式来控制网页的外观和布局。CSS 可以设置元素的颜色、字体、间距、对齐方式等,还可以用于创建响应式设计,以适应不同设备的屏幕尺寸。CSS 是前端…

再给我两分钟,我能教会你使用 nvm 一键搞定node 和 npm

1. nvm简介 NVM(Node Version Manager)是Node.js的版本管理工具,它允许用户在同一台机器上安装和管理多个Node.js版本。这对于需要在不同项目之间切换Node.js版本的开发者来说非常有用,因为不同的项目可能依赖于不同版本的Node.js…

CAN总线通信协议

目录 一、CAN总线的介绍 二、主流通信协议对比 1.CAN硬件电路 三、CAN电平标准 四、CAN总线帧格式 1.CAN总线的5种类型帧 2.CAN总线的帧介绍 1.CAN总线的两种数据格式(标准格式与扩展格式) 2.遥控帧 3.错误帧 4.过载帧 5.帧间隔 3.位填充 4…

golang必备项目管理机制:工作区

在 Go 1.18 及以后的版本中,工作区(Workspace)是一种新的项目管理方式,可以让多个项目共享同一个模块缓存和依赖。这意味着你不需要在每个项目中单独安装依赖,而是可以共享依赖,这样可以节省空间和时间。 假…

CUDA 运行时GPU信息查询

cuda 官网文档名&#xff1a;CUDA_Runtime_API 运行时API查询GPU信息 调用 cudaDeviceProp prop; cudaGetDeviceProperties(&prop, device_id) 定义 由此可见&#xff0c;只能在主机上调用。 #include <cuda_runtime.h>#include <iostream> #include <…

ConditionVideo: 无训练的条件引导视频生成 | AAAI 2024

作者&#xff1a;彭博&#xff0c;上海人工智能实验室与上海交大2023级联培博士。 最近的工作已经成功地将大规模文本到图像模型扩展到视频领域&#xff0c;产生了令人印象深刻的结果&#xff0c;但计算成本高&#xff0c;需要大量的视频数据。在这项工作中&#xff0c;我们介…

游戏如何应对薅羊毛问题

在大众眼里&#xff0c;“薅羊毛”是指在电商领域&#xff0c;“羊毛党”利用平台、商家的促销规则&#xff0c;低价获取商品和服务的行为。如前不久“小天鹅被一夜薅走7000万”的案例震惊全网。 然而实际上&#xff0c;“薅羊毛”现象不仅存在于电商场景&#xff0c;在游戏中…

设计模式之适配器模式(通俗易懂--代码辅助理解【Java版】)

文章目录 设计模式概述1、适配器模式2、适配器模式的使用场景3、优点4、缺点5、主要角色6、代码示例1&#xff09;UML图2&#xff09;源代码&#xff08;1&#xff09;定义一部手机&#xff0c;它有个typec口。&#xff08;2&#xff09;定义一个vga接口。&#xff08;3&#x…