Skip to content

Implement your own state of the art RESNET architectures with a simple to use keras-like High-Level API

License

Notifications You must be signed in to change notification settings

SuvigyaJain1/Build-Your-Own-ResNet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build-Your-Own-ResNet

Implement your own state of the art ResNet architectures with a simple to use keras-based High-Level API

Dependencies

pip install tensorflow

How to use

  1. Download the ResNet.py file and move it into working directory

Resnet-18 implementation

from './ResNet' import ResnetBase
from keras import activations, layers

model = ResnetBase((32,32,3), activations.relu)

model.add([
           layers.Conv2D(kernel_size=(7,7), strides=(1,1), filters=64, padding="same"),
           layers.BatchNormalization(),
           layers.MaxPooling2D(pool_size=(2,2))
           ], activation=tf.keras.activations.relu)

model.add_conv_bn_block(filters=[64, 64], strides=(1,1), kernel_sizes=[(3,3), (3,3)])
model.add_conv_bn_block(filters=[64, 64], strides=(1,1), kernel_sizes=[(3,3), (3,3)])
model.add_conv_bn_block(filters=[128, 128], strides=(1,1), kernel_sizes=[(3,3), (3,3)])
model.add_conv_bn_block(filters=[128, 128], strides=(1,1), kernel_sizes=[(3,3), (3,3)])
model.add_conv_bn_block(filters=[256, 256], strides=(2,2), kernel_sizes=[(3,3), (3,3)])
model.add_conv_bn_block(filters=[256, 256], strides=(1,1), kernel_sizes=[(3,3), (3,3)])
model.add_conv_bn_block(filters=[512, 512], strides=(2,2), kernel_sizes=[(3,3), (3,3)])
model.add_conv_bn_block(filters=[512, 512], strides=(1,1), kernel_sizes=[(3,3), (3,3)])


model.add([
           layers.AveragePooling2D(pool_size=(4,4)),
           layers.Flatten(),
           layers.Dense(10),
           layers.Softmax()
])

m = model.build_model()
m.summary()

m.compile(optimizer="adam", loss="categorical_crossentropy", metrics=['accuracy'])
# history = m.fit(X_train, y_train, epochs=20)

About

Implement your own state of the art RESNET architectures with a simple to use keras-like High-Level API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages