1. 程式人生 > >Intel® Movidius™ Neural Compute SDK - TinyYolo

Intel® Movidius™ Neural Compute SDK - TinyYolo

Intel® Movidius™ Neural Compute SDK - TinyYolo

https://github.com/movidius/ncappzoo/tree/master/caffe/TinyYolo

ncappzoo/caffe/TinyYolo/

Introduction

The TinyYolo network can be used for object recognition and classification. See https://pjreddie.com/darknet/yolov1/ for more information on this network. The provided Makefile does the following

  1. Downloads the Caffe prototxt file
  2. Downloads the .caffemodel file which was trained.
  3. Profiles and Compiles the network using the Neural Compute SDK.
  4. Runs the provided run.py program that does a single inference on a provided image as an example on how to use the network using the Neural Compute API

Makefile

Provided Makefile has various targets that help with the above mentioned tasks.

make help

Shows available targets

make all

Runs profile, compile.

make profile

Runs the provided network on the NCS and generates per layer statistics that are helpful for understanding the performance of the network on the Neural Compute Stick.

make compile

Uses the network description and the trained weights files to generate a Movidius internal ‘graph’ format file. This file is later used for loading the network on to the Neural Compute Stick and executing the network.

make run_py

Runs the provided run.py python program which sends a single image to the Neural Compute Stick and receives and displays the inference results along with a GUI window showing the identified objects in the image.

make clean

Removes all the temporary files that are created by the Makefile

[email protected]:~$ cd ncs_work/
[email protected]:~/ncs_work$ ls
ncsdk
[email protected]:~/ncs_work$ git clone https://github.com/movidius/ncappzoo.git
Cloning into 'ncappzoo'...
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 3064 (delta 0), reused 0 (delta 0), pack-reused 3063
Receiving objects: 100% (3064/3064), 383.92 MiB | 1.83 MiB/s, done.
Resolving deltas: 100% (1794/1794), done.
Checking connectivity... done.
[email protected]:~/ncs_work$ ll
total 16
drwxrwxr-x  4 foreverstrong foreverstrong 4096 10月 31 15:24 ./
drwxr-xr-x 19 foreverstrong foreverstrong 4096 10月 31 14:40 ../
drwxrwxr-x  7 foreverstrong foreverstrong 4096 10月 31 15:27 ncappzoo/
drwxrwxr-x  6 foreverstrong foreverstrong 4096 10月 30 14:55 ncsdk/
[email protected]:~/ncs_work$ cd ncappzoo/
[email protected]:~/ncs_work/ncappzoo$ ls
apps  caffe  CONTRIBUTING.md  data  LICENSE  Makefile  MAKEFILE_GUIDANCE.md  OWNERS  README.md  tensorflow
[email protected]:~/ncs_work/ncappzoo$ cd caffe/TinyYolo/
[email protected]:~/ncs_work/ncappzoo/caffe/TinyYolo$ ll
total 36
drwxrwxr-x  2 foreverstrong foreverstrong  4096 10月 31 15:27 ./
drwxrwxr-x 10 foreverstrong foreverstrong  4096 10月 31 15:27 ../
-rw-rw-r--  1 foreverstrong foreverstrong   206 10月 31 15:27 labels.txt
-rw-rw-r--  1 foreverstrong foreverstrong  3666 10月 31 15:27 Makefile
-rw-rw-r--  1 foreverstrong foreverstrong  1459 10月 31 15:27 README.md
-rwxrwxr-x  1 foreverstrong foreverstrong 14554 10月 31 15:27 run.py*
[email protected]:~/ncs_work/ncappzoo/caffe/TinyYolo$ 
[email protected]:~/ncs_work/ncappzoo/caffe/TinyYolo$ make clean

making clean_caffe_model
rm -f tiny-yolo-v1.prototxt
rm -f tiny-yolo-v1_53000.caffemodel

making clean
rm -f graph
rm -f output.gv
rm -f output.gv.svg
rm -f output_report.html
rm -f output_expected.npy
rm -f zero_weights.caffemodel
rm -f output_result.npy
rm -f output_val.csv
[email protected]:~/ncs_work/ncappzoo/caffe/TinyYolo$ 
[email protected]:~/ncs_work/ncappzoo/caffe/TinyYolo$ make help
possible make targets: 
  make help - shows this message
  make all - makes the following: prototxt, profile, compile, check, cpp, run_py, run_cpp
  make prototxt - downloads and adds input shape to Caffe prototxt file
  make caffemodel - downloads the caffemodel for the network
  make compile - runs SDK compiler tool to compile the NCS graph file for the network
  make profile - runs the SDK profiler tool to profile the network creating output_report.html
  make browse_profile - runs the SDK profiler tool and brings up report in browser.
  make run - runs the run.py python example program
  make clean - removes all created content
[email protected]:~/ncs_work/ncappzoo/caffe/TinyYolo$ 
[email protected]:~/ncs_work/ncappzoo/caffe/TinyYolo$ make all

making prototxt
Downloading Prototxt file
--2018-10-31 16:19:54--  http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/tiny-yolo-v1.prototxt
Resolving ncs-forum-uploads.s3.amazonaws.com (ncs-forum-uploads.s3.amazonaws.com)... 54.231.235.43
Connecting to ncs-forum-uploads.s3.amazonaws.com (ncs-forum-uploads.s3.amazonaws.com)|54.231.235.43|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2018-10-31 16:19:55--  (try: 2)  http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/tiny-yolo-v1.prototxt
Connecting to ncs-forum-uploads.s3.amazonaws.com (ncs-forum-uploads.s3.amazonaws.com)|54.231.235.43|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2018-10-31 16:19:57--  (try: 3)  http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/tiny-yolo-v1.prototxt
Connecting to ncs-forum-uploads.s3.amazonaws.com (ncs-forum-uploads.s3.amazonaws.com)|54.231.235.43|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2018-10-31 16:20:00--  (try: 4)  http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/tiny-yolo-v1.prototxt
Connecting to ncs-forum-uploads.s3.amazonaws.com (ncs-forum-uploads.s3.amazonaws.com)|54.231.235.43|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2018-10-31 16:20:04--  (try: 5)  http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/tiny-yolo-v1.prototxt
Connecting to ncs-forum-uploads.s3.amazonaws.com (ncs-forum-uploads.s3.amazonaws.com)|54.231.235.43|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2018-10-31 16:20:09--  (try: 6)  http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/tiny-yolo-v1.prototxt
Connecting to ncs-forum-uploads.s3.amazonaws.com (ncs-forum-uploads.s3.amazonaws.com)|54.231.235.43|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5520 (5.4K) [application/octet-stream]
Saving to: ‘./tiny-yolo-v1.prototxt’

tiny-yolo-v1.prototxt                 100%[=======================================================================>]   5.39K  --.-KB/s    in 0.1s    

2018-10-31 16:20:10 (55.5 KB/s) - ‘./tiny-yolo-v1.prototxt’ saved [5520/5520]

got prototext file.

making profile
mvNCProfile tiny-yolo-v1.prototxt -s 12
mvNCProfile v02.00, Copyright @ Movidius Ltd 2016

****** WARNING: using empty weights ******
/usr/local/bin/ncsdk/Controllers/FileIO.py:52: UserWarning: You are using a large type. Consider reducing your data sizes for best performance
  "Consider reducing your data sizes for best performance\033[0m")
USB: Transferring Data...
Time to Execute :  142.36  ms
USB: Myriad Execution Finished
Time to Execute :  124.47  ms
USB: Myriad Execution Finished
USB: Myriad Connection Closing.
USB: Myriad Connection Closed.
Network Summary

Detailed Per Layer Profile
                                                                                                                                     Bandwidth   time
#    Name                                                                                                                      MFLOPs  (MB/s)    (ms)
=====================================================================================================================================================
0    data                                                                                                                         0.0324113.8   0.004
1    scale1                                                                                                                     173.4  1176.2   8.789
2    pool1                                                                                                                        3.2   791.5   7.739
3    scale2                                                                                                                     462.4   886.2  15.565
4    pool2                                                                                                                        1.6   930.3   3.292
5    scale3                                                                                                                     462.4   658.9  10.514
6    pool3                                                                                                                        0.8   960.5   1.594
7    scale4                                                                                                                     462.4   410.4   8.740
8    pool4                                                                                                                        0.4   951.2   0.805
9    scale5                                                                                                                     462.4   201.2  11.358
10   pool5                                                                                                                        0.2   923.2   0.415
11   scale6                                                                                                                     462.4   348.9   8.919
12   pool6                                                                                                                        0.1   890.5   0.215
13   scale7                                                                                                                     462.4   785.5  12.007
14   scale8                                                                                                                     231.2   577.6   9.283
15   fc9                                                                                                                         36.9  2150.8  16.363
-----------------------------------------------------------------------------------------------------------------------------------------------------
                                                                                                         Total inference time                  115.60
-----------------------------------------------------------------------------------------------------------------------------------------------------
Generating Profile Report 'output_report.html'...

making caffemodel
Downloading caffemodel file
--2018-10-31 16:20:22--  http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/tiny-yolo-v1_53000.caffemodel
Resolving ncs-forum-uploads.s3.amazonaws.com (ncs-forum-uploads.s3.amazonaws.com)... 52.219.24.14
Connecting to ncs-forum-uploads.s3.amazonaws.com (ncs-forum-uploads.s3.amazonaws.com)|52.219.24.14|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2018-10-31 16:20:24--  (try: 2)  http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/tiny-yolo-v1_53000.caffemodel
Connecting to ncs-forum-uploads.s3.amazonaws.com (ncs-forum-uploads.s3.amazonaws.com)|52.219.24.14|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2018-10-31 16:20:26--  (try: 3)  http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/tiny-yolo-v1_53000.caffemodel
Connecting to ncs-forum-uploads.s3.amazonaws.com (ncs-forum-uploads.s3.amazonaws.com)|52.219.24.14|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2018-10-31 16:20:29--  (try: 4)  http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/tiny-yolo-v1_53000.caffemodel
Connecting to ncs-forum-uploads.s3.amazonaws.com (ncs-forum-uploads.s3.amazonaws.com)|52.219.24.14|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2018-10-31 16:20:33--  (try: 5)  http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/tiny-yolo-v1_53000.caffemodel
Connecting to ncs-forum-uploads.s3.amazonaws.com (ncs-forum-uploads.s3.amazonaws.com)|52.219.24.14|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2018-10-31 16:20:38--  (try: 6)  http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/tiny-yolo-v1_53000.caffemodel
Connecting to ncs-forum-uploads.s3.amazonaws.com (ncs-forum-uploads.s3.amazonaws.com)|52.219.24.14|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2018-10-31 16:20:44--  (try: 7)  http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/tiny-yolo-v1_53000.caffemodel
Connecting to ncs-forum-uploads.s3.amazonaws.com (ncs-forum-uploads.s3.amazonaws.com)|52.219.24.14|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2018-10-31 16:20:51--  (try: 8)  http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/tiny-yolo-v1_53000.caffemodel
Connecting to ncs-forum-uploads.s3.amazonaws.com (ncs-forum-uploads.s3.amazonaws.com)|52.219.24.14|:80... connected.
HTTP request sent, awaiting response... No data received.
Retrying.

--2018-10-31 16:20:59--  (try: 9)  http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/tiny-yolo-v1_53000.caffemodel
Connecting to ncs-forum-uploads.s3.amazonaws.com (ncs-forum-uploads.s3.amazonaws.com)|52.219.24.14|:80... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

--2018-10-31 16:21:08--  (try:10)  http://ncs-forum-uploads.s3.amazonaws.com/ncappzoo/tiny_yolo/tiny-yolo-v1_53000.caffemodel
Connecting to ncs-forum-uploads.s3.amazonaws.com (ncs-forum-uploads.s3.amazonaws.com)|52.219.24.14|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 108402374 (103M) [application/octet-stream]
Saving to: ‘./tiny-yolo-v1_53000.caffemodel’

tiny-yolo-v1_53000.caffemodel         100%[=======================================================================>] 103.38M  3.46MB/s    in 31s     

2018-10-31 16:21:40 (3.30 MB/s) - ‘./tiny-yolo-v1_53000.caffemodel’ saved [108402374/108402374]


making compile
mvNCCompile -o graph -w tiny-yolo-v1_53000.caffemodel -s 12 tiny-yolo-v1.prototxt
mvNCCompile v02.00, Copyright @ Movidius Ltd 2016

/usr/local/bin/ncsdk/Controllers/FileIO.py:52: UserWarning: You are using a large type. Consider reducing your data sizes for best performance
  "Consider reducing your data sizes for best performance\033[0m")
[email protected]:~/ncs_work/ncappzoo/caffe/TinyYolo$ 
[email protected]:~/ncs_work/ncappzoo/caffe/TinyYolo$ make run_py 

making prototxt
Prototxt file already exists

making caffemodel
caffemodel file already exists

making compile
mvNCCompile -o graph -w tiny-yolo-v1_53000.caffemodel -s 12 tiny-yolo-v1.prototxt
mvNCCompile v02.00, Copyright @ Movidius Ltd 2016

/usr/local/bin/ncsdk/Controllers/FileIO.py:52: UserWarning: You are using a large type. Consider reducing your data sizes for best performance
  "Consider reducing your data sizes for best performance\033[0m")

making run_py
python3 ./run.py
Running NCS Caffe TinyYolo example
Displaying image with objects detected in GUI
Click in the GUI window and hit any key to exit
Found this many objects in the image: 1
box at index 0 is... left: 227, top: 184, right: 589, bottom: 678
Finished
[email protected]:~/ncs_work/ncappzoo/caffe/TinyYolo$ 
[email protected]:~/ncs_work/ncappzoo/caffe/TinyYolo$

在這裡插入圖片描述