Python scripts performing semantic segmentation using the TopFormer model in ONNX.
Original image: https://en.wikipedia.org/wiki/File:Beatles_-_Abbey_Road.jpg
- Check the requirements.txt file.
- For ONNX, if you have a NVIDIA GPU, then install the onnxruntime-gpu, otherwise use the onnxruntime library.
- Additionally, pafy and youtube-dl are required for youtube video inference.
git clone https://github.com/ibaiGorordo/ONNX-TopFormer-Semantic-Segmentation.git
cd ONNX-TopFormer-Semantic-Segmentation
pip install -r requirements.txt
For Nvidia GPU computers:
pip install onnxruntime-gpu
Otherwise:
pip install onnxruntime
pip install youtube_dl
pip install git+https://github.com/zizo-pro/pafy@b8976f22c19e4ab5515cacbfae0a3970370c102b
The model was converted from the Pytorch implementation using the code in the original repository. Download the converted ONNX model from the drive file and save them into the models folder.
- The License of the models is Apache-2.0 License: https://github.com/hustvl/TopFormer/blob/main/LICENSE
The original Pytorch model can be found in this repository: https://github.com/hustvl/TopFormer
- Image inference:
python image_semantic_segmentation.py
- Webcam inference:
python webcam_semantic_segmentation.py
- Video inference: https://youtu.be/JkOSbtKfIFo
python video_semantic_segmentation.py
Original video: https://youtu.be/yWHdkK5j4yk
- TopFormer model: https://github.com/hustvl/TopFormer
- PINTO0309's model zoo: https://github.com/PINTO0309/PINTO_model_zoo
- Original paper: https://arxiv.org/abs/2204.05525