# thippeswammy/autosegmentor architecture

> Architecture diagram of the GitHub repository thippeswammy/autosegmentor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thippeswammy/autosegmentor
- Repository: https://github.com/thippeswammy/autosegmentor

## Overview

AutoSegmentor turns video into reviewed, frame-level masks and optional tracked pose labels, then exports annotated results; DatasetManager separately prepares YOLO datasets and synthetic samples. The README documents the desktop-to-engine workflow and the SAM2/CoTracker roles. Source-index references support many internal calls, but several UI, engine, and export implementations were not sampled, so some subsystem relationships are documented rather than directly verified; unsampled capabilities are represented at their existing directory paths.

Main entry points: [`DatasetManager/SyntheticEngine/pipeline/synthetic_pipeline.py`](https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/SyntheticEngine/pipeline/synthetic_pipeline.py) (Synthetic generation), [`AutoSegmentor/core/AutoSegmentorEngine.py`](https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/core/AutoSegmentorEngine.py) (Annotation engine), [`AutoSegmentor/pipeline.py`](https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/pipeline.py) (Processing pipeline), [`DatasetManager/SyntheticEngine/core/sample_record.py`](https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/SyntheticEngine/core/sample_record.py) (Sample record)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Annotation application"]
  node_desktop["Desktop UI<br/>[MainWindow.py]"]
  node_engine["Annotation engine"]
  node_frames["Frame handling<br/>[FrameHandler.py]"]
  node_annotations[("Prompt annotations")]
end

subgraph group_models["Inference and tracking"]
  node_sam_config["SAM configuration<br/>[AppConfig.py]"]
  node_sam_loader["SAM2 loader<br/>[SAM2Model.py]"]
  node_sam2["SAM2 video inference"]
  node_sam_network["SAM2 network<br/>[sam2_base.py]"]
  node_cotracker["CoTracker tracking"]
  node_model_info["Checkpoint metadata<br/>[model_info.py]"]
end

subgraph group_outputs["Annotation outputs"]
  node_pipeline["Processing pipeline<br/>[pipeline.py]"]
  node_file_manager["File management<br/>[FileManager.py]"]
  node_mask_processing["Mask processing<br/>[MaskProcessor.py]"]
  node_pose_export["Pose export<br/>[PoseExporter.py]"]
  node_video_output["Video creation<br/>[VideoCreator.py]"]
end

subgraph group_dataset["Dataset preparation"]
  node_dataset_creator["YOLO dataset creation<br/>[DatasetCreator.py]"]
  node_pose_conversion["Pose conversion"]
end

subgraph group_synthetic["Synthetic data"]
  node_synthetic_pipeline["Synthetic generation"]
  node_sample_record["Sample record<br/>[sample_record.py]"]
  node_backgrounds[("Background pool")]
  node_geometric["Geometric augmentation"]
  node_copy_paste["Copy-paste augmentation"]
  node_photometric["Photometric augmentation"]
  node_occlusion["Occlusion simulation"]
  node_yolo_writer["YOLO writer<br/>[yolo_writer.py]"]
end

node_user(("Annotator"))

node_user -->|"annotates video"| node_desktop
node_desktop -->|"drives"| node_engine
node_engine -->|"handles frames"| node_frames
node_engine -->|"reads prompts"| node_annotations
node_engine -->|"uses configuration"| node_sam_config
node_engine -->|"runs segmentation"| node_sam_loader
node_sam_loader -->|"loads predictor"| node_sam2
node_sam2 -->|"uses network"| node_sam_network
node_engine -->|"tracks keypoints"| node_cotracker
node_sam_config -->|"reads checkpoint metadata"| node_model_info
node_sam_loader -->|"reads checkpoint metadata"| node_model_info
node_cotracker -->|"reads checkpoint metadata"| node_model_info
node_desktop -.->|"starts workflow"| node_pipeline
node_pipeline -->|"runs annotation"| node_engine
node_pipeline -->|"exports pose labels"| node_pose_export
node_pipeline -->|"creates video"| node_video_output
node_pipeline -->|"manages output paths"| node_file_manager
node_pipeline -.->|"processes masks"| node_mask_processing
node_user -.->|"prepares dataset"| node_dataset_creator
node_dataset_creator -.->|"converts pose labels"| node_pose_conversion
node_user -.->|"generates samples"| node_synthetic_pipeline
node_synthetic_pipeline -->|"loads records"| node_sample_record
node_synthetic_pipeline -->|"selects backgrounds"| node_backgrounds
node_synthetic_pipeline -->|"transforms samples"| node_geometric
node_synthetic_pipeline -->|"composites samples"| node_copy_paste
node_synthetic_pipeline -->|"adjusts appearance"| node_photometric
node_synthetic_pipeline -->|"simulates occlusion"| node_occlusion
node_synthetic_pipeline -->|"writes labels"| node_yolo_writer
node_geometric -->|"updates record"| node_sample_record
node_copy_paste -->|"composites record"| node_sample_record
node_photometric -->|"transforms record"| node_sample_record
node_occlusion -->|"updates record"| node_sample_record

click node_desktop "https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/ui/MainWindow.py"
click node_engine "https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/core/AutoSegmentorEngine.py"
click node_frames "https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/file_management/FrameHandler.py"
click node_annotations "https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/ui/AnnotationManager.py"
click node_sam_config "https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/models/SAM/AppConfig.py"
click node_sam_loader "https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/models/SAM/SAM2Model.py"
click node_sam2 "https://github.com/thippeswammy/autosegmentor/blob/master/external/segment_anything_2/sam2/sam2_video_predictor.py"
click node_sam_network "https://github.com/thippeswammy/autosegmentor/blob/master/external/segment_anything_2/sam2/modeling/sam2_base.py"
click node_cotracker "https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/models/Tracking/CoTrackerPredictor.py"
click node_model_info "https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/models/model_info.py"
click node_pipeline "https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/pipeline.py"
click node_file_manager "https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/file_management/FileManager.py"
click node_mask_processing "https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/file_management/MaskProcessor.py"
click node_pose_export "https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/file_management/PoseExporter.py"
click node_video_output "https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/file_management/VideoCreator.py"
click node_dataset_creator "https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/YolovDatasetManager/DatasetCreator.py"
click node_pose_conversion "https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/convert_to_yolo_pose.py"
click node_synthetic_pipeline "https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/SyntheticEngine/pipeline/synthetic_pipeline.py"
click node_sample_record "https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/SyntheticEngine/core/sample_record.py"
click node_backgrounds "https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/SyntheticEngine/backgrounds/background_manager.py"
click node_geometric "https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/SyntheticEngine/augmentation/geometric_augmentor.py"
click node_copy_paste "https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/SyntheticEngine/augmentation/copy_paste_engine.py"
click node_photometric "https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/SyntheticEngine/augmentation/photometric_augmentor.py"
click node_occlusion "https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/SyntheticEngine/augmentation/occlusion_simulator.py"
click node_yolo_writer "https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/SyntheticEngine/pipeline/yolo_writer.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_desktop,node_engine,node_frames,node_annotations toneBlue
class node_sam_config,node_sam_loader,node_sam2,node_sam_network,node_cotracker,node_model_info toneAmber
class node_pipeline,node_file_manager,node_mask_processing,node_pose_export,node_video_output toneMint
class node_dataset_creator,node_pose_conversion toneRose
class node_synthetic_pipeline,node_sample_record,node_backgrounds,node_geometric,node_copy_paste,node_photometric,node_occlusion,node_yolo_writer,node_user toneIndigo
```

## Components

### Annotation application

- [Desktop UI](https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/ui/MainWindow.py): `AutoSegmentor/ui/MainWindow.py`
- [Annotation engine](https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/core/AutoSegmentorEngine.py): `AutoSegmentor/core/AutoSegmentorEngine.py`
- [Frame handling](https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/file_management/FrameHandler.py): `AutoSegmentor/file_management/FrameHandler.py`
- [Prompt annotations](https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/ui/AnnotationManager.py): `AutoSegmentor/ui/AnnotationManager.py`

### Inference and tracking

- [SAM configuration](https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/models/SAM/AppConfig.py): `AutoSegmentor/models/SAM/AppConfig.py`
- [SAM2 loader](https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/models/SAM/SAM2Model.py): `AutoSegmentor/models/SAM/SAM2Model.py`
- [SAM2 video inference](https://github.com/thippeswammy/autosegmentor/blob/master/external/segment_anything_2/sam2/sam2_video_predictor.py): `external/segment_anything_2/sam2/sam2_video_predictor.py`
- [SAM2 network](https://github.com/thippeswammy/autosegmentor/blob/master/external/segment_anything_2/sam2/modeling/sam2_base.py): `external/segment_anything_2/sam2/modeling/sam2_base.py`
- [CoTracker tracking](https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/models/Tracking/CoTrackerPredictor.py): `AutoSegmentor/models/Tracking/CoTrackerPredictor.py`
- [Checkpoint metadata](https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/models/model_info.py): `AutoSegmentor/models/model_info.py`

### Annotation outputs

- [Processing pipeline](https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/pipeline.py): `AutoSegmentor/pipeline.py`
- [File management](https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/file_management/FileManager.py): `AutoSegmentor/file_management/FileManager.py`
- [Mask processing](https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/file_management/MaskProcessor.py): `AutoSegmentor/file_management/MaskProcessor.py`
- [Pose export](https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/file_management/PoseExporter.py): `AutoSegmentor/file_management/PoseExporter.py`
- [Video creation](https://github.com/thippeswammy/autosegmentor/blob/master/AutoSegmentor/file_management/VideoCreator.py): `AutoSegmentor/file_management/VideoCreator.py`

### Dataset preparation

- [YOLO dataset creation](https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/YolovDatasetManager/DatasetCreator.py): `DatasetManager/YolovDatasetManager/DatasetCreator.py`
- [Pose conversion](https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/convert_to_yolo_pose.py): `DatasetManager/convert_to_yolo_pose.py`

### Synthetic data

- [Synthetic generation](https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/SyntheticEngine/pipeline/synthetic_pipeline.py): `DatasetManager/SyntheticEngine/pipeline/synthetic_pipeline.py`
- [Sample record](https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/SyntheticEngine/core/sample_record.py): `DatasetManager/SyntheticEngine/core/sample_record.py`
- [Background pool](https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/SyntheticEngine/backgrounds/background_manager.py): `DatasetManager/SyntheticEngine/backgrounds/background_manager.py`
- [Geometric augmentation](https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/SyntheticEngine/augmentation/geometric_augmentor.py): `DatasetManager/SyntheticEngine/augmentation/geometric_augmentor.py`
- [Copy-paste augmentation](https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/SyntheticEngine/augmentation/copy_paste_engine.py): `DatasetManager/SyntheticEngine/augmentation/copy_paste_engine.py`
- [Photometric augmentation](https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/SyntheticEngine/augmentation/photometric_augmentor.py): `DatasetManager/SyntheticEngine/augmentation/photometric_augmentor.py`
- [Occlusion simulation](https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/SyntheticEngine/augmentation/occlusion_simulator.py): `DatasetManager/SyntheticEngine/augmentation/occlusion_simulator.py`
- [YOLO writer](https://github.com/thippeswammy/autosegmentor/blob/master/DatasetManager/SyntheticEngine/pipeline/yolo_writer.py): `DatasetManager/SyntheticEngine/pipeline/yolo_writer.py`

### Other components

- **Annotator**

## Connections

- Annotator → Desktop UI: annotates video (evidence: `README.md`)
- Desktop UI → Annotation engine: drives (evidence: `README.md`)
- Annotation engine → Frame handling: handles frames (evidence: `AutoSegmentor/core/AutoSegmentorEngine.py`)
- Annotation engine → Prompt annotations: reads prompts (evidence: `AutoSegmentor/core/AutoSegmentorEngine.py`)
- Annotation engine → SAM configuration: uses configuration (evidence: `AutoSegmentor/core/AutoSegmentorEngine.py`)
- Annotation engine → SAM2 loader: runs segmentation (evidence: `AutoSegmentor/core/AutoSegmentorEngine.py`)
- SAM2 loader → SAM2 video inference: loads predictor (evidence: `AutoSegmentor/models/SAM/SAM2Model.py`)
- SAM2 video inference → SAM2 network: uses network (evidence: `external/segment_anything_2/sam2/sam2_video_predictor.py`)
- Annotation engine → CoTracker tracking: tracks keypoints (evidence: `AutoSegmentor/core/AutoSegmentorEngine.py`)
- SAM configuration → Checkpoint metadata: reads checkpoint metadata (evidence: `AutoSegmentor/models/SAM/AppConfig.py`)
- SAM2 loader → Checkpoint metadata: reads checkpoint metadata (evidence: `AutoSegmentor/models/SAM/SAM2Model.py`)
- CoTracker tracking → Checkpoint metadata: reads checkpoint metadata (evidence: `AutoSegmentor/models/Tracking/CoTrackerPredictor.py`)
- Desktop UI → Processing pipeline: starts workflow (evidence: `README.md`)
- Processing pipeline → Annotation engine: runs annotation (evidence: `AutoSegmentor/pipeline.py`)
- Processing pipeline → Pose export: exports pose labels (evidence: `AutoSegmentor/pipeline.py`)
- Processing pipeline → Video creation: creates video (evidence: `AutoSegmentor/pipeline.py`)
- Processing pipeline → File management: manages output paths (evidence: `AutoSegmentor/pipeline.py`)
- Processing pipeline → Mask processing: processes masks
- Annotator → YOLO dataset creation: prepares dataset (evidence: `README.md`)
- YOLO dataset creation → Pose conversion: converts pose labels
- Annotator → Synthetic generation: generates samples (evidence: `README.md`)
- Synthetic generation → Sample record: loads records (evidence: `DatasetManager/SyntheticEngine/pipeline/synthetic_pipeline.py`)
- Synthetic generation → Background pool: selects backgrounds (evidence: `DatasetManager/SyntheticEngine/pipeline/synthetic_pipeline.py`)
- Synthetic generation → Geometric augmentation: transforms samples (evidence: `DatasetManager/SyntheticEngine/pipeline/synthetic_pipeline.py`)
- Synthetic generation → Copy-paste augmentation: composites samples (evidence: `DatasetManager/SyntheticEngine/pipeline/synthetic_pipeline.py`)
- Synthetic generation → Photometric augmentation: adjusts appearance (evidence: `DatasetManager/SyntheticEngine/pipeline/synthetic_pipeline.py`)
- Synthetic generation → Occlusion simulation: simulates occlusion (evidence: `DatasetManager/SyntheticEngine/pipeline/synthetic_pipeline.py`)
- Synthetic generation → YOLO writer: writes labels (evidence: `DatasetManager/SyntheticEngine/pipeline/synthetic_pipeline.py`)
- Geometric augmentation → Sample record: updates record (evidence: `DatasetManager/SyntheticEngine/augmentation/geometric_augmentor.py`)
- Copy-paste augmentation → Sample record: composites record (evidence: `DatasetManager/SyntheticEngine/augmentation/copy_paste_engine.py`)
- Photometric augmentation → Sample record: transforms record (evidence: `DatasetManager/SyntheticEngine/augmentation/photometric_augmentor.py`)
- Occlusion simulation → Sample record: updates record (evidence: `DatasetManager/SyntheticEngine/augmentation/occlusion_simulator.py`)
