How to modify net's param

from mxnet.gluon.model_zoo import vision

res_net50 = vision.resnet50_v1()

how to modify the kernel size of the first layer "conv " .
7x7 -> 3x3

You can use register_child to replace the layer:

from mxnet.gluon.model_zoo import vision
from mxnet import gluon
import mxnet as mx

net = vision.resnet50_v1()
new_layer = gluon.nn.Conv2D(64, kernel_size=(8, 8), strides=(4, 4), padding=(3, 3))
f = net.features
f.register_child( new_layer, "0")
new_layer.initialize(mx.init.Xavier())
print(net)
2 Likes

How to modify output?

for example:
train_net = gcv.model_zoo.get_model(“ResNet34_v1”, pretrained = True)
print(train_net.output)

#print result
Dense(512 -> 1000, linear)

Now I want to modify the train_net.output
it has three output,for example
output_1:Dense(512 -> 1000, linear)
output_2:Dense(512 -> 1000, linear)
output_3:Dense(512 -> 1000, linear)
QQ%E5%9B%BE%E7%89%8720190224134628

how to modify train_net.output

1 Like