วันอาทิตย์ที่ 28 ตุลาคม พ.ศ. 2561

Raspberry pi YOLO Real-time Object Detection





Raspberry pi YOLO Real-time Object Detection

You only look once (YOLO) is a state-of-the-art, real-time object detection system.

How It Works

Prior detection systems repurpose classifiers or localizers to perform detection. They apply the model to an image at multiple locations and scales. High scoring regions of the image are considered detections.
We use a totally different approach. We apply a single neural network to the full image. This network divides the image into regions and predicts bounding boxes and probabilities for each region. These bounding boxes are weighted by the predicted probabilities.
Our model has several advantages over classifier-based systems. It looks at the whole image at test time so its predictions are informed by global context in the image. It also makes predictions with a single network evaluation unlike systems like R-CNN which require thousands for a single image. This makes it extremely fast, more than 1000x faster than R-CNN and 100x faster than Fast R-CNN. See our paper for more details on the full system.

What's New in Version 2?

YOLOv2 uses a few tricks to improve training and increase performance. Like Overfeat and SSD we use a fully-convolutional model, but we still train on whole images, not hard negatives. Like Faster R-CNN we adjust priors on bounding boxes instead of predicting the width and height outright. However, we still predict the x and y coordinates directly. The full details are in our paper.!


So,we've test run Yolov2 on 

  1. Raspberry pi only 
  2. Raspberry pi with intel movidius ( Neural Compute Stick )




Run on Raspberry pi


Install darknet yolov2

git clone https://github.com/pjreddie/darknet
cd darknet
make


Download tiny-yolov2 weights

wget https://pjreddie.com/media/files/yolov2-tiny-voc.weights


Run Code
./darknet detector test cfg/voc.data cfg/yolov2-tiny-voc.cfg yolov2-tiny-voc.weights data/dog.jpg

./darknet detector test cfg/voc.data cfg/yolov2-tiny-voc.cfg yolov2-tiny-voc.weights data/dog.jpg

Result




Process time = 32.36 sec.




Run on Raspberry pi with Intel Movidius ( Neural Compute Stick )

This project shows how to run tiny yolov2 (20 classes) with movidius stick:
  • A python convertor from yolo to caffe
  • A c/c++ implementation and python wrapper for region layer of yolov2
  • A sample for running yolov2 with movidius stick in images or videos

Install NCSDK 2.0 ( see this )
https://raspberrypi4u.blogspot.com/2018/10/install-intel-movidius-neural-compute-sdk.html


Install YOLOv2NCS
git clone https://github.com/duangenquan/YoloV2NCS.git

then make
cd YoloV2NCS
make

Convert Caffe to NCS
mvNCCompile ./models/caffemodels/yoloV2Tiny20.prototxt -w ./models/caffemodels/yoloV2Tiny20.caffemodel -s 12

Run Python Code
python3 ./detectionExample/Main.py --image ./data/dog.jpg

Result



Process time = 571 ms.


Reference

https://pjreddie.com/darknet/yolov2/
https://github.com/duangenquan/YoloV2NCS

How computers learn to recognize objects instantly | Joseph Redmon

https://www.youtube.com/watch?v=Cgxsv1riJhI

YOLO Object Detection (TensorFlow tutorial)

https://www.youtube.com/watch?v=4eIBisqx9_g


My Website
email : info@softpowergroup.net  ,amphancm@gmail.com  Tel .+6681-6452400


1 ความคิดเห็น:

  1. hi, i have this error, you know why?

    Loading weights from yolov2-tiny-voc.weights...Couldn't open file: yolov2-tiny-voc.weights

    ตอบลบ