2
$\begingroup$

I want to get the details about the input used to train a net in the Net Repository, in my case "LeNet Trained on MNIST Data". I can get its decoder by:

NetExtract[ NetModel["LeNet Trained on MNIST Data"] , "Input" ]

but I cannot figure out how to get properties like Type and ImageSize from inside it.

$\endgroup$

1 Answer 1

1
$\begingroup$
sol = NetExtract[NetModel["LeNet Trained on MNIST Data"], "Input"]
FullForm[sol]

or look at all the elements:

sol[[All]]

<|"ImageSize" -> {28, 28}, "ColorSpace" -> "Grayscale", 
  "ColorChannels" -> 1, "MeanImage" -> None, "VarianceImage" -> None|>

This is in the form of an Association. You can extract the keys or the values directly:

Keys[sol[[All]]]
{"ImageSize", "ColorSpace", "ColorChannels", "MeanImage", "VarianceImage"}

Values[sol[[All]]]
{{28, 28}, "Grayscale", 1, None, None}

or directly grab the items of interest:

sol[[All]]["ImageSize"]
{28, 28}

sol[[All]]["ColorSpace"]
Grayscale
$\endgroup$
1
  • $\begingroup$ Perfect. Thank you. I do not necessarily need it, but the input Type (in this case "Image") lives outside the association. Is there a way to get it? $\endgroup$ Mar 22, 2019 at 11:24

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.