|
@@ -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());
|