AnnotationTool is a C# WinForms application for the complete annotation → training → inference loop focused on industrial image segmentation tasks with typically small datasets.
It provides a simple workflow for generating pixel-level annotations, training segmentation models using TorchSharp, and running inference with visualization and metrics.
The current version focuses on binary segmentation. A number of enhancements are planned – see TODO / Roadmap at the bottom.
This repository includes a ready-to-use sample project so you can immediately try out the workflow.
Each project stores:
- Images
- Training settings in a json file
- Structured folder layout (
Images/,Annotations/,Masks/,Results/,Logs/)
- Brush & eraser with adjustable size
- ROI definition with movable & resizable handles
- Per-image dataset split controls
- Feature palette
- Zoom & pan
- Optional grayscale conversion
- Downsampling & patch slicing
- Photometric and geometric augmentations
- TorchSharp UNet implementation
- CUDA or CPU support
- Automatic batch size estimation
- Early stopping settings
- Live training charts
- Patch-based inference
- Prediction heatmaps + overlays
- Aggregated (macro/micro) metrics:
- Dice, IoU, Precision, Recall, Accuracy, FPR
- Create a project
- Add images
- Add one feature (foreground)
- Annotate using brush/eraser and ROI
- Configure preprocessing, augmentations, and training settings
- Train
- Run inference
- Inspect metrics & heatmaps
This project is actively developed. The following improvements are planned or in progress:
- Upgrade all class libraries (
AnnotationTool.Ai,AnnotationTool.Core) to .NET 10
→ Allows BFloat16 support, performance boosts, (unsafe pointers → Span/Memory)
- Multiclass segmentation support (multiple features/classes)
- Augmentation preview window (before training)
- Advanced augmentations (elastic, cutout, gamma, random crop)
- Synthetic sample generation for industrial datasets
- Multiclass UNet training pipeline
- BF16 after .NET 10 upgrade
- Model zoo: Residual UNet, UNet++, Attention UNet, Mobile-UNet
- Auto LR finder
- PR/ROC curves
- Confusion matrix
- Slice-level metrics (useful for defect inspection tasks)
- Batch inference for external folders
- Active learning loop (model-guided refinement)
- Semi-supervised learning options
At repo level:
DeepLearningEditor.sln
src/
AnnotationTool.App/ # WinForms UI: annotation, training, inference
AnnotationTool.Ai/ # TorchSharp models, training and inference pipeline
AnnotationTool.Core/ # Core models, services, configuration, utilities
---
## Requirements
- Windows 10/11
- .NET 10 (WinForms App already targets .NET 10)
- TorchSharp (CPU or CUDA backend)
- Visual Studio 2022+
- Optional: NVIDIA GPU with compatible CUDA runtime
---