You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/01/04 02:29:50 UTC

[GitHub] mongoose54 opened a new issue #9301: How to fine-tune VGG16

mongoose54 opened a new issue #9301: How to fine-tune VGG16
URL: https://github.com/apache/incubator-mxnet/issues/9301
 
 
   This is more of a general question
   
   I have pretained VGG16 `vgg = gluon.model_zoo.vision.vgg16_bn(pretrained=True)` . How can I replace the last layer (i.e. 1000 outputs) with a layer with 10 outputs? I was reading through the Fine Tuning tutorial [here](http://gluon.mxnet.io/chapter08_computer-vision/fine-tuning.html#DeepDog-net) but the issue is that the features in vgg16 do not contain the dense layers at the end. Instead the dense layers are in the Classifier part. See description of vgg16 below:
   
   VGG(
     (features): HybridSequential(
       (0): Conv2D(64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
       (1): BatchNorm(fix_gamma=False, eps=1e-05, momentum=0.9, axis=1)
       (2): Activation(relu)
       (3): Conv2D(64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
       (4): BatchNorm(fix_gamma=False, eps=1e-05, momentum=0.9, axis=1)
       (5): Activation(relu)
       (6): MaxPool2D(size=(2, 2), stride=(2, 2), padding=(0, 0), ceil_mode=False)
       (7): Conv2D(128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
       (8): BatchNorm(fix_gamma=False, eps=1e-05, momentum=0.9, axis=1)
       (9): Activation(relu)
       (10): Conv2D(128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
       (11): BatchNorm(fix_gamma=False, eps=1e-05, momentum=0.9, axis=1)
       (12): Activation(relu)
       (13): MaxPool2D(size=(2, 2), stride=(2, 2), padding=(0, 0), ceil_mode=False)
       (14): Conv2D(256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
       (15): BatchNorm(fix_gamma=False, eps=1e-05, momentum=0.9, axis=1)
       (16): Activation(relu)
       (17): Conv2D(256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
       (18): BatchNorm(fix_gamma=False, eps=1e-05, momentum=0.9, axis=1)
       (19): Activation(relu)
       (20): Conv2D(256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
       (21): BatchNorm(fix_gamma=False, eps=1e-05, momentum=0.9, axis=1)
       (22): Activation(relu)
       (23): MaxPool2D(size=(2, 2), stride=(2, 2), padding=(0, 0), ceil_mode=False)
       (24): Conv2D(512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
       (25): BatchNorm(fix_gamma=False, eps=1e-05, momentum=0.9, axis=1)
       (26): Activation(relu)
       (27): Conv2D(512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
       (28): BatchNorm(fix_gamma=False, eps=1e-05, momentum=0.9, axis=1)
       (29): Activation(relu)
       (30): Conv2D(512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
       (31): BatchNorm(fix_gamma=False, eps=1e-05, momentum=0.9, axis=1)
       (32): Activation(relu)
       (33): MaxPool2D(size=(2, 2), stride=(2, 2), padding=(0, 0), ceil_mode=False)
       (34): Conv2D(512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
       (35): BatchNorm(fix_gamma=False, eps=1e-05, momentum=0.9, axis=1)
       (36): Activation(relu)
       (37): Conv2D(512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
       (38): BatchNorm(fix_gamma=False, eps=1e-05, momentum=0.9, axis=1)
       (39): Activation(relu)
       (40): Conv2D(512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
       (41): BatchNorm(fix_gamma=False, eps=1e-05, momentum=0.9, axis=1)
       (42): Activation(relu)
       (43): MaxPool2D(size=(2, 2), stride=(2, 2), padding=(0, 0), ceil_mode=False)
     )
     (classifier): HybridSequential(
       (0): Dense(4096, Activation(relu))
       (1): Dropout(p = 0.5)
       (2): Dense(4096, Activation(relu))
       (3): Dropout(p = 0.5)
       (4): Dense(1000, linear)
     )
   )

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services