Giter Site home page Giter Site logo

pinto0309 / tinyyolo Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 2.0 93.83 MB

Challenge the marginal performance of YoloV2 + Neural Compute Stick + RaspberryPi YoloV2+Neural Compute Stick(NCS)+Raspberry Piの限界性能に挑戦

Home Page: https://qiita.com/PINTO

License: MIT License

Makefile 2.81% Python 74.04% C++ 22.08% Shell 1.06%
yolov2 opengl opencv python neural-compute-stick deeplearning cpp raspberrypi tinyyolo movidius

tinyyolo's Introduction

[Japanese] TinyYolo

YoloV2+Neural Compute Stick(NCS)+Raspberry Piの限界性能に挑戦 Challenge the marginal performance of YoloV2 + Neural Compute Stick + Raspberry Pi

https://qiita.com/PINTO/items/db3ab44a3e2bcd87f2d8

動作イメージ

TinyYolo + Neural Compute Stick + RaspberryPi3

Youtube: https://youtu.be/L4RvVLyo8Rc

Riders MultiStick

環境

・RaspberryPi 3 + Raspbian Stretch

・NCSDK v1.12.00

・Intel Movidius Neural Compute Stick 1本

・OpenCV 3.4.1

・OpenGL

・numpy

・UVC対応のUSB-Webカメラ

環境構築

  1. SWAP領域の一時的な拡張
$ sudo nano /etc/dphys-swapfile
CONF_SWAPSIZE=2048

$ sudo /etc/init.d/dphys-swapfile restart swapon -s
  1. パッケージのインストール
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install python3-pip python3-numpy git cmake
  1. NCSDKのインストール
$ cd ~
$ git clone https://github.com/movidius/ncsdk.git
$ cd ncsdk
$ make install
  1. OpenCVのインストール
$ wget https://github.com/PINTO0309/OpenCVonARMv7/blob/master/libopencv3_3.4.1-20180304.1_armhf.deb
$ sudo apt install -y ./libopencv3_3.4.1-20180304.1_armhf.deb
$ sudo ldconfig
  1. OpenGLのインストール
$ sudo apt-get install python-opengl
$ sudo -H pip3 install pyopengl
$ sudo -H pip3 install pyopengl_accelerate
$ sudo raspi-config
  1. 「7.Advanced Options」-「A7 GL Driver」-「G2 GL (Fake KMS)」の順に選択し、Raspberry Pi のOpenGL Driver を有効化

  2. 再起動

$ sudo reboot
  1. リソース一式のダウンロード
$ cd ~
$ git clone https://github.com/PINTO0309/TinyYolo.git
  1. USB-WEBカメラ(UVC対応) と Neural Compute Stick をRaspberryPiのUSBポートへ接続(Neural Compute Stickをマルチで使用する場合は電圧が不足するためセルフパワーUSB-Hub必須)

  2. RaspberryPiとディスプレイをHDMIケーブルで接続

  3. MultiStick.pyの実行

$ cd TinyYolo
$ python3 ./detectionExample/MultiStick.py
  1. SWAP領域の縮小
$ sudo nano /etc/dphys-swapfile
CONF_SWAPSIZE=100

$ sudo /etc/init.d/dphys-swapfile restart swapon -s

   

[English] TinyYolo

Challenge the marginal performance of YoloV2 + Neural Compute Stick + Raspberry Pi

https://qiita.com/PINTO/items/db3ab44a3e2bcd87f2d8

Image of motion

TinyYolo + Neural Compute Stick + RaspberryPi3

Youtube: https://youtu.be/L4RvVLyo8Rc

Riders MultiStick

Environment

・RaspberryPi 3 + Raspbian Stretch

・NCSDK v1.12.00

・Intel Movidius Neural Compute Stick 1本

・OpenCV 3.4.1

・OpenGL

・numpy

・(UVC)USB-Web Camera

Building environment

  1. Temporary extension of SWAP area
$ sudo nano /etc/dphys-swapfile
CONF_SWAPSIZE=2048

$ sudo /etc/init.d/dphys-swapfile restart swapon -s
  1. Installing packages
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install python3-pip python3-numpy git cmake
  1. Installing NCSDK
$ cd ~
$ git clone https://github.com/movidius/ncsdk.git
$ cd ncsdk
$ make install
  1. Installation of OpenCV
$ wget https://github.com/PINTO0309/OpenCVonARMv7/blob/master/libopencv3_3.4.1-20180304.1_armhf.deb
$ sudo apt install -y ./libopencv3_3.4.1-20180304.1_armhf.deb
$ sudo ldconfig
  1. Installing OpenGL
$ sudo apt-get install python-opengl
$ sudo -H pip3 install pyopengl
$ sudo -H pip3 install pyopengl_accelerate
$ sudo raspi-config
  1. 「7.Advanced Options」-「A7 GL Driver」-「G2 GL (Fake KMS)」 and Activate Raspberry Pi's OpenGL Driver

  2. Reboot

$ sudo reboot
  1. Download complete set of resources
$ cd ~
$ git clone https://github.com/PINTO0309/TinyYolo.git
  1. Connect USB-WEB camera (UVC compatible) and Neural Compute Stick to RaspberryPi's USB port (self power USB-Hub required due to insufficient voltage when using Neural Compute Stick in multiple)

  2. Connect RaspberryPi and display with HDMI cable

  3. Running MultiStick.py

$ cd TinyYolo
$ python3 ./detectionExample/MultiStick.py
  1. Reducing the SWAP area
$ sudo nano /etc/dphys-swapfile
CONF_SWAPSIZE=100

$ sudo /etc/init.d/dphys-swapfile restart swapon -s

tinyyolo's People

Contributors

pinto0309 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

tinyyolo's Issues

Mesa loader issue.

Whenever I ran multistick.py script I got following error even after reinstalling libdrm using sudo apt install libdrm-*. I got live streaming without detection. Pls help me to solve this.

pi@Zero:~/TinyYolo $ python3 ./detectionExample/MultiStick.py

Device 0 Address: 1.2 - VID/PID 03e7:2150
1
Starting wait for connect with 2000ms timeout
Found Address: 1.2 - VID/PID 03e7:2150
Found EP 0x81 : max packet size is 512 bytes
Found EP 0x01 : max packet size is 512 bytes
Found and opened device
Performing bulk write of 865724 bytes...
Successfully sent 865724 bytes of data in 95.934476 ms (8.606069 MB/s)
Boot successful, device address 1.2
Found Address: 1.2 - VID/PID 03e7:f63b
done
Booted 1.2 -> VSC

Loaded Graphs!!!
libGL error: MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
press 'q' to quit!

RuntimeError: module compiled against API version 0xb but this version of numpy is 0xa
/usr/local/lib/python3.5/dist-packages/OpenGL/arrays/numpymodule.py:30: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
"Unable to load numpy_formathandler accelerator from OpenGL_accelerate"
Unable to load numpy_formathandler accelerator from OpenGL_accelerate

Finished

Thanks in advance
Hashir

Camera problem

Hi @PINTO0309 , thanks for the awesome repository. It works fine with ip camera , raspberry pi camera v2 but when it comes to usb camera(i have tried two different cameras from microsoft and logitecth) it does not detect anything but i can still see the live stream. To be more specific it goes through the following :

global lastresults

    s, img = cam.read()
    #out.write(img)
    
    print(s)
    print("1")
    if not s:
        print("Could not get frame")
        return 0

    lock.acquire()
    if len(frameBuffer)>10:
        for i in range(10):
            del frameBuffer[0]
    frameBuffer.append(img)
    lock.release()
    res = None
    print("2")

then jumps to :

else:
        if lastresults == None:
            img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
            h, w = img.shape[:2]
            glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB, GL_UNSIGNED_BYTE, img)

which means lastresults is none and res is none.
So what should i do? , How can i solve this problem.
Looking for your reply

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.