From 7b72ac13a83764a662159d4a49b7fffb90476ecb Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期四, 12 六月 2025 14:45:12 +0800
Subject: [PATCH] gx
---
dist/index.js | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/dist/index.js b/dist/index.js
index fcbc4a2..b72be60 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -414839,14 +414839,20 @@
// 调整图像大小
const resizedImage = faceapi.resizeResults(img, { width: 600, height: 600 });
// 设置检测选项
- const options = new faceapi.SsdMobilenetv1Options({ minConfidence: 0.3 });
+ const options = new faceapi.SsdMobilenetv1Options({ minConfidence: 0.6 });
counter = (i / images.length) * 100;
console.log(`Progress = ${counter}%`);
// Read each face and save the face descriptions in the descriptions array
const detections = await faceapi.detectSingleFace(resizedImage,options).withFaceLandmarks().withFaceDescriptor();
- if(detections?.descriptor){
+ console.log('kankan ================')
+ console.log('kankan ================')
+ console.log('kankan ================')
+ console.log(detections===undefined)
+ if(detections&&detections.descriptor){
descriptions.push(detections.descriptor);
imgs.push(images[i])
+ }else{
+ return '录入失败';
}
}
@@ -414861,6 +414867,9 @@
descriptions: descriptions,
images:imgs
});
+ console.log(label)
+ console.log(descriptions)
+ console.log(imgs)
try{
await createFace.save();
console.log('人脸录入成功!')
@@ -414914,14 +414923,15 @@
}
// 加载面匹配器以查找匹配面
- const faceMatcher = new faceapi.FaceMatcher(faces, 0.5);
+ const faceMatcher = new faceapi.FaceMatcher(faces, 0.48);
// 使用画布或其他方法读取图像
const img = await canvas.loadImage(image);
// // 调整图像大小
// const resizedImage = faceapi.resizeResults(img, { width: 600, height: 600 });
- // // 设置检测选项
- const options = new faceapi.SsdMobilenetv1Options({ minConfidence: 0.3 });
+ // // 设置检测选项 味着只有当人脸检测的置信度大于或等于0.3时,该检测结果才会被接受。换句话说,如果模型认为检测到的对象是人脸的确定性低于30%,
+ //则不会将这个检测结果包含在最终输出中。这有助于减少误报(即错误地将非人脸区域识别为人脸的情况)。
+ const options = new faceapi.SsdMobilenetv1Options({ minConfidence: 0.4 });
let temp = faceapi.createCanvasFromMedia(img);
// 处理模型的图像
@@ -415051,10 +415061,10 @@
}
)
.then(() => {
- app.listen(process.env.PORT || 80,'0.0.0.0');
+ app.listen(process.env.PORT || 8188,'0.0.0.0');
console.log("DB connected and server us running.");
- console.log('http-sse-'+80)
- logger.info('数据库连接成功,服务已启动,端口号80')
+ console.log('http-sse-'+8188+process.env.PORT)
+ logger.info('数据库连接成功,服务已启动,端口号8188')
})
.catch((err) => {
console.log(err);
--
Gitblit v1.8.0