zouyu
2025-11-27 eed98e551c817ead7965e08820d4b7adbc4a47f0
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
package com.xindao.ocr.smartjavaai.enums;
 
/**
 * 车牌识别模型枚举
 * @author dwj
 */
public enum PlateRecModelEnum {
 
    PLATE_REC_CRNN;
 
 
    /**
     * 根据名称获取枚举 (忽略大小写和下划线变体)
     */
    public static PlateRecModelEnum fromName(String name) {
        String formatted = name.trim().toUpperCase().replaceAll("[-_]", "");
        for (PlateRecModelEnum model : values()) {
            if (model.name().replaceAll("_", "").equals(formatted)) {
                return model;
            }
        }
        throw new IllegalArgumentException("未知模型名称: " + name);
    }
 
 
}