|
@@ -1,5 +1,6 @@
|
|
|
package com.taais.biz.service.impl;
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.lang.reflect.Type;
|
|
|
import java.util.*;
|
|
|
|
|
@@ -22,6 +23,7 @@ import com.taais.biz.domain.dto.AlgorithmRequestDto;
|
|
|
import com.taais.biz.domain.vo.AlgorithmModelVo;
|
|
|
import com.taais.biz.domain.vo.AlgorithmTaskConfigurationVo;
|
|
|
import com.taais.biz.domain.vo.TargetIdentificationSubtaskDetailsVo;
|
|
|
+import com.taais.common.core.config.TaaisConfig;
|
|
|
import com.taais.common.core.constant.Constants;
|
|
|
import com.taais.common.core.utils.MapstructUtils;
|
|
|
import com.taais.common.core.utils.StringUtils;
|
|
@@ -254,13 +256,39 @@ public class TargetIdentificationSubtaskServiceImpl extends BaseServiceImpl<Targ
|
|
|
String[] urls = url.split(";;;");
|
|
|
url = urls[0];
|
|
|
if (urls.length > 1) {
|
|
|
- algorithmRequestDto.getOtherParams().put("weight_path", BizConstant.DOCKER_BASE_PATH + MINI_PREFIX + urls[1] + "/result/weights/best.pt");
|
|
|
+ // 兼容pth 等
|
|
|
+ String SUFFIX_NAME = "best.pt";
|
|
|
+ String _path = BizConstant.DOCKER_BASE_PATH + MINI_PREFIX + urls[1] + "/result/weights/";
|
|
|
+ File dir = new File(_path);
|
|
|
+ if (dir.exists()) {
|
|
|
+ File[] files = dir.listFiles();
|
|
|
+ for (File file : files) {
|
|
|
+ if (file.isFile() && file.getName().contains("best")) {
|
|
|
+ SUFFIX_NAME = file.getName();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ algorithmRequestDto.getOtherParams().put("weight_path", _path+SUFFIX_NAME);
|
|
|
}
|
|
|
} else if (taskName.contains("测试")) {
|
|
|
String[] urls = url.split(";;;");
|
|
|
url = urls[0];
|
|
|
if (urls.length > 1) {
|
|
|
- algorithmRequestDto.getOtherParams().put("weight_path", BizConstant.DOCKER_BASE_PATH + MINI_PREFIX + urls[1] + "/result/weights/best.pt");
|
|
|
+ // 兼容pth 等
|
|
|
+ String SUFFIX_NAME = "best.pt";
|
|
|
+ String _path = BizConstant.DOCKER_BASE_PATH + MINI_PREFIX + urls[1] + "/result/weights/";
|
|
|
+ File dir = new File(_path);
|
|
|
+ if (dir.exists()) {
|
|
|
+ File[] files = dir.listFiles();
|
|
|
+ for (File file : files) {
|
|
|
+ if (file.isFile() && file.getName().contains("best")) {
|
|
|
+ SUFFIX_NAME = file.getName();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ algorithmRequestDto.getOtherParams().put("weight_path", _path+SUFFIX_NAME);
|
|
|
}
|
|
|
} else {
|
|
|
log.error("taskName error: " + taskName);
|