Supported Models
- FCN (Fully Convolutional Networks) - FCN-8s, FCN-ResNet101
- ENet - Efficient neural network for real-time segmentation
- DeepLab - State-of-the-art segmentation with atrous convolution
- U-Net - Popular architecture for medical image segmentation
- PSPNet - Pyramid Scene Parsing Network
Python Implementation
Prepare Input Image
Different segmentation models require different input sizes:
- ENet: 512x256
- FCN-8s: 500x500
- FCN-ResNet101: 500x500
C++ Implementation
- Complete Example
- Video Processing
Creating a Legend
Display a legend showing class names and colors:Model Configurations
ENet (Torch)
FCN-8s (Caffe)
FCN-ResNet101 (ONNX)
Common Segmentation Classes
- Cityscapes (ENet)
- PASCAL VOC (FCN)
Road scene segmentation with 20 classes:
- road
- sidewalk
- building
- wall
- fence
- pole
- traffic light
- traffic sign
- vegetation
- terrain
- sky
- person
- rider
- car
- truck
- bus
- train
- motorcycle
- bicycle
Performance Optimization
Blending Segmentation with Original Image
Adjust the blend ratio for different visualization effects:Complete Example with Video
Source Code
Complete source code for semantic segmentation:- Python:
samples/dnn/segmentation.py - C++:
samples/dnn/segmentation.cpp
