mirror of
https://github.com/geekwenjie/SmartJavaAI.git
synced 2026-09-12 12:48:57 +00:00
- 新增 语音识别模块,集成 OpenAI 开源的 Whisper 和 Vosk
- 修复 质量评估模型的 Bug - 修复 OCR 模块 recognizeAndDraw 方法的 Bug - 修复 车牌识别在未检测到车牌时的报错问题 - 优化 OCR 表格识别功能,新增导出方式
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<smartjavaai.version>1.0.22</smartjavaai.version>
|
||||
<smartjavaai.version>1.0.23</smartjavaai.version>
|
||||
<!--如果打包运行,需要替换成你的main-->
|
||||
<exec.mainClass>smartai.examples.face.facedet.FaceDetDemo</exec.mainClass>
|
||||
|
||||
@@ -95,16 +95,8 @@
|
||||
<dependency>
|
||||
<groupId>cn.smartjavaai</groupId>
|
||||
<artifactId>smartjavaai-face</artifactId>
|
||||
<version>1.0.22</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.smartjavaai</groupId>
|
||||
<artifactId>smartjavaai-all</artifactId>
|
||||
<version>1.0.22</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>ai.djl.pytorch</groupId>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package smartai.examples.face.attribute;
|
||||
|
||||
import cn.smartjavaai.common.config.Config;
|
||||
import cn.smartjavaai.common.entity.DetectionInfo;
|
||||
import cn.smartjavaai.common.entity.DetectionResponse;
|
||||
import cn.smartjavaai.common.entity.R;
|
||||
@@ -16,6 +17,7 @@ import cn.smartjavaai.face.model.facedect.FaceDetModel;
|
||||
import cn.smartjavaai.face.utils.FaceUtils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
@@ -33,6 +35,12 @@ import java.util.List;
|
||||
@Slf4j
|
||||
public class FaceAttributeDetDemo {
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeAll() throws IOException {
|
||||
//修改缓存路径
|
||||
// Config.setCachePath("/Users/xxx/smartjavaai_cache");
|
||||
}
|
||||
|
||||
|
||||
public FaceAttributeModel getFaceAttributeModel() {
|
||||
FaceAttributeConfig config = new FaceAttributeConfig();
|
||||
|
||||
@@ -2,6 +2,7 @@ package smartai.examples.face.expression;
|
||||
|
||||
import ai.djl.modality.cv.Image;
|
||||
import ai.djl.modality.cv.ImageFactory;
|
||||
import cn.smartjavaai.common.config.Config;
|
||||
import cn.smartjavaai.common.entity.DetectionInfo;
|
||||
import cn.smartjavaai.common.entity.DetectionRectangle;
|
||||
import cn.smartjavaai.common.entity.DetectionResponse;
|
||||
@@ -26,6 +27,7 @@ import cn.smartjavaai.face.model.liveness.LivenessDetModel;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import nu.pattern.OpenCV;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.Size;
|
||||
@@ -54,6 +56,12 @@ public class ExpressionRecDemo {
|
||||
//设备类型
|
||||
public static DeviceEnum device = DeviceEnum.CPU;
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeAll() throws IOException {
|
||||
//修改缓存路径
|
||||
// Config.setCachePath("/Users/xxx/smartjavaai_cache");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取人脸检测模型
|
||||
* @return
|
||||
|
||||
@@ -2,6 +2,7 @@ package smartai.examples.face.facedet;
|
||||
|
||||
import ai.djl.modality.cv.Image;
|
||||
import ai.djl.modality.cv.ImageFactory;
|
||||
import cn.smartjavaai.common.config.Config;
|
||||
import cn.smartjavaai.common.entity.DetectionInfo;
|
||||
import cn.smartjavaai.common.entity.DetectionRectangle;
|
||||
import cn.smartjavaai.common.entity.DetectionResponse;
|
||||
@@ -19,6 +20,7 @@ import cn.smartjavaai.face.model.liveness.LivenessDetModel;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import nu.pattern.OpenCV;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.Size;
|
||||
@@ -32,6 +34,7 @@ import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
/**
|
||||
@@ -47,6 +50,12 @@ public class FaceDetDemo {
|
||||
|
||||
public static String imgPath = "src/main/resources/iu_1.jpg";
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeAll() throws IOException {
|
||||
//修改缓存路径
|
||||
// Config.setCachePath("/Users/xxx/smartjavaai_cache");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取人脸检测模型
|
||||
@@ -55,7 +64,10 @@ public class FaceDetDemo {
|
||||
*/
|
||||
public FaceDetModel getFaceDetModel(){
|
||||
FaceDetConfig config = new FaceDetConfig();
|
||||
//高精度模型,速度慢
|
||||
config.setModelEnum(FaceDetModelEnum.RETINA_FACE);//人脸检测模型
|
||||
//下载模型并替换本地路径,下载地址:https://pan.baidu.com/s/10l22x5fRz_gwLr8EAHa1Jg?pwd=1234 提取码: 1234
|
||||
config.setModelPath("/Users/xxx/Documents/develop/model/retinaface.pt");
|
||||
config.setConfidenceThreshold(FaceDetectConstant.DEFAULT_CONFIDENCE_THRESHOLD);//只返回相似度大于该值的人脸
|
||||
config.setNmsThresh(FaceDetectConstant.NMS_THRESHOLD);//用于去除重复的人脸框,当两个框的重叠度超过该值时,只保留一个
|
||||
return FaceDetModelFactory.getInstance().getModel(config);
|
||||
@@ -70,7 +82,7 @@ public class FaceDetDemo {
|
||||
FaceDetConfig config = new FaceDetConfig();
|
||||
//指定模型
|
||||
config.setModelEnum(FaceDetModelEnum.SEETA_FACE6_MODEL);
|
||||
//指定模型路径:请根据实际情况替换为本地模型文件的绝对路径(模型下载地址请查看文档)
|
||||
//指定模型路径:请根据实际情况替换为本地模型文件的绝对路径(下载地址:https://pan.baidu.com/s/10l22x5fRz_gwLr8EAHa1Jg?pwd=1234 提取码: 1234)
|
||||
config.setModelPath("C:/Users/Administrator/Downloads/sf3.0_models/sf3.0_models");
|
||||
return FaceDetModelFactory.getInstance().getModel(config);
|
||||
}
|
||||
@@ -153,28 +165,6 @@ public class FaceDetDemo {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 人脸检测(离线模型)
|
||||
*/
|
||||
@Test
|
||||
public void testDetectFaceOffine(){
|
||||
try {
|
||||
FaceDetConfig config = new FaceDetConfig();
|
||||
config.setModelEnum(FaceDetModelEnum.RETINA_FACE);//人脸模型
|
||||
//模型路径,不同模型下载路径请参看文档
|
||||
config.setModelPath("/Users/xxx/Documents/develop/face_model/retinaface.pt");
|
||||
FaceDetModel faceModel = FaceDetModelFactory.getInstance().getModel(config);
|
||||
R<DetectionResponse> detectedResult = faceModel.detect(imgPath);
|
||||
if(detectedResult.isSuccess()){
|
||||
log.info("人脸检测结果:{}", JSONObject.toJSONString(detectedResult.getData()));
|
||||
}else{
|
||||
log.info("人脸检测失败:{}", detectedResult.getMessage());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 人脸检测(GPU模式)
|
||||
*/
|
||||
@@ -182,7 +172,10 @@ public class FaceDetDemo {
|
||||
public void testDetectFaceGPU(){
|
||||
try {
|
||||
FaceDetConfig config = new FaceDetConfig();
|
||||
config.setModelEnum(FaceDetModelEnum.RETINA_FACE);//人脸模型
|
||||
//高精度模型,速度慢
|
||||
config.setModelEnum(FaceDetModelEnum.RETINA_FACE);//人脸检测模型
|
||||
//下载模型并替换本地路径,下载地址:https://pan.baidu.com/s/10l22x5fRz_gwLr8EAHa1Jg?pwd=1234 提取码: 1234
|
||||
config.setModelPath("/Users/xxx/Documents/develop/model/retinaface.pt");
|
||||
config.setDevice(DeviceEnum.GPU);
|
||||
FaceDetModel faceModel = FaceDetModelFactory.getInstance().getModel(config);
|
||||
R<DetectionResponse> detectedResult = faceModel.detect(imgPath);
|
||||
@@ -223,7 +216,7 @@ public class FaceDetDemo {
|
||||
@Test
|
||||
public void testDetectCamera(){
|
||||
try {
|
||||
FaceDetModel faceModel = getFaceDetModel();
|
||||
FaceDetModel faceModel = getSeetaface6DetModel();
|
||||
OpenCV.loadShared();
|
||||
VideoCapture capture = new VideoCapture(0);
|
||||
if (!capture.isOpened()) {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package smartai.examples.face.facerec;
|
||||
|
||||
import cn.smartjavaai.common.config.Config;
|
||||
import cn.smartjavaai.common.entity.DetectionResponse;
|
||||
import cn.smartjavaai.common.entity.R;
|
||||
import cn.smartjavaai.common.entity.face.FaceSearchResult;
|
||||
@@ -24,8 +25,10 @@ import cn.smartjavaai.face.vector.entity.FaceVector;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -42,14 +45,25 @@ public class FaceRecDemo {
|
||||
//设备类型
|
||||
public static DeviceEnum device = DeviceEnum.CPU;
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeAll() throws IOException {
|
||||
//修改缓存路径
|
||||
// Config.setCachePath("/Users/xxx/smartjavaai_cache");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取人脸检测模型
|
||||
* 获取人脸检测模型(高精度,速度慢)
|
||||
* 追求准确度可以使用
|
||||
* 也可以使用其他模型,具体其他模型参数可以查看文档:http://doc.smartjavaai.cn/face.html
|
||||
* @return
|
||||
*/
|
||||
public FaceDetModel getFaceDetModel(){
|
||||
public FaceDetModel getHighAccuracyDetModel(){
|
||||
FaceDetConfig config = new FaceDetConfig();
|
||||
//高精度模型,速度慢
|
||||
config.setModelEnum(FaceDetModelEnum.RETINA_FACE);//人脸检测模型
|
||||
//下载模型并替换本地路径,下载地址:https://pan.baidu.com/s/10l22x5fRz_gwLr8EAHa1Jg?pwd=1234 提取码: 1234
|
||||
config.setModelPath("/Users/xxx/Documents/develop/model/retinaface.pt");
|
||||
config.setConfidenceThreshold(FaceDetectConstant.DEFAULT_CONFIDENCE_THRESHOLD);//只返回相似度大于该值的人脸
|
||||
config.setNmsThresh(FaceDetectConstant.NMS_THRESHOLD);//用于去除重复的人脸框,当两个框的重叠度超过该值时,只保留一个
|
||||
config.setDevice(device);
|
||||
@@ -57,21 +71,62 @@ public class FaceRecDemo {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取人脸识别模型
|
||||
* 获取人脸检测模型(高速模型,精度一般)
|
||||
* 追求速度可以使用
|
||||
* 也可以使用其他模型,具体其他模型参数可以查看文档:http://doc.smartjavaai.cn/face.html
|
||||
* @return
|
||||
*/
|
||||
public FaceRecModel getFaceRecModel(){
|
||||
public FaceDetModel getHighSpeedDetModel(){
|
||||
FaceDetConfig config = new FaceDetConfig();
|
||||
//高速模型,速度快,精度一般
|
||||
config.setModelEnum(FaceDetModelEnum.SEETA_FACE6_MODEL);
|
||||
//下载模型并替换本地路径,下载地址:https://pan.baidu.com/s/10l22x5fRz_gwLr8EAHa1Jg?pwd=1234 提取码: 1234
|
||||
config.setModelPath("/Users/xxx/Documents/develop/model/sf3.0_models");
|
||||
config.setDevice(device);
|
||||
return FaceDetModelFactory.getInstance().getModel(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取人脸识别模型(高精度,速度慢)
|
||||
* 追求准确度可以使用
|
||||
* 也可以使用其他模型,具体其他模型参数可以查看文档:http://doc.smartjavaai.cn/face.html
|
||||
* @return
|
||||
*/
|
||||
public FaceRecModel getHighAccuracyFaceRecModel(){
|
||||
FaceRecConfig config = new FaceRecConfig();
|
||||
config.setModelEnum(FaceRecModelEnum.FACENET_MODEL);
|
||||
// config.setModelPath("/Users/xxx/Documents/develop/model/elasticface.pt");
|
||||
// config.setModelPath("/Users/xxx/Documents/develop/model/InsightFace/model_mobilefacenet.pt");
|
||||
//高精度模型,速度慢
|
||||
config.setModelEnum(FaceRecModelEnum.ELASTIC_FACE_MODEL);
|
||||
//模型路径,请下载模型并替换为本地路径:https://pan.baidu.com/s/10l22x5fRz_gwLr8EAHa1Jg?pwd=1234 提取码: 1234
|
||||
config.setModelPath("/Users/xxx/Documents/develop/model/elasticface.pt");
|
||||
//裁剪人脸:如果图片已经是裁剪过的,则请将此参数设置为false
|
||||
config.setCropFace(true);
|
||||
//开启人脸对齐:适用于人脸不正的场景,开启将提升人脸特征准确度,关闭可以提升性能
|
||||
config.setAlign(true);
|
||||
config.setDevice(device);
|
||||
//指定人脸检测模型
|
||||
config.setDetectModel(getFaceDetModel());
|
||||
config.setDetectModel(getHighAccuracyDetModel());
|
||||
return FaceRecModelFactory.getInstance().getModel(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取人脸识别模型(高速模型,精度一般)
|
||||
* 追求速度可以使用
|
||||
* 也可以使用其他模型,具体其他模型参数可以查看文档:http://doc.smartjavaai.cn/face.html
|
||||
* @return
|
||||
*/
|
||||
public FaceRecModel getHighSpeedFaceRecModel(){
|
||||
FaceRecConfig config = new FaceRecConfig();
|
||||
//高精度模型,速度慢
|
||||
config.setModelEnum(FaceRecModelEnum.SEETA_FACE6_MODEL);
|
||||
//模型路径,请下载模型并替换为本地路径:https://pan.baidu.com/s/10l22x5fRz_gwLr8EAHa1Jg?pwd=1234 提取码: 1234
|
||||
config.setModelPath("/Users/xxx/Documents/develop/model/sf3.0_models");
|
||||
//裁剪人脸:如果图片已经是裁剪过的,则请将此参数设置为false
|
||||
config.setCropFace(true);
|
||||
//开启人脸对齐:适用于人脸不正的场景,开启将提升人脸特征准确度,关闭可以提升性能
|
||||
config.setAlign(false);
|
||||
config.setDevice(device);
|
||||
//指定人脸检测模型
|
||||
config.setDetectModel(getHighSpeedDetModel());
|
||||
return FaceRecModelFactory.getInstance().getModel(config);
|
||||
}
|
||||
|
||||
@@ -81,14 +136,15 @@ public class FaceRecDemo {
|
||||
*/
|
||||
public FaceRecModel getFaceRecModelWithDbConfig(){
|
||||
FaceRecConfig config = new FaceRecConfig();
|
||||
//高精度模型,速度慢,追求速度请更换高速模型,具体其他模型参数可以查看文档:http://doc.smartjavaai.cn/face.html
|
||||
config.setModelEnum(FaceRecModelEnum.ELASTIC_FACE_MODEL);//人脸检测模型
|
||||
config.setModelPath("/Users/xxx/Documents/develop/model/elasticface.pt");
|
||||
//裁剪人脸:如果图片已经是裁剪过的,则请将此参数设置为false
|
||||
config.setCropFace(true);
|
||||
//开启人脸对齐:适用于人脸不正的场景,开启将提升人脸特征准确度,关闭可以提升性能
|
||||
config.setAlign(true);
|
||||
//指定人脸检测模型
|
||||
config.setDetectModel(getFaceDetModel());
|
||||
//指定人脸检测模型,高精度模型,速度慢,追求速度请更换高速模型getHighSpeedDetModel
|
||||
config.setDetectModel(getHighAccuracyDetModel());
|
||||
config.setDevice(device);
|
||||
|
||||
//初始化向量数据库:Milvus数据库配置
|
||||
@@ -112,13 +168,15 @@ public class FaceRecDemo {
|
||||
*/
|
||||
public FaceRecModel getFaceRecModelWithSQLiteConfig(){
|
||||
FaceRecConfig config = new FaceRecConfig();
|
||||
config.setModelEnum(FaceRecModelEnum.FACENET_MODEL);//人脸检测模型
|
||||
//高精度模型,速度慢, 追求速度请更换高速模型,具体其他模型参数可以查看文档:http://doc.smartjavaai.cn/face.html
|
||||
config.setModelEnum(FaceRecModelEnum.ELASTIC_FACE_MODEL);//人脸检测模型
|
||||
config.setModelPath("/Users/xxx/Documents/develop/model/elasticface.pt");
|
||||
//裁剪人脸:如果图片已经是裁剪过的,则请将此参数设置为false
|
||||
config.setCropFace(true);
|
||||
//开启人脸对齐:适用于人脸不正的场景,开启将提升人脸特征准确度,关闭可以提升性能
|
||||
config.setAlign(true);
|
||||
//指定人脸检测模型
|
||||
config.setDetectModel(getFaceDetModel());
|
||||
//指定人脸检测模型,高精度模型,速度慢,追求速度请更换高速模型getHighSpeedDetModel
|
||||
config.setDetectModel(getHighAccuracyDetModel());
|
||||
config.setDevice(device);
|
||||
|
||||
//初始化SQLite数据库
|
||||
@@ -138,7 +196,8 @@ public class FaceRecDemo {
|
||||
@Test
|
||||
public void testExtractFeatures(){
|
||||
try {
|
||||
FaceRecModel faceRecModel = getFaceRecModel();
|
||||
//高精度模型,速度慢, 追求速度请更换高速模型: getHighSpeedFaceRecModel
|
||||
FaceRecModel faceRecModel = getHighAccuracyFaceRecModel();
|
||||
//提取图片中所有人脸特征
|
||||
R<DetectionResponse> faceResult = faceRecModel.extractFeatures("src/main/resources/iu_1.jpg");
|
||||
if(faceResult.isSuccess()){
|
||||
@@ -162,7 +221,8 @@ public class FaceRecDemo {
|
||||
@Test
|
||||
public void featureComparison(){
|
||||
try {
|
||||
FaceRecModel faceRecModel = getFaceRecModel();
|
||||
//高精度模型,速度慢, 追求速度请更换高速模型: getHighSpeedFaceRecModel
|
||||
FaceRecModel faceRecModel = getHighAccuracyFaceRecModel();
|
||||
//基于图像直接比对人脸特征
|
||||
R<Float> similarResult = faceRecModel.featureComparison("src/main/resources/iu_1.jpg","src/main/resources/iu_2.jpg");
|
||||
if(similarResult.isSuccess()){
|
||||
@@ -188,7 +248,8 @@ public class FaceRecDemo {
|
||||
@Test
|
||||
public void featureComparison2(){
|
||||
try {
|
||||
FaceRecModel faceRecModel = getFaceRecModel();
|
||||
//高精度模型,速度慢, 追求速度请更换高速模型: getHighSpeedFaceRecModel
|
||||
FaceRecModel faceRecModel = getHighAccuracyFaceRecModel();
|
||||
//特征提取(提取分数最高人脸特征),适用于单人脸场景
|
||||
R<float[]> featureResult1 = faceRecModel.extractTopFaceFeature("src/main/resources/iu_1.jpg");
|
||||
if(featureResult1.isSuccess()){
|
||||
@@ -226,6 +287,7 @@ public class FaceRecDemo {
|
||||
@Test
|
||||
public void searchFace(){
|
||||
try {
|
||||
//高精度模型,速度慢, 追求速度请更换高速模型
|
||||
FaceRecModel faceRecModel = getFaceRecModelWithDbConfig();
|
||||
//等待加载人脸库结束
|
||||
while (!faceRecModel.isLoadFaceCompleted()){
|
||||
@@ -303,6 +365,7 @@ public class FaceRecDemo {
|
||||
@Test
|
||||
public void searchFace2(){
|
||||
try {
|
||||
//高精度模型,速度慢, 追求速度请更换高速模型
|
||||
FaceRecModel faceRecModel = getFaceRecModelWithSQLiteConfig();
|
||||
//等待加载人脸库结束
|
||||
while (!faceRecModel.isLoadFaceCompleted()){
|
||||
@@ -419,4 +482,7 @@ public class FaceRecDemo {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package smartai.examples.face.liveness;
|
||||
import ai.djl.modality.cv.Image;
|
||||
import ai.djl.modality.cv.ImageFactory;
|
||||
import cn.hutool.core.lang.UUID;
|
||||
import cn.smartjavaai.common.config.Config;
|
||||
import cn.smartjavaai.common.entity.DetectionInfo;
|
||||
import cn.smartjavaai.common.entity.DetectionRectangle;
|
||||
import cn.smartjavaai.common.entity.DetectionResponse;
|
||||
@@ -32,6 +33,7 @@ import nu.pattern.OpenCV;
|
||||
import org.bytedeco.javacv.FFmpegFrameGrabber;
|
||||
import org.bytedeco.javacv.Frame;
|
||||
import org.bytedeco.javacv.Java2DFrameUtils;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.opencv.core.Mat;
|
||||
import org.opencv.core.Size;
|
||||
@@ -61,6 +63,12 @@ public class LivenessDetDemo {
|
||||
//设备类型
|
||||
public static DeviceEnum device = DeviceEnum.CPU;
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeAll() throws IOException {
|
||||
//修改缓存路径
|
||||
// Config.setCachePath("/Users/xxx/smartjavaai_cache");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package smartai.examples.face.quality;
|
||||
|
||||
import cn.smartjavaai.common.config.Config;
|
||||
import cn.smartjavaai.common.entity.DetectionInfo;
|
||||
import cn.smartjavaai.common.entity.DetectionResponse;
|
||||
import cn.smartjavaai.common.entity.R;
|
||||
@@ -23,11 +24,13 @@ import cn.smartjavaai.face.model.quality.FaceQualityModel;
|
||||
import cn.smartjavaai.face.utils.FaceUtils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
/**
|
||||
@@ -41,6 +44,12 @@ public class FaceQualityDetDemo {
|
||||
//设备类型
|
||||
public static DeviceEnum device = DeviceEnum.CPU;
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeAll() throws IOException {
|
||||
//修改缓存路径
|
||||
// Config.setCachePath("/Users/xxx/smartjavaai_cache");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user