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

View File

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

View File

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

View File

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