7
$\begingroup$

Does anyone know of a Mathematica v11.1 implementation for any of the Resnets, e.g. a NetModel or WLNet for Resnet-1000?

Loading the MXNet weights from the model zoo for both resnet or resnext doesn't work since layer type elemwise_add is not supported:

enter image description here

$\endgroup$
2
  • $\begingroup$ There is pretrain MXNet weight available for Resnet in the MXNet model zoo. Maybe you can load them into Mathematica. By the way, I'm interested in what work do you do with Resnet? I'm guessing that it is very slow to evaluate. $\endgroup$ Commented Mar 17, 2017 at 20:18
  • $\begingroup$ The reason I ask for an implementation is because the import failed. @xslittlegrass $\endgroup$
    – M.R.
    Commented Mar 17, 2017 at 20:23

1 Answer 1

12
$\begingroup$

I've fixed the importer for the next update. In the meantime, here's the ResNet-18 model as a WLNet file. It has an image encoder and class decoder attached: https://drive.google.com/file/d/0B2dQMmlwPBAnQWZlXzFCT204MUU/view?usp=sharing.

Here's the corresponding import code:

syns = Import["~/Downloads/Nets/ResNet/synset.txt", "Lines"];

model = ImportMXNetModel[
   "~/Downloads/Nets/ResNet/resnet-18-symbol.json",
   "~/Downloads/Nets/ResNet/resnet-18-0000.params"
];

model = NetReplacePart[model, {
    {"bn_data", "MovingVariance"} -> model[["bn_data", "MovingVariance"]]/(256^2),
    {"bn_data", "MovingMean"} -> model[["bn_data", "MovingMean"]]/256,
    "Input" -> NetEncoder[{"Image", 224}], 
    "Output" -> NetDecoder[{"Class", syns}]
}];

Export["ResNet-18.wlnet", model]
$\endgroup$
1
  • 1
    $\begingroup$ Thanks! NiN doesn't import either for this same reason. I think it would be really great to add in a tutorial about interaction with lower-level stuff like this (I wouldn't have thought to alter this {"bn_data", "MovingVariance"} property of the net). $\endgroup$
    – M.R.
    Commented Mar 19, 2017 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.