Files
SR-Label-SamTool/sam-tool-tauri/src/types.ts
2026-05-28 14:00:38 +05:30

114 lines
2.3 KiB
TypeScript

export type Mode = "extract" | "annotate";
export interface VideoInfo {
path: string;
width: number;
height: number;
fps: number;
total_frames: number;
duration_s: number;
default_output_folder: string;
}
export interface CocoCategory {
id: number;
name: string;
}
export interface CocoBboxShape {
type: "bbox";
class_id: number;
class_name: string;
bbox: [number, number, number, number];
}
export interface CocoPolygonShape {
type: "polygon";
class_id: number;
class_name: string;
points: [number, number][];
}
export type CocoShape = CocoBboxShape | CocoPolygonShape;
export interface CocoImportStats {
total_annotations: number;
frame_count: number;
categories: number;
skipped_rle: number;
skipped_no_image: number;
source_format: "coco" | "sam" | string;
}
export interface ImportedCoco {
categories: CocoCategory[];
frames: Record<string, CocoShape[]>;
stats: CocoImportStats;
}
export type AnnotationType = "bbox" | "polygon";
export interface BboxAnnotation {
id: string;
class_id: number;
class_name: string;
type: "bbox";
bbox: [number, number, number, number];
author: string;
created_at: string;
updated_at: string;
}
export interface PolygonAnnotation {
id: string;
class_id: number;
class_name: string;
type: "polygon";
points: [number, number][];
author: string;
created_at: string;
updated_at: string;
}
export type Annotation = BboxAnnotation | PolygonAnnotation;
export interface ImageAnnotations {
version: 1;
image: string;
width: number;
height: number;
source_video?: string | null;
annotations: Annotation[];
}
export interface ImageEntry {
filename: string;
has_annotations: boolean;
annotation_count: number;
last_updated: string | null;
}
export interface Settings {
sam_url: string;
sam_enabled: boolean;
sam_model?: string | null;
cache_capacity: number;
/** ffmpeg `-hwaccel` argument. "" = software. Recognized: auto, vaapi, cuda, vdpau. */
hwaccel: string;
/** Decimation factor for playback advancement + bulk extract. 1 = no decimation. */
frame_skip: number;
}
export interface SamModelInfo {
id: string;
name: string;
family: string;
available: boolean;
checkpoint: string;
}
export interface SamModelList {
default: string | null;
models: SamModelInfo[];
}