All Projects → songtianyi → Go Mxnet Predictor

songtianyi / Go Mxnet Predictor

Licence: apache-2.0
go binding for mxnet c_predict_api to do inference with pre-trained model

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects
cgo
20 projects

Projects that are alternatives of or similar to Go Mxnet Predictor

Multi Model Server
Multi Model Server is a tool for serving neural net models for inference
Stars: ✭ 770 (+1380.77%)
Mutual labels:  mxnet, inference
Ncnn
ncnn is a high-performance neural network inference framework optimized for the mobile platform
Stars: ✭ 13,376 (+25623.08%)
Mutual labels:  mxnet, inference
Neuropod
A uniform interface to run deep learning models from multiple frameworks
Stars: ✭ 858 (+1550%)
Mutual labels:  inference
Quantization.mxnet
Simulate quantization and quantization aware training for MXNet-Gluon models.
Stars: ✭ 42 (-19.23%)
Mutual labels:  mxnet
Server
Serve your Rubix ML models in production with scalable stand-alone model inference servers.
Stars: ✭ 30 (-42.31%)
Mutual labels:  inference
Resnet Multipleframework
ResNet benchmark by Keras(TensorFlow), Keras(MXNet), Chainer, PyTorch using Google Colab
Stars: ✭ 14 (-73.08%)
Mutual labels:  mxnet
Sockeye
Sequence-to-sequence framework with a focus on Neural Machine Translation based on Apache MXNet
Stars: ✭ 990 (+1803.85%)
Mutual labels:  mxnet
Deep Learning Vm
Sets up a VM with Keras, TensorFlow, TFLearn and Theano installed
Stars: ✭ 23 (-55.77%)
Mutual labels:  mxnet
Mxnet Seq2seq
Sequence to sequence learning with MXNET
Stars: ✭ 51 (-1.92%)
Mutual labels:  mxnet
Efficientnet
Gluon implementation of EfficientNet and EfficientNet-lite
Stars: ✭ 30 (-42.31%)
Mutual labels:  mxnet
Bevel
Ordinal regression in Python
Stars: ✭ 41 (-21.15%)
Mutual labels:  inference
Mxnet Centernet
Gluon implementation of "Objects as Points", aka "CenterNet"
Stars: ✭ 29 (-44.23%)
Mutual labels:  mxnet
Mxnet2caffe
convert model from mxnet to caffe without lossing precision
Stars: ✭ 20 (-61.54%)
Mutual labels:  mxnet
Gluonrank
Ranking made easy
Stars: ✭ 39 (-25%)
Mutual labels:  mxnet
Ts Pattern
🎨 A complete Pattern Matching library for TypeScript, with smart type inference.
Stars: ✭ 854 (+1542.31%)
Mutual labels:  inference
Video Tutorial Cvpr2020
A Comprehensive Tutorial on Video Modeling
Stars: ✭ 48 (-7.69%)
Mutual labels:  mxnet
A3c
MXNET + OpenAI Gym implementation of A3C from "Asynchronous Methods for Deep Reinforcement Learning"
Stars: ✭ 9 (-82.69%)
Mutual labels:  mxnet
Bmw Classification Inference Gpu Cpu
This is a repository for an image classification inference API using the Gluoncv framework. The inference REST API works on CPU/GPU. It's supported on Windows and Linux Operating systems. Models trained using our Gluoncv Classification training repository can be deployed in this API. Several models can be loaded and used at the same time.
Stars: ✭ 27 (-48.08%)
Mutual labels:  inference
Tensorly
TensorLy: Tensor Learning in Python.
Stars: ✭ 977 (+1778.85%)
Mutual labels:  mxnet
Deeplearning Mxnet
MXNet for CTR
Stars: ✭ 51 (-1.92%)
Mutual labels:  mxnet

go-mxnet-predictor

Build Status Go Report Card License

go-mxnet-predictor is go binding for mxnet c_predict_api. It's as raw as original C api, wish further development for higher level APIs. Feel free to join us :)

Part 1. Steps to build your own linux dev environment

Dockerfile offered for building mxnet and go env. You could skip this part by using Docker

1.1 Install mxnet prerequisites and go
  • for mxnet prerequisites check here
  • for go installation check here
1.2 Get mxnet and build
mkdir /root/MXNet/
cd /root/MXNet/ && git clone https://github.com/dmlc/mxnet.git --recursive
cd /root/MXNet/mxnet && make -j2
ln -s /root/MXNet/mxnet/lib/libmxnet.so /usr/lib/libmxnet.so

Part 2. Steps to build and run flower example

2.1 Get go-mxnet-predictor and do some configuration
go get github.com/anthonynsimon/bild
go get -u -v github.com/songtianyi/go-mxnet-predictor
cd $GOPATH/src/github.com/songtianyi/go-mxnet-predictor	
sed -i "/prefix=/c prefix=\/root\/MXNet\/mxnet" travis/mxnet.pc
cp travis/mxnet.pc /usr/lib/pkgconfig/
pkg-config --libs mxnet
2.2 Build flowers example
go build examples/flowers/predict.go
2.3 Download example files

To run this example, you need to download model files, mean.bin and input image. Then put them in correct path. These files are shared in dropbox and baidu storage service.

dropbox
pan.baidu.com
2.4 Run example
./predict
2.5 Python version of flower example

You might need this mxnet-flower-python

Part 3. Steps to do inference with go-mxnet-predictor

3.1 Load pre-trained model, mean image and create go predictor
// load model
symbol, err := ioutil.ReadFile("/data/102flowers-symbol.json")
if err != nil {
	panic(err)
}
params, err := ioutil.ReadFile("/data/102flowers-0260.params")
if err != nil {
	panic(err)
}

// load mean image from file
nd, err := mxnet.CreateNDListFromFile("/data/mean.bin")
if err != nil {
    panic(err)
}

// free ndarray list operator before exit
defer nd.Free()

// create Predictor
p, err := mxnet.CreatePredictor(symbol, params, mxnet.Device{mxnet.CPU_DEVICE, 0}, []mxnet.InputNode{{Key: "data", Shape: []uint32{1, 3, 299, 299}}})
if err != nil {
	panic(err)
}
defer p.Free()
// see more details in examples/flowers/predict.go
3.2 Load input data and do preprocess
// load test image for predction
img, err := imgio.Open("/data/flowertest.jpg")
if err != nil {
	panic(err)
}
// preprocess
resized := transform.Resize(img, 299, 299, transform.Linear)
res, err := utils.CvtImageTo1DArray(resized, item.Data)
if err != nil {
	panic(err)
}
3.3 Set input data to preditor
// set input
if err := p.SetInput("data", res); err != nil {
	panic(err)
}
3.4 Do prediction
// do predict
if err := p.Forward(); err != nil {
	panic(err)
}
3.5 Get result
// get predict result
data, err := p.GetOutput(0)
if err != nil {
	panic(err)
}
// see more details in examples/flowers/predict.go
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].