Skip to content

lon9/caffe2go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Caffe2Go

Caffe2Go evaluate caffemodel with Golang

Usage

Command line interface

./caffe2go -i images/plane.jpg -m models/nin\_imagenet.caffemodel -l labels/synset\_words.txt -s 224 -mf means.txt

Options

age of ./caffe2go:
-cpuProf string
Filename for CPU profiling.
-i string
Path for image.
-l string
Path for labels.
-m string
Path for caffemodel.
-memProf string
Filename for Memory profiling.
-mf string
Meanfile path
-s uint
Input Shape

Use the library on your own software

package main

import (
	"fmt"
	_ "image/jpeg"
	_ "image/png"

	"github.com/Rompei/caffe2go/c2g"
)

func main() {
	caffe2go, err := c2g.NewCaffe2Go("lenet.caffemodel")
	if err != nil {
		panic(err)
	}
	output, err := caffe2go.Predict("mnist_zero.png", 28, nil)
	if err != nil {
		panic(err)
	}

	for i := range output {
		fmt.Printf("%d: %f\n", i, output[i][0][0])
	}
}

Supported layers

Now supports the layers below

Convolution
Pooling
ReLU
FullyConnected
Dropout
Softmax
LRN

License

BSD-2