Pytorch examples
Description
Pytorch has been popular for its performance and easy to implementation techniques. Lets explore different pytorch applications on brainyPi.
INFO
This documentation is for Rbian OS version: 0.7.2-beta & for Pytorch version 1.13.1.
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.
To check the version of Pytorch run the command in python
import torch as tr
print(tr.__version__)
People Counter
People Counter counts the number of people in the image and prints it on the terminal. We can count people from videos, images, camera stream etc.
Prerequisites
Install Pytorch from the previously mentioned steps.
Install Numpy
pip3 install numpy==1.24.1
pip3 install pillow
Clone the repository
git clone https://github.com/brainypi/BrainyPi-AI-Examples.git
cd BrainyPi-AI-Examples/Pytorch/people-counter
Run Image segmentation example
python people_counter.py mb1-ssd models/mobilenet-v1-ssd-mp-0_675.pth models/voc-model-labels.txt video.mp4
Input
Parameter1: Model name
Parameter2: Model path
Parameter3: Labels file path
Parameter4: Input Video: In case this parameter is not provided, it will take the input from camera directly.
Output
Shows the Label with probability on terminal and the detected objects image.
Vehicle Counter
We will be implementing Vehicle Counter application on BrainyPi which is trained on coco dataset including car, bus, bicycle, motorbike vehicle.
Prerequisites
Install Pytorch from the previously mentioned steps.
Install Numpy
pip3 install numpy==1.24.1
Clone the repository
git clone https://github.com/brainypi/BrainyPi-AI-Examples.git
cd BrainyPi-AI-Examples/Pytorch/vehicle-counter
Run Image segmentation example
python vehicle_counter.py mb1-ssd models/mobilenet-v1-ssd-mp-0_675.pth models/voc-model-labels.txt video.mp4
-
Input
-
Parameter1: Model name
-
Parameter2: Model path
-
Parameter3: Labels file path
-
Parameter4: Input Video : In case this parameter is not provided, it will take the input from camera directly.
-
-
Output
-
Shows the Label with probability on terminal and the detected objects image.
-
Previous
<< GPIO Examples
Next
Opencv Examples >>