i'm trying to implement the VGG13 model in keras but i'm having a lot of difficulties in finding the ImageNet pretrained weights for it. Does anyone know where to find does?
Asked
Active
Viewed 418 times
-2
-
I could not find weights for a Keras model, however, if you would like to use Pytorch check out: https://github.com/pytorch/vision/blob/master/torchvision/models/vgg.py – James Kl Mar 07 '21 at 20:04
-
@JamesKl thanks for the answer but I specifically need those imagenet pretrained weights – Elvopresla Mar 07 '21 at 20:49
1 Answers
1
VGG13 is kinda of simple architecture so easy to implmeent using keras
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Flatten, Dropout
from tensorflow.keras.layers.convolutional import Conv2D, MaxPooling2D
#Number of label classes
num_classes = 2
model = Sequential()
model.add(Conv2D(64, (3, 3), strides=(1, 1), input_shape=(32, 32, 3), padding='same', activation='relu',
kernel_initializer='uniform'))
model.add(Conv2D(64, (3, 3), strides=(1, 1), padding='same', activation='relu', kernel_initializer='uniform'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Conv2D(128, (3, 2), strides=(1, 1), padding='same', activation='relu', kernel_initializer='uniform'))
model.add(Conv2D(128, (3, 3), strides=(1, 1), padding='same', activation='relu', kernel_initializer='uniform'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Conv2D(256, (3, 3), strides=(1, 1), padding='same', activation='relu', kernel_initializer='uniform'))
model.add(Conv2D(256, (3, 3), strides=(1, 1), padding='same', activation='relu', kernel_initializer='uniform'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Conv2D(512, (3, 3), strides=(1, 1), padding='same', activation='relu', kernel_initializer='uniform'))
model.add(Conv2D(512, (3, 3), strides=(1, 1), padding='same', activation='relu', kernel_initializer='uniform'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Conv2D(512, (3, 3), strides=(1, 1), padding='same', activation='relu', kernel_initializer='uniform'))
model.add(Conv2D(512, (3, 3), strides=(1, 1), padding='same', activation='relu', kernel_initializer='uniform'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Flatten())
model.add(Dense(4096, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(4096, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(num_classes, activation='softmax'))

Yefet
- 2,010
- 1
- 10
- 19
-
I already tried looking there but i couldn't find any VGG13 model or weights for it. I need to implement the VGG13 model without the FC layers so re-wrote it by hand. I just needs weights for it and I can't find them anywhere (I only found does for VGG16 and VGG19). Btw i'm new to keras and neural networks so I'm sorry if I can't find them quickly cause I just don't know what and where to search – Elvopresla Mar 07 '21 at 18:52
-
Ah sorry i missread VGG version VGG13 is way too simple architecture ill edit my post – Yefet Mar 07 '21 at 19:03
-
thanks for the model, that's basically how i've done it, but still, I need specifically those imagenet pretrained weights. I was able to find them for VGG16 and VGG19 but not for VGG13... – Elvopresla Mar 07 '21 at 20:50
-
i did some resreach online and checked tensorflow hub but i realy cant find pretrained version for vgg13 on image net, all starts with vgg13, you can train if if your have the computation and patience but i would suggest you to swap to later version – Yefet Mar 07 '21 at 21:04
-