Coder Social home page Coder Social logo

ibaigorordo / onnx-topformer-semantic-segmentation Goto Github PK

View Code? Open in Web Editor NEW
17.0 2.0 1.0 14.38 MB

Python scripts performing semantic segmentation using the TopFormer model in ONNX.

License: MIT License

Python 100.00%
ade20k computer-vision onnx onnxruntime onnxruntime-gpu opencv python semantic-segmentation

onnx-topformer-semantic-segmentation's Introduction

ONNX TopFormer Semantic Segmentation

Python scripts performing semantic segmentation using the TopFormer model in ONNX.

!TopFormer Semantic Segmentation Original image: https://en.wikipedia.org/wiki/File:Beatles_-_Abbey_Road.jpg

Requirements

  • 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.

Installation

git clone https://github.com/ibaiGorordo/ONNX-TopFormer-Semantic-Segmentation.git
cd ONNX-TopFormer-Semantic-Segmentation
pip install -r requirements.txt

ONNX Runtime

For Nvidia GPU computers: pip install onnxruntime-gpu

Otherwise: pip install onnxruntime

For youtube video inference

pip install youtube_dl
pip install git+https://github.com/zizo-pro/pafy@b8976f22c19e4ab5515cacbfae0a3970370c102b

ONNX model

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.

Pytorch model

The original Pytorch model can be found in this repository: https://github.com/hustvl/TopFormer

Examples

  • Image inference:
python image_semantic_segmentation.py
  • Webcam inference:
python webcam_semantic_segmentation.py
python video_semantic_segmentation.py

!CREStereo depth estimation

Original video: https://youtu.be/yWHdkK5j4yk

References:

onnx-topformer-semantic-segmentation's People

Contributors

ibaigorordo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

0iui0

onnx-topformer-semantic-segmentation's Issues

Can you explain how the segmentation is added to the image?

Your code is amazingly simple and good readable. Thank you.

I am trying to see how to get my model working in ONNX (WongKinYiu/yolov7#797 (comment)). I am working on Yolo segmentation and running through a bunch of examples.

Your output is float32[1,150,64,64], how is that converted to the masks you put on the image?

`
def process_output(self, outputs):

	return np.squeeze(np.argmax(outputs[0], axis=1))

def draw_segmentation(self, image, alpha = 0.5):

	return util_draw_seg(self.seg_map, image, alpha)

`

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.