SubjectLift is a desktop application built using Avalonia UI and C#. It allows to segment objects in your images like you can do in iPhone. This project is an exercise in using Segment Anything Model and ONNX with C#. There are a lot of improvements that can be made in code performance, segmentation and UX. This project represents a reference for using a model ported to ONNX with C#.
The inference is very slow and runs on the CPU. It can be made to run in the GPU but you will need to install additional software from NVIDIA so I skipped it.
- Open Image: Load an image into the application using Ctrl+O.
- Segment Subject: Click on a subject within the image to get the segmented mask and display it.
- .NET SDK
- JetBrains Rider or any other C# IDE
- Clone the repository
- Download the encoder and decoder models from this link and place them in the
Models
folder where the executable is located. UsuallySubjectLift.Desktop\bin\Debug\net8.0\Models
- Open the project in your IDE.
- Build the project.
- Run the application.
App.axaml.cs
: Entry point of the application.Views/MainWindow.axaml
: XAML layout for the main window.Views/MainWindow.axaml.cs
: Code-behind for the main window.Controls/MaskedImage.cs
: Custom control for displaying images with masks.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.