Initial commit: Video detection platform with YOLO models
Features: - Fire detection (YOLOv10) - Helmet detection (YOLOv8) - Crowd detection (YOLOv8) - Smoking detection (YOLOv8) - Loitering detection (YOLOv8) Tech Stack: - Frontend: Vue 3 + Vite + Element Plus - Backend: FastAPI + WebSocket - Monorepo: pnpm workspace + Turbo - Docker support included
This commit is contained in:
15
packages/shared-types/package.json
Normal file
15
packages/shared-types/package.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "@jc-video/shared-types",
|
||||
"version": "1.0.0",
|
||||
"description": "前后端共享类型定义",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"dev": "tsc --watch",
|
||||
"clean": "rm -rf dist node_modules"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.3.0"
|
||||
}
|
||||
}
|
||||
58
packages/shared-types/src/index.ts
Normal file
58
packages/shared-types/src/index.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
// 检测相关类型
|
||||
|
||||
export interface Detection {
|
||||
class: string;
|
||||
label: string;
|
||||
confidence: number;
|
||||
bbox: [number, number, number, number];
|
||||
}
|
||||
|
||||
export interface DetectionStats {
|
||||
total_detections: number;
|
||||
avg_confidence: number;
|
||||
processing_time: number;
|
||||
model_used: string;
|
||||
fps?: number;
|
||||
}
|
||||
|
||||
export interface ModelInfo {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
classes: string[];
|
||||
labels: Record<string, string>;
|
||||
size: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface DetectionResult {
|
||||
success: boolean;
|
||||
message: string;
|
||||
data: {
|
||||
detections: Detection[];
|
||||
image_url?: string;
|
||||
stats: DetectionStats;
|
||||
};
|
||||
}
|
||||
|
||||
export interface DetectionConfig {
|
||||
model_id: string;
|
||||
confidence: number;
|
||||
iou: number;
|
||||
}
|
||||
|
||||
// WebSocket 消息类型
|
||||
export interface WebSocketMessage {
|
||||
type: 'original_frame' | 'annotated_frame' | 'detection' | 'error' | 'camera_started' | 'camera_stopped' | 'config_updated';
|
||||
frame?: string;
|
||||
detections?: Detection[];
|
||||
stats?: DetectionStats;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface CameraConfig {
|
||||
model_id: string;
|
||||
confidence: number;
|
||||
iou: number;
|
||||
camera_source?: number | string;
|
||||
}
|
||||
16
packages/shared-types/tsconfig.json
Normal file
16
packages/shared-types/tsconfig.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "node",
|
||||
"declaration": true,
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
Reference in New Issue
Block a user