Help us understand the problem. What is going on with this article?

# Inception V3　モジュール 実装

More than 1 year has passed since last update.

# 実装

```def InceptionV3_block1():
def f(x):
b1 = Convolution2D(64, (1,1), strides=2, padding='same')(x)
b1 = BatchNormalization()(b1)
b1 = Activation('relu')(b1)

b2 = Convolution2D(48, (1,1))(x)
b2 = BatchNormalization()(b2)
b2 = Activation('relu')(b2)
b2 = Convolution2D(96, (3,3), strides=2, padding='same')(b2)
b2 = BatchNormalization()(b2)
b2 = Activation('relu')(b2)

b3 = AveragePooling2D(pool_size=(3, 3), strides=2,  padding='same')(x)
b3 = Convolution2D(64, (3,3), padding='same')(b3)
b3 = BatchNormalization()(b3)
b3 = Activation('relu')(b3)

b4 = Convolution2D(64, (1,1))(x)
b4 = BatchNormalization()(b4)
b4 = Activation('relu')(b4)
b4 = Convolution2D(96, (3,3), padding='same')(b4)
b4 = BatchNormalization()(b4)
b4 = Activation('relu')(b4)
b4 = Convolution2D(32, (3,3),strides=2, padding='same')(b4)
b4 = BatchNormalization()(b4)
b4 = Activation('relu')(b4)

output = concatenate([b1, b2, b3, b4], axis=-1)
return output
return f

```
```def InceptionV3_block2():
def f(x):
b1 = Convolution2D(64, (1,1), strides=2,  padding='same')(x)
b1 = BatchNormalization()(b1)
b1 = Activation('relu')(b1)

b2 = Convolution2D(48, (1,1))(x)
b2 = BatchNormalization()(b2)
b2 = Activation('relu')(b2)
b2 = Convolution2D(96, (3,3), strides=2,  padding='same')(b2)
b2 = BatchNormalization()(b2)
b2 = Activation('relu')(b2)

b3 = AveragePooling2D(pool_size=(3, 3), strides=2,  padding='same')(x)
b3 = Convolution2D(64, (3,3), padding='same')(b3)
b3 = BatchNormalization()(b3)
b3 = Activation('relu')(b3)

b4 = Convolution2D(64, (1,1))(x)
b4 = BatchNormalization()(b4)
b4 = Activation('relu')(b4)
b4 = Convolution2D(96, (3,3), padding='same')(b4)
b4 = BatchNormalization()(b4)
b4 = Activation('relu')(b4)
b4 = Convolution2D(64, (3,3),strides=2, padding='same')(b4)
b4 = BatchNormalization()(b4)
b4 = Activation('relu')(b4)

output = concatenate([b1, b2, b3, b4], axis=-1)
return output
return f
```
```def InceptionV3():
inputs = Input(shape=(32, 32, 3))
x = Convolution2D(32, (1,1), strides=2)(inputs)
x = BatchNormalization()(x)
x = Activation('relu')(x)
x = MaxPooling2D((3, 3), strides=(2,2), padding='same')(x)

x = InceptionV3_block1()(x)
x = InceptionV3_block2()(x)

x = GlobalAveragePooling2D()(x)
x = Dense(10, kernel_initializer='he_normal', activation='softmax')(x)

model = Model(inputs=inputs, outputs=x)
return model

model = InceptionV3()
model.summary()
```
Why do not you register as a user and use Qiita more conveniently?
1. We will deliver articles that match you
By following users and tags, you can catch up information on technical fields that you are interested in as a whole
2. you can read useful information later efficiently
By "stocking" the articles you like, you can search right away