Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 1.99 KB

README_EN.md

File metadata and controls

34 lines (26 loc) · 1.99 KB

English | 简体中文

SAMTool

SAM for CSharp ONNX Inference

[Paper] [Source Code]

Based on C# language, ONNX format Segment Anything reasoning program. Although the official pre-training model and inference code are provided, the pre-training model is only in pytorch format, and the inference code only provides Python code based on the Pytorch framework. This project consists of two parts:

  1. Split the officially released pre-training model into encoder and decoder, and save them in ONNX format.
  2. Use C# language to load the model, perform inference, and use WPF for interaction and display.

Source code compilation

  1. Download the source code to the local
    2.Visual Studio opens the .sln project solution
  2. Install the Nuget package
    3.1 In Visual Studio, right-click on the project and select "Manage NuGet Packages".
    3.2 In the "NuGet Package Manager" window, select the "Browse" tab.
    3.3 Search for Microsoft.ML.OnnxRuntime, select version 1.15.1, and click Install
    3.4 Search for OpenCvSharp4, select version 4.8.0, and click Install
    3.5 Search for OpenCvSharp4.runtime.win, select version 4.8.0, and click Install
    3.6 the target platform of SAMViewer set x64
  3. Put decoder-quant.onnx , encoder-quant.onnx ,visual.onnx and textual.onnx in the exe path
  4. Run the program

Effect demo:

model file is upload to release, or pay attention to the following WeChat public account, and the background will reply [SAM]get model file download link

Pay attention to the WeChat public account: 人工智能大讲堂