将检测任务迁移python

This commit is contained in:
2025-09-30 14:23:33 +08:00
parent 3fe5f8083d
commit 39d39a7a24
69 changed files with 7921 additions and 1836 deletions

View File

@@ -0,0 +1,40 @@
from pydantic import BaseModel
from typing import List, Optional
class Detection(BaseModel):
"""Object detection result"""
label: str
confidence: float
x: int
y: int
width: int
height: int
color: int = 0x00FF00 # Default green color
class DetectionRequest(BaseModel):
"""Request for model inference on image data"""
model_name: str
image_data: str # Base64 encoded image
class DetectionResponse(BaseModel):
"""Response with detection results"""
model_name: str
detections: List[Detection]
inference_time: float # Time in milliseconds
class ModelInfo(BaseModel):
"""Model information"""
name: str
path: str
size: List[int] # [width, height]
backend: str = "ONNX"
loaded: bool = False
class ModelsResponse(BaseModel):
"""Response with available models"""
models: List[ModelInfo]