0

I am using CNTK's model edit language to load a pre-trained Resnet model, add a new last layer, and refine the model on some new dataset.

I would also like to change the network architecture to accept higher resolution images as input (which is possible since my net is fully convolutional without the last fc layer). Does anyone know how to do that / of a relevant link?

Thanks!

ps. This is how my current .mel file looks like (for an AlexNet):

#load pre-trained model
model1 = LoadModel("$OrigModel$") #, format=cntk)
SetDefaultModel(model1)

#parameters from original ndl file
cMap4 = 512
fcWScale = 1.13
fcBValue = 0
labelDimNew=10

#add new final layer
newL = DnnLayer(cMap4, $labelDimNew$, pool5, fcWScale, fcBValue)
labelsNew = Input($labelDimNew$, tag="label")
SetInput(ce, 0, labelsNew)
SetInput(ce, 1, newL.z)
SetInput(err, 0, labelsNew)
SetInput(err, 1, newL.z)
SetProperty(newL.z, "output", "true")

#remove old final layer (note: make sure these deletes happen in reverse order)
DeleteNode(OutputNodes.z) 
DeleteNode(OutputNodes.t)
DeleteNode(OutputNodes.b)
DeleteNode(OutputNodes.W)
DeleteNode(labels)

#rename nodes to have same name as before. this might not be necessary.
Rename(labelsNew, labels)
Rename(newL.*, OutputNodes.*)
Anton Schwaighofer
  • 3,119
  • 11
  • 24

1 Answers1

0

One option would be to have an adapter function that takes the higher res function and plug its output to the input of your pre-trained model. In python it should be straightforward. I am not sure about how to extend that to .mel though.

Sayan Pathak
  • 870
  • 4
  • 7
  • Thanks Sayan. Yes, in Python this should be easier. I might have to convert my full CNTK model training scripts then if I cannot figure out how to do this in .mel. – patrickBue123 Jan 17 '17 at 14:10