4 Commits

Author SHA1 Message Date
litianxiang
fb46a9521d Merge remote-tracking branch 'origin/develop' into dev-ltx
All checks were successful
git commit AiDA python develop 分支构建部署 / scheduled_deploy (push) Has been skipped
2026-01-13 13:57:28 +08:00
litianxiang
b90688f835 更改增量更新日志级别 2026-01-13 13:57:15 +08:00
zcr
7e30779aec feat: seg any thing 新增box模式
All checks were successful
git commit AiDA python develop 分支构建部署 / scheduled_deploy (push) Has been skipped
2026-01-13 12:43:30 +08:00
zcr
f7294f5966 feat: seg any thing 新增box模式
All checks were successful
git commit AiDA python develop 分支构建部署 / scheduled_deploy (push) Has been skipped
2026-01-13 12:32:18 +08:00
4 changed files with 30 additions and 4 deletions

View File

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

View File

@@ -141,6 +141,9 @@ router = APIRouter()
async def startup_event():
"""启动时初始化增量监听任务"""
try:
# 屏蔽 apscheduler 的 INFO 日志
logging.getLogger("apscheduler").setLevel(logging.WARNING)
# 确保 Milvus 集合已创建(若已存在则直接返回)
try:
create_collection()

View File

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

View File

@@ -308,6 +308,10 @@ class IncrementalListener:
def start_background_listener(scheduler: BackgroundScheduler):
"""将增量监听任务注册到后台调度器"""
# 降低 apscheduler 的日志级别,避免大量刷屏
logging.getLogger('apscheduler.executors.default').setLevel(logging.WARNING)
logging.getLogger('apscheduler.scheduler').setLevel(logging.WARNING)
listener = IncrementalListener()
scheduler.add_job(
listener.process_once,