jim800121chen
4583406efa
feat(api): 推論期切換解析方式與上傳 label 檔
新增 POST /api/devices/:id/inference/options,讓已燒錄的模型不重燒
即可切換 detection/classification 與更換 label。
KL520 一次只能載一個模型(換模型必須重燒),但解析方式與 label 都
只是後處理與顯示層,不碰 NPU,因此可即時生效。
- JSON: {taskType?, labels?};multipart: taskType + labelFile
- 欄位用指標型別以區分「省略 = 不動」與「labels:[] = 清空」
- label 解析器(internal/labelfile):格式 <index> <名稱>
略過空行與 # 註解、trim CRLF、名稱含空白只 split 第一個空白、
index 非整數/負數/重複則整檔拒絕並回報行號、稀疏 index 補空字串
- index 上限 4095、檔案上限 256KB,防記憶體耗盡
- 非法 taskType 一律拒絕(含舊別名 detection),因為 bridge 對無法
辨識的值是靜默 fallback,忽略會回 200 但用錯解析方式
- 走窄能力介面 InferenceOptionsDriver,不動 DeviceDriver 簽章
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 19:27:16 +08:00
..
2026-07-22 19:27:16 +08:00
2026-04-15 17:57:54 +08:00
2026-04-15 17:57:54 +08:00
2026-04-15 17:57:54 +08:00
2026-07-22 19:27:02 +08:00
2026-07-22 19:27:16 +08:00
2026-05-25 15:07:29 +08:00
2026-07-22 19:27:02 +08:00
2026-04-11 22:10:38 +08:00
2026-07-22 19:27:16 +08:00
2026-04-11 22:10:38 +08:00