Browse Source

Merge branch 'develop_1016' of http://47.108.150.237:10000/www/taais into develop_1016

Eagle 8 months ago
parent
commit
856f06447c

+ 13 - 13
taais-modules/taais-biz/src/main/java/com/taais/biz/controller/DataAugmentationController.java

@@ -79,15 +79,15 @@ public class DataAugmentationController extends BaseController {
             Path outputPath = null;
             String osName = System.getProperty("os.name");
             // 判断是否是Windows环境
-            if (osName.toLowerCase().contains("windows")) {
-                inputPath = Paths.get("C:", dataAugmentation.getInputPath());
-                outputPath = Paths.get("C:", dataAugmentation.getOutputPath());
-            } else {
-                inputPath = Paths.get(dataAugmentation.getInputPath());
-                outputPath = Paths.get(dataAugmentation.getOutputPath());
-            }
-//            inputPath = Paths.get(dataAugmentation.getInputPath());
-//            outputPath = Paths.get(dataAugmentation.getOutputPath());
+//            if (osName.toLowerCase().contains("windows")) {
+//                inputPath = Paths.get("D:", dataAugmentation.getInputPath());
+//                outputPath = Paths.get("D:", dataAugmentation.getOutputPath());
+//            } else {
+//                inputPath = Paths.get(dataAugmentation.getInputPath());
+//                outputPath = Paths.get(dataAugmentation.getOutputPath());
+//            }
+            inputPath = Paths.get(dataAugmentation.getInputPath());
+            outputPath = Paths.get(dataAugmentation.getOutputPath());
             System.out.println("inputPath: " + inputPath.toString());
             System.out.println("outputPath: " + outputPath.toString());
             Path imagePath = getImageAtPathIdx(inputPath, idx);
@@ -137,10 +137,10 @@ public class DataAugmentationController extends BaseController {
         }
     }
 
-     @PostMapping("/get_result")
-     public CommonResult getResult(@Valid @RequestBody VideoStableStartResultBo videoStableStartResultBo) {
-         return dataAugmentationService.getResult(videoStableStartResultBo);
-     }
+    @PostMapping("/get_result")
+    public CommonResult getResult(@Valid @RequestBody VideoStableStartResultBo videoStableStartResultBo) {
+        return dataAugmentationService.getResult(videoStableStartResultBo);
+    }
 
     @GetMapping("/start/{id}")
     public CommonResult start(@PathVariable("id") Long id) {

+ 50 - 42
taais-modules/taais-biz/src/main/java/com/taais/biz/service/impl/DataAugmentationServiceImpl.java

@@ -233,40 +233,47 @@ public class DataAugmentationServiceImpl extends BaseServiceImpl<DataAugmentatio
 
         String fileName = StringUtils.substringAfterLast(filePath, "/");
         String fileName_without_suffix = removeFileExtension(fileName);
-
-        Path path = Paths.get(resourcePath);
-        Path inputPath = path.resolveSibling(fileName_without_suffix + "_images");
-        Path outputPath = path.resolveSibling(fileName_without_suffix + "_stable");
-        Path logPath = path.resolveSibling(fileName_without_suffix + "_log");
+        Path path = null;
+        Path inputPath = null;
+        Path outputPath = null;
+        Path logPath = null;
+//        Path path = Paths.get();
+        //String osName = System.getProperty("os.name");
+        //判断是否是Windows环境
+//        if (osName.toLowerCase().contains("windows")) {
+//            path = Paths.get("D:", resourcePath);
+//        } else {
+//            path = Paths.get(resourcePath);
+//
+//        }
+        path = Paths.get(resourcePath);
+        inputPath = path.resolveSibling(fileName_without_suffix + "_input");
+        outputPath = path.resolveSibling(fileName_without_suffix + "_output");
+        logPath = path.resolveSibling(fileName_without_suffix + "_log");
         makeDir(inputPath.toString());
         makeDir(outputPath.toString());
-        makeDir(localPath.toString());
-        //本地测试代码
-//        String inputPath = "D:\\program\\taais\\duijie\\code-niguang\\" + fileName_without_suffix + "_images";
-//        String outputPath = "D:\\program\\taais\\duijie\\code-niguang\\" + fileName_without_suffix + "_output";
-//        String logPath = "D:\\program\\taais\\duijie\\code-niguang\\" + fileName_without_suffix + "_log";
-//        makeDir(inputPath.toString());
-//        makeDir(outputPath.toString());
-//        makeDir(logPath.toString());
-//        Path path = Paths.get(inputPath);
+        makeDir(logPath.toString());
+
+        System.out.println("inputPath:" + inputPath.toString());
         ZipUtils.unzip(resourcePath, inputPath.toString());
-        //获取inputPath的下一级目录
-        if (Files.exists(inputPath) && Files.isDirectory(inputPath)) {
-            try (DirectoryStream<Path> stream = Files.newDirectoryStream(path)) {
-                // 遍历目录流以找到第一个子目录
-                for (Path entry : stream) {
-                    if (Files.isDirectory(entry)) {
-                        // 打印第一个子目录的名称,并跳出循环
-                        dataAugmentation.setInputPath(entry.toString());
-                        break;  // 只处理第一个子目录后退出
-                    }
-                }
-            } catch (IOException e) {
-                return CommonResult.fail(e.toString());
-            }
-        } else {
-            return CommonResult.fail("The provided path is not a valid directory.");
-        }
+//        //获取inputPath的下一级目录
+//        if (Files.exists(inputPath) && Files.isDirectory(inputPath)) {
+//            try (DirectoryStream<Path> stream = Files.newDirectoryStream(inputPath)) {
+//                // 遍历目录流以找到第一个子目录
+//                for (Path entry : stream) {
+//                    if (Files.isDirectory(entry)) {
+//                        // 打印第一个子目录的名称,并跳出循环
+//                        dataAugmentation.setInputPath(entry.toString());
+//                        break;  // 只处理第一个子目录后退出
+//                    }
+//                }
+//            } catch (IOException e) {
+//                return CommonResult.fail(e.toString());
+//            }
+//        } else {
+//            return CommonResult.fail("The provided path is not a valid directory.");
+//        }
+        dataAugmentation.setInputPath(inputPath.toString());
         dataAugmentation.setAlgorithmPath(logPath.toString());
         dataAugmentation.setOutputPath(outputPath.toString());
         dataAugmentation.setStartTime(new Date());
@@ -284,7 +291,7 @@ public class DataAugmentationServiceImpl extends BaseServiceImpl<DataAugmentatio
         TransmissionObject transmissionObject = new TransmissionObject();
         transmissionObject.setBizId(dataAugmentation.getId());
         transmissionObject.setBizType(dataAugmentation.getTaskType());
-        transmissionObject.setLogPath(dataAugmentation.getLog());
+        transmissionObject.setLogPath(dataAugmentation.getAlgorithmPath());
         transmissionObject.setSourcePath(dataAugmentation.getInputPath());
         transmissionObject.setResultPath(dataAugmentation.getOutputPath());
         transmissionObject.setOtherParams(dataAugmentation.getHyperparameterConfiguration());
@@ -350,17 +357,18 @@ public class DataAugmentationServiceImpl extends BaseServiceImpl<DataAugmentatio
 
         Path inputPath = null;
         Path outputPath = null;
-        String osName = System.getProperty("os.name");
+//        String osName = System.getProperty("os.name");
         // 判断是否是Windows环境
-        if (osName.toLowerCase().contains("windows")) {
-            inputPath = Paths.get("C:", dataAugmentation.getInputPath());
-            outputPath = Paths.get("C:", dataAugmentation.getOutputPath());
-        } else {
-            inputPath = Paths.get(dataAugmentation.getInputPath());
-            outputPath = Paths.get(dataAugmentation.getOutputPath());
-        }
-//        inputPath = Paths.get(dataAugmentation.getInputPath());
-//        outputPath = Paths.get(dataAugmentation.getOutputPath());
+//        if (osName.toLowerCase().contains("windows")) {
+//            inputPath = Paths.get("D:", dataAugmentation.getInputPath());
+//            outputPath = Paths.get("D:", dataAugmentation.getOutputPath());
+//        } else {
+//            inputPath = Paths.get(dataAugmentation.getInputPath());
+//            outputPath = Paths.get(dataAugmentation.getOutputPath());
+//        }
+
+        inputPath = Paths.get(dataAugmentation.getInputPath());
+        outputPath = Paths.get(dataAugmentation.getOutputPath());
         // 创建File对象
         File in_directory = new File(inputPath.toString());
         File out_directory = new File(outputPath.toString());

+ 9 - 3
taais-modules/taais-biz/src/main/java/com/taais/biz/service/impl/TargetIdentificationSubtaskServiceImpl.java

@@ -228,7 +228,12 @@ public class TargetIdentificationSubtaskServiceImpl extends BaseServiceImpl<Targ
                     hasModelProperty = true;
                     _modelId = object.getString("modelId");
                 }
-                algorithmRequestDto.getOtherParams().put(object.getString("agName"), object.getString("defaultValue"));
+                String value = object.getString("defaultValue");
+                if(NumberUtils.isCreatable(value)){
+                    algorithmRequestDto.getOtherParams().put(object.getString("agName"), NumberUtils.createNumber(value));
+                } else {
+                    algorithmRequestDto.getOtherParams().put(object.getString("agName"), value);
+                }
             }
         } catch (Exception e) {
             log.error(e.getMessage());
@@ -241,7 +246,8 @@ public class TargetIdentificationSubtaskServiceImpl extends BaseServiceImpl<Targ
                 AlgorithmModelVo bo = algorithmModelService.selectById(Long.valueOf(_modelId));
                 String path = bo.getModelAddress().replace("/profile", BizConstant.DOCKER_BASE_PATH);
                 algorithmRequestDto.getOtherParams().put("pretrained", true);
-                algorithmRequestDto.getOtherParams().put("pretrained_model", path);
+                // todo pretrained_model is a number
+//                algorithmRequestDto.getOtherParams().put("pretrained_model", path);
             }
         } else if (taskName.contains("验证")) {
             String[] urls = url.split(";;;");
@@ -256,7 +262,7 @@ public class TargetIdentificationSubtaskServiceImpl extends BaseServiceImpl<Targ
             return;
         }
         // send http
-        System.out.println("todo request: " + algorithmRequestDto.toString());
+        log.info("todo request: " + algorithmRequestDto);
 
         try {
             String res = HttpUtil.post(url, JSONUtil.toJsonStr(algorithmRequestDto));