first version
This commit is contained in:
109
sam-tool-tauri/src/types.ts
Normal file
109
sam-tool-tauri/src/types.ts
Normal file
@@ -0,0 +1,109 @@
|
||||
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;
|
||||
}
|
||||
|
||||
export interface SamModelInfo {
|
||||
id: string;
|
||||
name: string;
|
||||
family: string;
|
||||
available: boolean;
|
||||
checkpoint: string;
|
||||
}
|
||||
|
||||
export interface SamModelList {
|
||||
default: string | null;
|
||||
models: SamModelInfo[];
|
||||
}
|
||||
Reference in New Issue
Block a user