แสดงบทความที่มีป้ายกำกับ Raspberry Pi TensorFlow แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ Raspberry Pi TensorFlow แสดงบทความทั้งหมด

วันพุธที่ 13 กรกฎาคม พ.ศ. 2565

Raspberry pi 4 Object Detection with TensorFlow and TensorFlow lite

Raspberry pi 4B Object Detection with TensorFlow and Tensorflow Lite Comparison













What is object detection?

Given an image or a video stream, an object detection model can identify which of a known set of objects might be present and provide information about their positions within the image.

An object detection model is trained to detect the presence and location of multiple classes of objects. For example, a model might be trained with images that contain various pieces of fruit, along with a label that specifies the class of fruit they represent (e.g. an apple, a banana, or a strawberry), and data specifying where each object appears in the image.

When we subsequently provide an image to the model, it will output a list of the objects it detects, the location of a bounding box that contains each object, and a score that indicates the confidence that detection was correct.

Object Detection Models

We use MobileNet-v2 Model.

Run Object Detection Model on Raspberry pi 4B


TensorFlow

Software • Raspberry pi Legacy OS ( Raspbian 10 , 32 bit version ) • Tensorflow 1.14.0 • OpenCV 4.0 • Python 3.7.3 Machine Learning Model : SSD Mobilenet V2 ( FP32 )

Image JPG 1024x636 pixels

Video MP4 960x540 pixels

Result ( Image )


Loading time 8327.86 ms             @ test1

Inference time 10245.02 ms


Loading time: 7910.86 ms            @ test2

Inference time: 9650.78 ms


Loading time: 7917.60 ms            @ test3

Inference time: 9642.02 ms


Result ( Video )    ~ 2 fps



TensorFlow-lite

 
Result ( image )


Loading time: 4.13 ms            @ test1

Inference time: 229.85 ms


Loading time: 4.38 ms            @ test2

Inference time: 231.55 ms


Result ( Video )    ~ 4-5 fps



TensorFlow and TensorFlow-lite Comparison















Reference

TensorFlow

https://www.tensorflow.org/

https://github.com/tensorflow/models


TensorFlow-lite

https://github.com/EdjeElectronics/TensorFlow-Lite-Object-Detection-on-Android-and-Raspberry-Pi


Website : https://softpower.tech

วันอาทิตย์ที่ 2 กุมภาพันธ์ พ.ศ. 2563

Raspberry pi Smart cam AI kit with Pi Cam



Raspberry pi Smart cam AI kit with Pi Cam or USB cam

TensorFlow-lite Version then no need intel Neural Compute Stick yet.


System Diagram

System Requirements


Hardware
·     Raspberry Pi Board (4B , 3B+)
·     Pi Camera ( V1 or V2 ) or USB cam
·     SD Card 32GB
·     5V DC. 2A Power Supply
Software
·     OS Raspbien 10 ( Buster )
·     Python 3.7.3
·     Tensorflow lite 1.14.0
·     OpenCV 4.0.0

Machine Learning Model : MobileNet SSD V2 Quantised


Main Page ( Home )



Report Page
Setting Page

Set WiFi
Source Code ( Python )




















Raspberry pi Smart Cam AI kit. ( Include Full Source Code in SD card )

  1.       Raspberry pi 4B ( 1 GB ) + Case
  2.       SDcard 32 GB. ( Software installed )
  3.       5V DC. 2A Power Supply
Option
  • USB Webcam Model Logitech C270 
  • Intel Neural Compute Stick2 
If You want Raspberry pi AI Kit. Please contact email amphancm@gmail.com 


Reference

Install Tensorflow on Raspberry pi

Tensorflow Model Zoo


How to Run TensorFlow Lite Object Detection

วันศุกร์ที่ 24 มกราคม พ.ศ. 2563

Raspberry pi TensorFlow-lite Object detection




Raspberry pi TensorFlow-lite Object detection

How to use TensorFlow Lite object detection models on the Raspberry Pi.



TensorFlow Lite is an optimized framework for deploying lightweight deep learning models on resource-constrained edge devices. TensorFlow Lite models have faster inference time and require less processing power, so they can be used to obtain faster performance in realtime applications.


  

System Requirements

Hardware
·     Raspberry Pi Board (4B , 3B+)
·     IP Camera, USB Camera or Pi Camera
·     SD Card 32GB
·     5V DC. 2A Power Supply

Software
·     OS Raspbien 10 ( buster )
·     Python 3.7.2
·     Tensorflow lite 1.14.0
·     OpenCV 4.0.0

Machine Learning Model : MobileNet SSD V2 Quantised


 

Source Code
https://github.com/EdjeElectronics/TensorFlow-Lite-Object-Detection-on-Android-and-Raspberry-Pi


Reference

Install Tensorflow on Raspberry pi
https://www.tensorflow.org/install/source_rpi

Tensorflow Model Zoo
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md


How to Run TensorFlow Lite Object Detection

วันศุกร์ที่ 2 พฤศจิกายน พ.ศ. 2561

Raspberry pi TensorFlow Object Detection API


Raspberry pi TensorFlow Object Detection API


What is TensorFlow Object Detection API?

Creating accurate machine learning models capable of localizing and identifying multiple objects in a single image remains a core challenge in computer vision. The TensorFlow Object Detection API is an open source framework built on top of TensorFlow that makes it easy to construct, train and deploy object detection models. At Google we’ve certainly found this codebase to be useful for our computer vision needs, and we hope that you will as well.


Why Raspberry Pi?
The raspberry pi is a neat piece of hardware that has captured the hearts of a generation with ~15M devices sold, with hackers building even cooler projects on it. Given the popularity of Deep Learning and the Raspberry Pi Camera we thought it would be nice if we could detect any object using Deep Learning on the Pi.

Steps
Install OpenCV
http://raspberrypi4u.blogspot.com/2018/08/raspberry-pi-install-opencv.html

Install TensorFlow
https://www.tensorflow.org/install/

Install Protobuf
https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md

get the packages needed

sudo apt-get install autoconf automake libtool curl
download the protobuf 
wget https://github.com/google/protobuf/releases/download/v3.5.1/protobuf-all-3.5.1.tar.gz
tar -zxvf protobuf-all-3.5.1.tar.gz
cd protobuf-3.5.1
Configure the build
./configure
Build the package
make -j4
sudo make install
cd python
export LD_LIBRARY_PATH=../src/.libs
python setup
python3 setup.py build --cpp_implementation 
python3 setup.py test --cpp_implementation
sudo python3 setup.py install --cpp_implementation
path commands
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION=3
Finally
sudo ldconfig
Test
protoc
Setup TensorFlow Directory 

mkdir tensorflow1
cd tensorflow1
Download the tensorflow repository
git clone --recurse-submodules https://github.com/tensorflow/models.git
we need to modify the PYTHONPATH environment
sudo nano ~/.bashrc
export PYTHONPATH=$PYTHONPATH:/home/pi/tensorflow1/models/research:/home/pi/tensorflow1/models/research/slim



cd /home/pi/tensorflow1/models/research
protoc object_detection/protos/*.proto --python_out=.

cd /home/pi/tensorflow1/models/research/object_detection
Download the SSDLite-MobileNet model
wget http://download.tensorflow.org/models/object_detection/ssdlite_mobilenet_v2_coco_2018_05_09.tar.gz
tar -xzvf ssdlite_mobilenet_v2_coco_2018_05_09.tar.gz

RUN Code

Download the code
wget https://raw.githubusercontent.com/EdjeElectronics/TensorFlow-Object-Detection-on-the-Raspberry-Pi/master/Object_detection_picamera.py
python3 Object_detection_picamera.py --usbcam

if you use picam
python3 Object_detection_picamera.py 

Reference
https://github.com/EdjeElectronics/TensorFlow-Object-Detection-on-the-Raspberry-Pi

https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md



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