AI on Rbian
Description
Makes it easy for Brainy Pi customers to build AI applications using different frameworks. AI on Rbian page shows working methods to install popular AI Frameworks with a test example. Additionally the page will link to individual framework pages where more ready to use examples are available.
INFO
This documentation is for Rbian OS version: 0.7.2-beta
To check the version of Rbian run the command in terminal
os-version
Note: If the command fails or gives error then Rbian version is < 0.7.2-beta.
Installing Frameworks and using with example
This Document will give you a step wise instuctions for installing AI frameworks on BrainyPi and using it.
Tensorflow
Installing Tensorflow
-
Run this command on terminal
pip3 install tensorflow pip3 install tensorflow-io
-
Installs version: 2.10.0
TF sample program to classify 1000 imagenet classes
Clone the repository and navigate to folder
git clone https://github.com/brainypi/BrainyPi-AI-Examples.git cd BrainyPi-AI-Examples/Tensorflow
Now run Image classfication example. classifies Imagenet 1000 classes.
python3 classify_image.py --image_file peacock.jpg
Input
Parameter1(Default: peacock.jpg): –image_file: Image file location
Parameter2(Default: 5): —-num_top_predictions: No of predictions you want to see
Output
Shows the Classified class label with probability on terminal
TFLite
Installing Tflite
-
Run this command on terminal
pip3 install tflite-runtime
-
Install version: 2.11.0
-
TFlite sample program to classify 1000 imagenet classes
Clone the repository and navigate to folder
git clone https://github.com/brainypi/BrainyPi-AI-Examples.git cd BrainyPi-AI-Examples/TFLite
Now run Image classfication example. classifies Imagenet 1000 classes.
python3 classify_image.py --image_file peacock.jpg
Input
Parameter1(Default: peacock.jpg): –image_file: Image file location
Parameter2(Default: 5): —-num_top_predictions: No of predictions you want to see
Output
Shows the Classified class label with probability on terminal
Pytorch
Installing Pytorch
Run this command on terminal
pip3 install torch==1.13.1 torchvision==0.14.1
Installs version: torch – 1.13.1 & torchvision – 0.14.1
Pytorch Sample program to classify 1000 imagenet classes
Clone the repository and navigate to folder
git clone https://github.com/brainypi/BrainyPi-AI-Examples.git cd BrainyPi-AI-Examples/Pytorch
Now run Image classfication example. classifies Imagenet 1000 classes.
python3 classify_image.py --image_file peacock.jpg
Input
Parameter1(Default: peacock.jpg): –image_file: Image file location
Parameter2(Default: 5): —-num_top_predictions: No of predictions you want to see
Output
Shows the Classified class label with probability on terminal
Opencv
Installing Opencv
Run this command on terminal
pip3 install opencv-python
Installs version: 4.6.0.66
Opencv Sample program to blur the image
Clone the repository and navigate to folder
git clone https://github.com/brainypi/BrainyPi-AI-Examples.git cd BrainyPi-AI-Examples/Opencv
Now run Image Blur example.
python3 blurImage.py --image_file peacock.jpg
Input
Parameter1(Default: peacock.jpg): –image_file: Image file location
Output
Stores output images with respective blue method names.
ONNX Runtime
Installing ONNX runtime
-
Run this command on terminal
pip3 install tensorflow pip3 install tensorflow-io pip3 install onnxruntime
-
Installs version: onnxruntime – 1.13.1
ONNX Sample Program to Classify 1000 imagenet classes
Clone the repository and navigate to folder
git clone https://github.com/brainypi/BrainyPi-AI-Examples.git cd BrainyPi-AI-Examples/Onnx
Now run Image classfication example. classifies Imagenet 1000 classes.
python3 classify_image.py --image_file peacock.jpg
Input
Parameter1(Default: peacock.jpg): –image_file: Image file location
Parameter2(Default: 5): —-num_top_predictions: No of predictions you want to see
Output
Shows the Classified class label with probability on terminal
Convert tensorflow, pytorch models to ONNX: Official Documentation
NEED SUPPORT?
First, Ensure version of OS installed and the version this document is intended for match. If they match and yet problem persists. Please use this Forum link for community help.
If you are an enterprise customer please use the ticketing system login provided to you for priority support.
Previous
<< Raspberry Pi Compatibility
Next
Rbian OS Advances >>