From a4ad691bf62e6ef9b47d33461f8a0578fa58c668 Mon Sep 17 00:00:00 2001 From: divenswu Date: Thu, 13 Jul 2023 18:38:51 +0800 Subject: [PATCH] =?UTF-8?q?update:=20docker=E9=83=A8=E7=BD=B2=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=A8=A1=E5=9E=8B=E7=9A=84?= =?UTF-8?q?=E9=BB=98=E8=AE=A4base=E8=B7=AF=E5=BE=84=E5=8F=82=E6=95=B0?= =?UTF-8?q?=EF=BC=9AVISUAL=5FMODEL=5FBASE=5FMODEL=5FPATH?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../search/server/bootstrap/conf/ModelConfig.java | 14 +++++++++----- .../src/main/resources/application-dev.yml | 5 +++-- .../src/main/resources/application-docker.yml | 1 + .../src/main/resources/application-local.yml | 9 +++++---- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/face-search-server/src/main/java/com/visual/face/search/server/bootstrap/conf/ModelConfig.java b/face-search-server/src/main/java/com/visual/face/search/server/bootstrap/conf/ModelConfig.java index fe03270..bdf8951 100755 --- a/face-search-server/src/main/java/com/visual/face/search/server/bootstrap/conf/ModelConfig.java +++ b/face-search-server/src/main/java/com/visual/face/search/server/bootstrap/conf/ModelConfig.java @@ -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; } } diff --git a/face-search-server/src/main/resources/application-dev.yml b/face-search-server/src/main/resources/application-dev.yml index ffbff35..8988d75 100755 --- a/face-search-server/src/main/resources/application-dev.yml +++ b/face-search-server/src/main/resources/application-dev.yml @@ -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 diff --git a/face-search-server/src/main/resources/application-docker.yml b/face-search-server/src/main/resources/application-docker.yml index 1f5380a..466d23a 100755 --- a/face-search-server/src/main/resources/application-docker.yml +++ b/face-search-server/src/main/resources/application-docker.yml @@ -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:} diff --git a/face-search-server/src/main/resources/application-local.yml b/face-search-server/src/main/resources/application-local.yml index e450a4e..17e3790 100755 --- a/face-search-server/src/main/resources/application-local.yml +++ b/face-search-server/src/main/resources/application-local.yml @@ -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