|
@@ -47,6 +47,7 @@ import com.taais.biz.service.ITargetDetectionService;
|
|
|
|
|
|
import static com.taais.biz.constant.BizConstant.VideoStatus.NOT_START;
|
|
|
import static com.taais.biz.domain.table.TargetDetectionTableDef.TARGET_DETECTION;
|
|
|
+import static com.taais.biz.service.impl.ToInfraredServiceImpl.readLogContent;
|
|
|
import static com.taais.biz.service.impl.VideoStableServiceImpl.*;
|
|
|
import static com.taais.biz.service.impl.VideoStableServiceImpl.sendPostMsg;
|
|
|
|
|
@@ -247,7 +248,7 @@ public class TargetDetectionServiceImpl extends BaseServiceImpl<TargetDetectionM
|
|
|
|
|
|
Path path = Paths.get(resourcePath);
|
|
|
Path inputPath = path.resolveSibling(fileName_without_suffix + BizConstant.UNZIP_SUFFIX);
|
|
|
- Path outputPath = path.resolveSibling(fileName_without_suffix + BizConstant.TARGET_DETECTION_SUFFIX);
|
|
|
+ Path outputPath = path.resolveSibling(entity.getId().toString() + BizConstant.TO_INFRARED_SUFFIX);
|
|
|
|
|
|
makeDir(inputPath.toString());
|
|
|
makeDir(outputPath.toString());
|
|
@@ -279,7 +280,21 @@ public class TargetDetectionServiceImpl extends BaseServiceImpl<TargetDetectionM
|
|
|
String modelPath = algorithmModelTrack.getModelAddress() + File.separator + algorithmModelTrack.getModelName();
|
|
|
startTaskConfig.setModel_path(modelPath);
|
|
|
}
|
|
|
-
|
|
|
+ else if (BizConstant.AlgorithmType.TRAIN.equals(algorithmConfigTrack.getType())) {
|
|
|
+ // 这时候需要在之前的基础上,添加类别的路径
|
|
|
+ File dir = new File( startTaskConfig.getSource_dir());
|
|
|
+ File[] files = dir.listFiles();
|
|
|
+ // 暂时只传第一个文件夹用作训练
|
|
|
+ if(files == null || files.length == 0) {
|
|
|
+ return CommonResult.fail("输入数据集为空!");
|
|
|
+ }
|
|
|
+ for(File file__ : files) {
|
|
|
+ if(file__.isDirectory()){
|
|
|
+ startTaskConfig.setSource_dir(file__.getAbsolutePath()); // 设置路径
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
HttpResponseEntity responseEntity = sendPostMsg(algorithmConfigTrack.getAlgorithmAddress(), startTaskConfig);
|
|
|
if (ObjectUtil.isNotNull(responseEntity) && responseEntity.getStatus() == 200) {
|
|
@@ -405,17 +420,11 @@ public class TargetDetectionServiceImpl extends BaseServiceImpl<TargetDetectionM
|
|
|
TargetDetection entity = getById(id);
|
|
|
String outPutPath = entity.getOutputPath();
|
|
|
String logPath = outPutPath + File.separator + getLogFileName(entity);
|
|
|
+ System.out.println(logPath);
|
|
|
File file = new File(logPath);
|
|
|
if (!file.exists()) {
|
|
|
return CommonResult.fail("日志文件不存在!");
|
|
|
}
|
|
|
- try (BufferedReader br = new BufferedReader(new FileReader(logPath))) {
|
|
|
- String log = Files.readString(Paths.get(logPath));
|
|
|
- log = log.replaceAll("\n", "<br/>\n");
|
|
|
- return CommonResult.success(log, "success");
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- return CommonResult.fail("读取日志失败!");
|
|
|
- }
|
|
|
+ return CommonResult.success(readLogContent(logPath), "success");
|
|
|
}
|
|
|
}
|