houzhongjian
2024-11-07 a874b928e16320839315b9abcdf2cece1229a424
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);