How to import a pre-trained neural network into Flux.jl ?


#1

I’m using the Flux library in Julia. How can I import an Inception neural network into it?

I’ve seen that the following can be done in Mocha.jl to import a pre-trained net.

using HDF5 
h5open("model/bvlc_reference_caffenet.hdf5", "r") do h5
load_network(h5, net)
end
init(net)

Is there some way I can import a pre-trained model in Flux?


#2

What models are you looking to load?

For models you trained in Flux itself, see loading and saving models in the docs.

For models trained in other frameworks there are fewer options, though it’s not that hard to write a parser for most model formats. We have ONNX.jl, which we used to load VGG19, but it’s pretty rough around the edges right now.


#3

xref: https://stackoverflow.com/questions/49229103/how-to-use-a-pre-trained-model-in-flux-jl


#4

I want to load the InceptionV3 model. Any way to do this?

https://keras.io/applications/#inceptionv3


#5

You have two options:

(1) Write a keras model reader (which would be a great contribution!)
(2) Export the model to ONNX from keras, and then load it via ONNX.jl


#6

Is there any documentation on using ONNX.jl to read in an onnx file into Flux?

Also, is there a way to go from flux -> onnx? (If not, I’d be interesting in working on something like this and would welcome pointers on getting started)