1、FaceNet 特征提取新增人脸对齐

2、人脸检测新5点人脸关键点定位
3、特征提取接口支持多人脸和最佳人脸提取
4、修复人脸框边界精度问题
5、更新 Maven 发布的 groupId
This commit is contained in:
dengwenjie
2025-04-28 16:13:34 +08:00
parent 2fdc20f610
commit 42d2943a94
50 changed files with 3413 additions and 554 deletions

View File

@@ -0,0 +1,50 @@
package cn.smartjavaai.ocr.entity;
import ai.djl.modality.cv.Image;
import ai.djl.ndarray.NDArray;
/**
* 图像信息
*/
public class ImageInfo {
private String name;
private Double prob;
private Image image;
private NDArray box;
public ImageInfo(Image image, NDArray box) {
this.image = image;
this.box = box;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Double getProb() {
return prob;
}
public void setProb(Double prob) {
this.prob = prob;
}
public Image getImage() {
return image;
}
public void setImage(Image image) {
this.image = image;
}
public NDArray getBox() {
return box;
}
public void setBox(NDArray box) {
this.box = box;
}
}

View File

@@ -0,0 +1,46 @@
package cn.smartjavaai.ocr.entity;
import ai.djl.ndarray.NDArray;
/**
* 旋转检测框
*/
public class RotatedBox implements Comparable<RotatedBox> {
private NDArray box;
private String text;
public RotatedBox(NDArray box, String text) {
this.box = box;
this.text = text;
}
/**
* 将左上角 Y 坐标升序排序
*
* @param o
* @return
*/
@Override
public int compareTo(RotatedBox o) {
NDArray lowBox = this.getBox();
NDArray highBox = o.getBox();
float lowY = lowBox.toFloatArray()[1];
float highY = highBox.toFloatArray()[1];
return (lowY < highY) ? -1 : 1;
}
public NDArray getBox() {
return box;
}
public void setBox(NDArray box) {
this.box = box;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}

View File

@@ -0,0 +1,46 @@
package cn.smartjavaai.ocr.entity;
import ai.djl.ndarray.NDArray;
/**
* 旋转检测框 - 支持左上角 X 坐标升序排序
*/
public class RotatedBoxCompX implements Comparable<RotatedBoxCompX> {
private NDArray box;
private String text;
public RotatedBoxCompX(NDArray box, String text) {
this.box = box;
this.text = text;
}
/**
* 将左上角 X 坐标升序排序
*
* @param o
* @return
*/
@Override
public int compareTo(RotatedBoxCompX o) {
NDArray leftBox = this.getBox();
NDArray rightBox = o.getBox();
float leftX = leftBox.toFloatArray()[0];
float rightX = rightBox.toFloatArray()[0];
return (leftX < rightX) ? -1 : 1;
}
public NDArray getBox() {
return box;
}
public void setBox(NDArray box) {
this.box = box;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}