Deeplabv3 Person Segmentation¶
This example showcases the implementation of deepLabv3 person segmentation model with DepthAI SDK.
Note
Visualization in current example is done with blocking behavor. This means that the program will halt at oak.start()
until the window is closed.
This is done to keep the example simple. For more advanced usage, see Blocking behavior section.
Setup¶
Please run the install script to download all required dependencies. Please note that this script must be ran from git context, so you have to download the depthai repository first and then run the script
git clone https://github.com/luxonis/depthai.git
cd depthai/
python3 install_requirements.py
For additional information, please follow our installation guide.
Pipeline¶
Source Code¶
One thing worth noting is the resize mode option. Because inference is done on a color camera which has a 16:9 aspect ratio, and the model expects a 1:1 aspect ratio, we need to resize the input frame to fit the model. This is done in three ways:
letterbox - resize the frame to fit the model, and pad the rest with black pixels
crop - crop the frame to fit the model
stretch - stretch the frame to fit the model
More information at Maximizing FOV.
Also available on GitHub