|
@@ -6,6 +6,7 @@ import java.nio.file.Path;
|
|
|
import java.nio.file.Paths;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
@@ -47,6 +48,8 @@ import static com.taais.biz.domain.table.TargetDetectionTableDef.TARGET_DETECTIO
|
|
|
import static com.taais.biz.service.impl.VideoStableServiceImpl.*;
|
|
|
import static com.taais.biz.service.impl.VideoStableServiceImpl.sendPostMsg;
|
|
|
|
|
|
+import com.alibaba.fastjson2.JSON;
|
|
|
+
|
|
|
/**
|
|
|
* 目标检测Service业务层处理
|
|
|
*
|
|
@@ -270,7 +273,8 @@ public class TargetDetectionServiceImpl extends BaseServiceImpl<TargetDetectionM
|
|
|
startToInfraredTask.setResult_dir(entity.getOutputPath());
|
|
|
|
|
|
if (BizConstant.AlgorithmType.REASONING.equals(algorithmConfigTrack.getType())) {
|
|
|
- startToInfraredTask.setModel_path(algorithmModelTrack.getModelAddress());
|
|
|
+ String modelPath = algorithmModelTrack.getModelAddress() + File.separator + algorithmModelTrack.getModelName();
|
|
|
+ startToInfraredTask.setModel_path(modelPath);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -319,6 +323,43 @@ public class TargetDetectionServiceImpl extends BaseServiceImpl<TargetDetectionM
|
|
|
entity.setCostSecond(null);
|
|
|
}
|
|
|
updateById(entity);
|
|
|
+
|
|
|
+ AlgorithmModelTrack algorithmModelTrack = algorithmModelTrackService.getById(entity.getAlgorithmModelId());
|
|
|
+ algorithmModelTrack.setModelStatus("200".equals(status) ? BizConstant.ModelStatus.END : BizConstant.ModelStatus.FAILED);
|
|
|
+
|
|
|
+ AlgorithmConfigTrack algorithmConfigTrack = algorithmConfigTrackService.getById(algorithmModelTrack.getAlgorithmId());
|
|
|
+ String params = algorithmConfigTrack.getParameterConfig();
|
|
|
+ HashMap<String, Object> parse = (HashMap<String, Object>) JSON.parse((params));
|
|
|
+
|
|
|
+ if("200".equals(status) && ObjectUtil.isNull(algorithmModelTrack.getModelAddress())) {
|
|
|
+ algorithmModelTrack.setModelAddress(entity.getOutputPath() + File.separator + ((HashMap<String, String>)parse.get("dataset")).get("classes"));
|
|
|
+
|
|
|
+ System.out.println(parse.get("dataset"));
|
|
|
+ algorithmModelTrackService.updateById(algorithmModelTrack);
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 这里有很多需要做的:1. 保存所有模型到oss 2. 模型文件保存到算法模型配置表中
|
|
|
+ */
|
|
|
+ /*
|
|
|
+ Path resultsPath = Paths.get(entity.getInputPath());
|
|
|
+ Path modelPath = resultsPath.resolve(BizConstant.MODEL_PATH);
|
|
|
+
|
|
|
+ File modelDir = new File(modelPath.toString());
|
|
|
+
|
|
|
+ if(!modelDir.exists() || !modelDir.isDirectory()) {
|
|
|
+ return CommonResult.fail("模型文件不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ for (File f : modelDir.listFiles()) {
|
|
|
+ if (f.isFile() && f.getName().endsWith(BizConstant.MODEL_SUFFIX)) {
|
|
|
+ SysOssVo upload = ossService.upload(f);
|
|
|
+ AlgorithmModelTrack algorithmModelTrack = new AlgorithmModelTrack();
|
|
|
+ algorithmModelTrack.set
|
|
|
+ algorithmModelTrackService.insert();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ */
|
|
|
return CommonResult.success();
|
|
|
}
|
|
|
|