-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
44 lines (34 loc) · 942 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"log"
"os"
"github.com/gopherds/dlinfer"
)
const (
model = "/CaffeNet.xml"
pluginPath = "/opt/intel/deep_learning_sdk_2016.1.0.861/deployment_tools/inference_engine/lib/intel64/"
plugin = "MKLDNNPlugin"
labelsFile = "/CaffeNet.labels"
)
func main() {
// Read in the image file name.
args := os.Args
if len(args) != 2 {
log.Fatal("Please provide an image as input")
}
imageFile := args[1]
// Create an inference configurator value.
pluginPaths := dlinfer.NewStringVector()
pluginPaths.Add(pluginPath)
configurator := dlinfer.NewInferenceEngineConfigurator(model, pluginPaths, plugin, labelsFile)
// Load our image.
images := dlinfer.NewStringVector()
images.Add(imageFile)
configurator.LoadImages(images)
// Load the model.
configurator.LoadModel()
// Infer the content of the image.
configurator.Infer()
// Get the top results for our image.
configurator.GetTopResult(5)
}