fix: mark Detection models as optional (requires OpenCV 4.8+)
This commit is contained in:
@@ -35,8 +35,9 @@ var modelConfigs = map[string]struct {
|
|||||||
"Rotation-RotNetR.onnx": {remote: "[AntiCAP]-Rotation-RotNetR.onnx", optional: false},
|
"Rotation-RotNetR.onnx": {remote: "[AntiCAP]-Rotation-RotNetR.onnx", optional: false},
|
||||||
"Siamese-ResNet18.onnx": {remote: "[AntiCAP]-Siamese-ResNet18.onnx", optional: false},
|
"Siamese-ResNet18.onnx": {remote: "[AntiCAP]-Siamese-ResNet18.onnx", optional: false},
|
||||||
"CharSets.txt": {remote: "[Dddd]-CharSets.txt", optional: false},
|
"CharSets.txt": {remote: "[Dddd]-CharSets.txt", optional: false},
|
||||||
"Detection_Icon.onnx": {remote: "Detection_Icon.onnx", optional: false},
|
// Detection 模型需要 OpenCV 4.8+ 支持,暂标记为可选
|
||||||
"Detection_Text.onnx": {remote: "Detection_Text.onnx", optional: false},
|
"Detection_Icon.onnx": {remote: "Detection_Icon.onnx", optional: true},
|
||||||
|
"Detection_Text.onnx": {remote: "Detection_Text.onnx", optional: true},
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从 Gitea 仓库下载(公开仓库,无需认证)
|
// 从 Gitea 仓库下载(公开仓库,无需认证)
|
||||||
@@ -95,11 +96,11 @@ func (h *Handler) loadModels() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 加载 YOLO 检测模型
|
// 加载 YOLO 检测模型(需要 OpenCV 4.8+)
|
||||||
iconPath := filepath.Join(h.modelPath, "Detection_Icon.onnx")
|
iconPath := filepath.Join(h.modelPath, "Detection_Icon.onnx")
|
||||||
if _, err := os.Stat(iconPath); err == nil {
|
if _, err := os.Stat(iconPath); err == nil {
|
||||||
if err := opencv.LoadYOLO("icon", iconPath, ""); err != nil {
|
if err := opencv.LoadYOLO("icon", iconPath, ""); err != nil {
|
||||||
fmt.Printf("警告: 加载 Icon 检测模型失败: %v\n", err)
|
fmt.Printf("提示: Icon 检测模型加载失败 (需要 OpenCV 4.8+): %v\n", err)
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("Icon 检测模型加载成功")
|
fmt.Println("Icon 检测模型加载成功")
|
||||||
}
|
}
|
||||||
@@ -108,7 +109,7 @@ func (h *Handler) loadModels() {
|
|||||||
textPath := filepath.Join(h.modelPath, "Detection_Text.onnx")
|
textPath := filepath.Join(h.modelPath, "Detection_Text.onnx")
|
||||||
if _, err := os.Stat(textPath); err == nil {
|
if _, err := os.Stat(textPath); err == nil {
|
||||||
if err := opencv.LoadYOLO("text", textPath, ""); err != nil {
|
if err := opencv.LoadYOLO("text", textPath, ""); err != nil {
|
||||||
fmt.Printf("警告: 加载 Text 检测模型失败: %v\n", err)
|
fmt.Printf("提示: Text 检测模型加载失败 (需要 OpenCV 4.8+): %v\n", err)
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("Text 检测模型加载成功")
|
fmt.Println("Text 检测模型加载成功")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user