update: docker部署时,添加了模型的默认base路径参数:VISUAL_MODEL_BASE_MODEL_PATH

This commit is contained in:
divenswu 2023-07-13 18:38:51 +08:00
parent 53db05171c
commit a4ad691bf6
4 changed files with 18 additions and 11 deletions

View File

@ -4,6 +4,7 @@ import com.visual.face.search.core.base.*;
import com.visual.face.search.core.extract.FaceFeatureExtractor;
import com.visual.face.search.core.extract.FaceFeatureExtractorImpl;
import com.visual.face.search.core.models.*;
import com.visual.face.search.server.utils.StringUtils;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
@ -12,8 +13,8 @@ import org.springframework.context.annotation.Configuration;
@Configuration("visualModelConfig")
public class ModelConfig {
@Value("${spring.profiles.active}")
private String profile;
@Value("${visual.model.baseModelPath}")
private String baseModelPath;
@Value("${visual.model.faceDetection.name}")
private String faceDetectionName;
@ -176,10 +177,9 @@ public class ModelConfig {
* @return
*/
private String[] getModelPath(String modelName, String modelPath[]){
String basePath = "face-search-core/src/main/resources/";
if("docker".equalsIgnoreCase(profile)){
basePath = "/app/face-search/";
if(StringUtils.isNotEmpty(this.baseModelPath)){
basePath = this.baseModelPath.endsWith("/") ? this.baseModelPath : this.baseModelPath +"/";
}
if((null == modelPath || modelPath.length != 3) && "PcnNetworkFaceDetection".equalsIgnoreCase(modelName)){
@ -210,6 +210,10 @@ public class ModelConfig {
return new String[]{basePath + "model/onnx/attribute_gender_age/insight_gender_age.onnx"};
}
if((null == modelPath || modelPath.length != 1) && "SeetaMaskFaceKeyPoint".equalsIgnoreCase(modelName)){
return new String[]{basePath + "model/onnx/keypoint_seeta_mask/landmarker_005_mask_pts5.onnx"};
}
return modelPath;
}
}

View File

@ -22,6 +22,7 @@ logging:
# 模型配置
visual:
model:
baseModelPath: 'face-search-core/src/main/resources/'
faceDetection:
name: InsightScrfdFaceDetection
modelPath:
@ -83,8 +84,8 @@ spring:
# 主库数据源
master:
url: jdbc:mysql://visual-face-search-mysql:3306/visual_face_search?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: visual
password: visual
username: root
password: root
slave:
# 从数据源开关/默认关闭
enabled: false

View File

@ -22,6 +22,7 @@ logging:
# 模型配置
visual:
model:
baseModelPath: ${VISUAL_MODEL_BASE_MODEL_PATH:'/app/face-search/'}
faceDetection:
name: ${VISUAL_MODEL_FACEDETECTION_NAME:InsightScrfdFaceDetection}
modelPath: ${VISUAL_MODEL_FACEDETECTION_PATH:}

View File

@ -22,6 +22,7 @@ logging:
# 模型配置
visual:
model:
baseModelPath: 'face-search-core/src/main/resources/'
faceDetection:
name: InsightScrfdFaceDetection
modelPath:
@ -48,7 +49,7 @@ visual:
thread: 1
engine:
open-search:
host: 172.16.36.229
host: visual-face-search-opensearch
port: 9200
scheme: https
username: admin
@ -82,9 +83,9 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://172.16.36.228:3306/visual_face_search?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
username: visual
password: visual
url: jdbc:mysql://visual-face-search-mysql:3306/visual_face_search?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
username: root
password: root
slave:
# 从数据源开关/默认关闭
enabled: false