ONNX-GO
Neural Networks made easy
dotGO - March 25th 2019
Olivier Wulveryck
Octo Technology
@owulveryck
Slide 2
Slide 2 text
Software has changed the world!
We, as developers,
are actors of this
evolution.
Slide 3
Slide 3 text
- I want to give my code
super power!
- I want to use it to
predict Y, given X!
- Use machine learning Luke!
iota
Slide 4
Slide 4 text
Gradient
Tensorflow
Tenso
rs
n
o
n
-lin
e
a
ritie
s
Sigmoid
backpropagation
overfitting
pyto
rch
LSTM
convolution
K-m
ean
Slide 5
Slide 5 text
Input
p
u
t
Input
o
u
tpu
t
output
Machine
Learning
Model
Slide 6
Slide 6 text
Input
p
u
t
Input
o
u
tpu
t
output
Slide 7
Slide 7 text
"The model shouldn't
be tied to the runtime
environment!"
Slide 8
Slide 8 text
Open Neural Network eXchange
http://onnx.ai
Slide 9
Slide 9 text
onnx-go
Model zoo
(pre-trained models)
data-science
Slide 10
Slide 10 text
odel.Input[0]
model.Output[0]
[]float32{
0,0,0,0,0,0,0,0,0,1,0}
9
Your
regular
Go Code
picture :=
Slide 11
Slide 11 text
SHOW ME SOME CODE!
ONNX-GO (MNIST) example
backend := gorgonia.NewGraph()
model := onnx.NewModel(backend)
Create the execution backend (Gorgonia)
and the onnx model receiver
b, err := ioutil.ReadFile("model.onnx")
err = model.Unmarshal(b)
Read the onnx file and
Deserialize it into the model receiver
gorgonia.NewTapeMachine(backend).RunAll()
output := getData(model.Output[0]) // []float32
Run the backend
to compute the result
var picture *image.NRGBA
setData(model.Input[0],picture)
Set the input
Slide 12
Slide 12 text
DEMO of the POC
# Get the model:
curl https://www.cntk.ai/OnnxModels/mnist/opset_7/mnist.tar.gz | tar -C /tmp
-xzvf -
# Get the demo binary from
https://github.com/owulveryck/onnx-go/releases/tag/v0.1-mnist-cli
# Run it:
../mnist-reader.darwin -model /tmp/mnist/model.onnx
Slide 13
Slide 13 text
Imagine what you, as a Gopher, can
do with Machine Learning.
Get involve, nobody is a nobody!
github.com/onnx/models
github.com/owulveryck/onnx-go
gorgonia.org/gorgonia
Slide 14
Slide 14 text
Let's make
programming
(with)
Neural networks
fun (again)
Welcome to software 2.0 with GO!
Thank you!
@owulveryck