feat: seg any thing 新增box模式
All checks were successful
git commit AiDA python develop 分支构建部署 / scheduled_deploy (push) Has been skipped

This commit is contained in:
zcr
2026-01-13 12:32:18 +08:00
parent 0ac5a4e0a8
commit f7294f5966
2 changed files with 20 additions and 5 deletions

View File

@@ -395,6 +395,8 @@ async def seg_anything(request_data: SAMRequestModel):
### 参数说明: ### 参数说明:
- **image_path**: 图片在服务器或云端的相对路径。 - **image_path**: 图片在服务器或云端的相对路径。
- **type**: 推理类型
- **box**: 框选矩形点位信息
- **points**: 交互点的坐标列表。每个点为 [x, y] 像素格式。 - **points**: 交互点的坐标列表。每个点为 [x, y] 像素格式。
- **labels**: 坐标点的属性标签,必须与 points 长度一致: - **labels**: 坐标点的属性标签,必须与 points 长度一致:
- 1: **前景点** (代表想要分割出的区域) - 1: **前景点** (代表想要分割出的区域)
@@ -402,10 +404,19 @@ async def seg_anything(request_data: SAMRequestModel):
### 请求体示例: ### 请求体示例:
```json ```json
point
{ {
"image_path": "aida-users/89/sketch/4e8fe37d-7068-400a-ac94-c01647fa5f6f.png", "image_path": "aida-users/89/sketch/4e8fe37d-7068-400a-ac94-c01647fa5f6f.png",
"type":"point",
"points": [[310, 403], [493, 375], [261, 266], [404, 484]], "points": [[310, 403], [493, 375], [261, 266], [404, 484]],
"labels": [1, 1, 0, 1] "labels": [1, 1, 0, 1],
}
box
{
"image_path": "aida-users/89/sketch/4e8fe37d-7068-400a-ac94-c01647fa5f6f.png",
"type":"box",
"box": [350, 286, 544, 520],
} }
``` ```
""" """

View File

@@ -1,10 +1,14 @@
from pydantic import BaseModel from typing import List, Optional
from pydantic import BaseModel, Field
class SAMRequestModel(BaseModel): class SAMRequestModel(BaseModel):
image_path: str image_path: str = Field(..., description="图片路径,必填字段")
points: list[list[float]] type: str = Field(..., description="推理类型,必填字段")
labels: list[int] points: Optional[List[List[float]]] = None
labels: Optional[List[int]] = None
box: Optional[List[int]] = None
class DesignModel(BaseModel): class DesignModel(BaseModel):