From 1a2b62d8d2f56f6cd67f225fdc82bb29705d9286 Mon Sep 17 00:00:00 2001
From: dengzedong <dengzedong@email>
Date: 星期五, 18 十月 2024 13:58:11 +0800
Subject: [PATCH] 模型运行方法 ItemStatus STATUS1(1, "启用"); 添加字段 mpkProjectId 模型运行api 其他bug调整

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java
index 7b47923..41246be 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mdk/predict/impl/PredictModelHandlerImpl.java
@@ -15,6 +15,7 @@
 import com.iailab.module.model.mdk.sample.SampleConstructor;
 import com.iailab.module.model.mdk.sample.dto.SampleData;
 import com.iailab.module.model.mdk.vo.PredictResultVO;
+import com.iailab.module.model.mpk.common.utils.DllUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -80,16 +81,26 @@
             log.info(String.valueOf(jsonObjParam2Values));
 
             //IAILMDK.run
-            HashMap<String, Object> modelResult = IAILMDK.run(newModelBean, param2Values);
+//            HashMap<String, Object> modelResult = IAILMDK.run(newModelBean, param2Values);
+            HashMap<String, Object> modelResult = DllUtils.run(newModelBean, param2Values, predictModel.getMpkprojectid());
             //打印结果
             JSONObject jsonObjResult = new JSONObject();
-            jsonObjResult.put("result", result);
+            jsonObjResult.put("result", modelResult);
             log.info(String.valueOf(jsonObjResult));
 
             MmModelResultstrEntity modelResultstr = mmModelResultstrService.getInfo(predictModel.getResultstrid());
             log.info("模型计算完成:modelId=" + modelId + result);
-            double[][] temp = (double[][]) modelResult.get(modelResultstr.getResultstr());
-            result.setPredictMatrix(temp);
+            if (modelResult.containsKey(modelResultstr.getResultstr())) {
+                Double[][] temp = (Double[][]) modelResult.get(modelResultstr.getResultstr());
+                double[][] temp1 = new double[temp.length][temp[0].length];
+                for (int i = 0; i < temp.length; i++) {
+                    for (int j = 0; j < temp[i].length; j++) {
+                        temp1[i][j] = temp[i][j].doubleValue();
+                    }
+                }
+                result.setPredictMatrix(temp1);
+            }
+            result.setModelResult(modelResult);
             result.setPredictTime(predictTime);
         } catch (Exception ex) {
             log.error("IAILModel对象构造失败,modelId=" + modelId);

--
Gitblit v1.9.3