mirror of
https://github.com/geekwenjie/SmartJavaAI.git
synced 2026-09-15 22:57:26 +00:00
1、新增图片与视频活体检测
2、新增人脸属性识别(性别、年龄、口罩、姿态、眼睛状态) 3、优化检测返回与包结构 4、新增 dependencyManagement 统一依赖版本管理
This commit is contained in:
@@ -4,6 +4,7 @@ import ai.djl.modality.cv.Image;
|
||||
import ai.djl.modality.cv.ImageFactory;
|
||||
import ai.djl.modality.cv.output.DetectedObjects;
|
||||
import ai.djl.ndarray.NDArray;
|
||||
import cn.smartjavaai.common.entity.DetectionInfo;
|
||||
import cn.smartjavaai.common.entity.DetectionRectangle;
|
||||
import cn.smartjavaai.common.entity.DetectionResponse;
|
||||
import cn.smartjavaai.common.utils.OpenCVUtils;
|
||||
@@ -207,7 +208,8 @@ public class ImageUtils {
|
||||
*/
|
||||
public static void drawRect(Mat mat, DetectionResponse detectionResponse) {
|
||||
|
||||
for(DetectionRectangle detectionRectangle : detectionResponse.getRectangleList()){
|
||||
for(DetectionInfo detectionInfo : detectionResponse.getDetectionInfoList()){
|
||||
DetectionRectangle detectionRectangle = detectionInfo.getDetectionRectangle();
|
||||
// 左上角点
|
||||
Point topLeft = new Point(detectionRectangle.getX(), detectionRectangle.getY());
|
||||
// 右下角点
|
||||
|
||||
@@ -5,6 +5,7 @@ import ai.djl.modality.cv.output.BoundingBox;
|
||||
import ai.djl.modality.cv.output.DetectedObjects;
|
||||
import ai.djl.ndarray.NDArray;
|
||||
import ai.djl.ndarray.NDList;
|
||||
import cn.smartjavaai.common.entity.DetectionInfo;
|
||||
import cn.smartjavaai.common.entity.DetectionRectangle;
|
||||
import cn.smartjavaai.common.entity.DetectionResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -34,7 +35,7 @@ public class OcrUtils {
|
||||
return null;
|
||||
}
|
||||
DetectionResponse detectionResponse = new DetectionResponse();
|
||||
List<DetectionRectangle> rectangleList = new ArrayList<DetectionRectangle>();
|
||||
List<DetectionInfo> detectionInfoList = new ArrayList<DetectionInfo>();
|
||||
for(NDArray box : dt_boxes){
|
||||
DetectionRectangle rectangle = new DetectionRectangle();
|
||||
float[] points = box.toFloatArray();
|
||||
@@ -54,9 +55,9 @@ public class OcrUtils {
|
||||
rectangle.setY(y);
|
||||
rectangle.setHeight(height);
|
||||
rectangle.setWidth(width);
|
||||
rectangleList.add(rectangle);
|
||||
detectionInfoList.add(new DetectionInfo(rectangle));
|
||||
}
|
||||
detectionResponse.setRectangleList(rectangleList);
|
||||
detectionResponse.setDetectionInfoList(detectionInfoList);
|
||||
return detectionResponse;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user