Giter Site home page Giter Site logo

ncs's Introduction

ncs

GoDoc License

Neural Compute Stick V2.0 API Go binding

NCSDK API V2 IS PARTIALLY BROKEN on macOS AT THE MOMENT -- EVERYTHING WORKS FINE ON LINUX

The code in this repository has been tested on the following Linux OS:

Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.5 LTS
Release:	16.04
Codename:	xenial

Linux ubuntu-xenial 4.4.0-134-generic #160-Ubuntu SMP Wed Aug 15 14:58:00 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

The Movidius NCSDK API coverage provided in this repo should give you all the tools to use Movidius NCS to perform Neural Network inference.

Quick start

On MacOS, clone macos-V2 branch:

$ git clone -b macos-V2 https://github.com/milosgajdos83/ncsdk.git

Build ncsdk API libraries:

$ cd api/src && sudo make basicinstall pythoninstall

Test NCSDK example:

$ cd ../../examples/apps/hello_ncs_cpp/ && make run

Example Go program

The example below shows how to create and destroy the basic resource types the NCSDK API 2.0 provides. For more complex examples please see examples

package main

import (
	"log"

	"github.com/milosgajdos83/ncs"
)

func main() {
	var err error
	defer func() {
		if err != nil {
			log.Fatalf("Error: %s", err)
		}
	}()
	log.Printf("Attempting to create NCS device handle")
	dev, e := ncs.NewDevice(0)
	if e != nil {
                err = e
		return
	}
	defer dev.Destroy()
	log.Printf("NCS device handle successfully created")

	log.Printf("Attempting to open NCS device")
	err = dev.Open()
	if err != nil {
		return
	}
	defer dev.Close()
	log.Printf("NCS device successfully opened")

	log.Printf("Attempting to create NCS graph handle")
	graph, e := ncs.NewGraph("NCSGraph")
	if e != nil {
                err = e
		return
	}
	defer graph.Destroy()
	log.Printf("NCS graph handle successfully created")

	log.Printf("Attempting to create NCS FIFO handle")
	fifo, e := ncs.NewFifo("TestFIFO", ncs.FifoHostRO)
	defer fifo.Destroy()
	if e != nil {
                err = e
		return
	}
	log.Printf("NCS FIFO handle successfully created")
}

If your Movidius NCS device is plugged in you should see the following output when running the program above:

2018/08/27 00:43:00 Attempting to create NCS device handle
2018/08/27 00:43:00 NCS device handle successfully created
2018/08/27 00:43:00 Attempting to open NCS device
2018/08/27 00:43:03 NCS device successfully opened
2018/08/27 00:43:03 Attempting to create NCS graph handle
2018/08/27 00:43:03 NCS graph handle successfully created
2018/08/27 00:43:03 Attempting to create NCS FIFO handle
2018/08/27 00:43:03 NCS FIFO handle successfully created

ncs's People

Contributors

milosgajdos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.