At this point, you should have followed the notebook to train and download your model.
- Attach your camera module to your Pi.
- Connect two LED's to pins 16 and 17.
- Make sure to use appropriate resistors.
- Insert an SD card with a 64-bit OS.
- Install the required packages:
sudo apt install python3, python3-pip, python3-libgpiod, python3-opencv
python3 -m pip install torch
- Place the inference code, "rpi_inference.py" somewhere on your Pi.
- Get the compiled model file onto your Pi.
- The inference code expects the model to be called "sfdc_tutorial_classifier.pth" and to be located in the same directory as your script.
To start inference, run python3 rpi_inference.py
.
Optionally, you can make the script run on bootup by adding a cron job.
Run sudo crontab -e
and add the line @reboot /path/to/rpi_inference.py
.
Congradulations! You have completed the tutorial. You should now have a working image classifier on your Pi.
If it doesn't work, though, don't get discouraged. You often need to play around with the parameters and try it multiple times.
With a bit of time and effort, you can have a bright future in AI!