zouyu
2025-09-26 3fbbfcc8f509c352c58dc8a126220b49b72ed5a0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.xindao.ocr.smartjavaai.enums;
 
/**
 * 车牌检测模型枚举
 * @author dwj
 */
public enum PlateDetModelEnum {
 
    YOLOV5,
 
    YOLOV7;
 
 
    /**
     * 根据名称获取枚举 (忽略大小写和下划线变体)
     */
    public static PlateDetModelEnum fromName(String name) {
        String formatted = name.trim().toUpperCase().replaceAll("[-_]", "");
        for (PlateDetModelEnum model : values()) {
            if (model.name().replaceAll("_", "").equals(formatted)) {
                return model;
            }
        }
        throw new IllegalArgumentException("未知模型名称: " + name);
    }
 
 
}