|
@@ -25,6 +25,7 @@ import com.taais.common.orm.core.page.PageQuery;
|
|
|
import com.taais.common.core.core.page.PageResult;
|
|
|
import com.taais.common.orm.core.service.impl.BaseServiceImpl;
|
|
|
import jakarta.annotation.Resource;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -44,6 +45,7 @@ import static com.taais.biz.domain.table.TargetIdentificationTaskTableDef.TARGET
|
|
|
* 2024-08-17
|
|
|
*/
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
public class TargetIdentificationTaskServiceImpl extends BaseServiceImpl<TargetIdentificationTaskMapper, TargetIdentificationTask> implements ITargetIdentificationTaskService {
|
|
|
@Resource
|
|
|
private TargetIdentificationTaskMapper targetIdentificationTaskMapper;
|
|
@@ -265,6 +267,8 @@ public class TargetIdentificationTaskServiceImpl extends BaseServiceImpl<TargetI
|
|
|
|
|
|
public static final String PATH_PREFIX = "/home/ObjectDetection_Web/task";
|
|
|
public static final String WORK_DIR = "/home/ObjectDetection_Web";
|
|
|
+ //public static final String PATH_PREFIX = "ObjectDetection_Web/task";
|
|
|
+ //public static final String WORK_DIR = "ObjectDetection_Web";
|
|
|
/**
|
|
|
* 移动文件到对应文件夹
|
|
|
* @param batch
|
|
@@ -297,6 +301,7 @@ public class TargetIdentificationTaskServiceImpl extends BaseServiceImpl<TargetI
|
|
|
for (DataVo dataVo : dataVoList) {
|
|
|
String[] strings = dataVo.getUrl().split("/profile");
|
|
|
String relativePath = WORK_DIR + strings[strings.length - 1];
|
|
|
+ relativePath = relativePath.replace("\\", "/").replace("//", "/");
|
|
|
File file = new File(relativePath);
|
|
|
System.out.println(file.getAbsolutePath());
|
|
|
if (file.exists()) {
|
|
@@ -312,6 +317,7 @@ public class TargetIdentificationTaskServiceImpl extends BaseServiceImpl<TargetI
|
|
|
if (dataVo.getLabelurl() != null) {
|
|
|
strings = dataVo.getLabelurl().split("/profile");
|
|
|
relativePath = WORK_DIR + strings[strings.length - 1];
|
|
|
+ relativePath = relativePath.replace("\\", "/").replace("//", "/");
|
|
|
file = new File(relativePath);
|
|
|
if (file.exists()) {
|
|
|
try {
|
|
@@ -356,13 +362,16 @@ public class TargetIdentificationTaskServiceImpl extends BaseServiceImpl<TargetI
|
|
|
for (String batchNum : batches) {
|
|
|
List<DataVo> dataVoList = dataService.getDataByBatchNum(batchNum);
|
|
|
for (DataVo dataVo : dataVoList) {
|
|
|
+ log.info("dataVo: " + dataVo.getUrl());
|
|
|
String[] strings = null;
|
|
|
String relativePath = null;
|
|
|
File file = null;
|
|
|
|
|
|
if (dataVo.getLabelurl() != null) {
|
|
|
strings = dataVo.getLabelurl().split("/profile");
|
|
|
- relativePath = "ObjectDetection_Web" + strings[strings.length - 1];
|
|
|
+ relativePath = WORK_DIR + strings[strings.length - 1];
|
|
|
+ relativePath = relativePath.replace("\\", "/").replace("//", "/");
|
|
|
+ log.info("relativePath: " + relativePath);
|
|
|
file = new File(relativePath);
|
|
|
if (file.exists()) {
|
|
|
if (!moveLabelFile) {
|
|
@@ -373,7 +382,7 @@ public class TargetIdentificationTaskServiceImpl extends BaseServiceImpl<TargetI
|
|
|
FileUtils.copyFile(file, dist);
|
|
|
System.out.println("file dist: " + dist.getAbsolutePath());
|
|
|
} catch (IOException e) {
|
|
|
- Log.debug("bug found");
|
|
|
+ log.error("e happens: {}", e.getMessage());
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
@@ -382,11 +391,14 @@ public class TargetIdentificationTaskServiceImpl extends BaseServiceImpl<TargetI
|
|
|
}
|
|
|
|
|
|
strings = dataVo.getUrl().split("/profile");
|
|
|
- relativePath = "ObjectDetection_Web" + strings[strings.length - 1];
|
|
|
+ relativePath = WORK_DIR + strings[strings.length - 1];
|
|
|
+ relativePath = relativePath.replace("\\", "/").replace("//", "/");
|
|
|
+ log.info("relativePath url: " + relativePath);
|
|
|
file = new File(relativePath);
|
|
|
if (file.exists()) {
|
|
|
try {
|
|
|
File dist = new File(PATH_PREFIX + path + "/images/" + file.getName());
|
|
|
+ log.info("get filename: {}", file.getName());
|
|
|
FileUtils.copyFile(file, dist);
|
|
|
System.out.println("file dist: " + dist.getAbsolutePath());
|
|
|
} catch (IOException e) {
|
|
@@ -412,7 +424,8 @@ public class TargetIdentificationTaskServiceImpl extends BaseServiceImpl<TargetI
|
|
|
|
|
|
if (StringUtils.isNotEmpty(dataVo.getLabelurl())) {
|
|
|
strings = dataVo.getLabelurl().split("/profile");
|
|
|
- String relativePath = "ObjectDetection_Web" + strings[strings.length - 1];
|
|
|
+ String relativePath = WORK_DIR + strings[strings.length - 1];
|
|
|
+ relativePath = relativePath.replace("\\", "/").replace("//", "/");
|
|
|
File file = new File(relativePath);
|
|
|
if (file.exists()) {
|
|
|
return true;
|
|
@@ -450,6 +463,7 @@ public class TargetIdentificationTaskServiceImpl extends BaseServiceImpl<TargetI
|
|
|
|
|
|
for (int i = 0; i < testBatchNumList.size(); i++) {
|
|
|
String batchNum = testBatchNumList.get(i);
|
|
|
+ log.info("'batchNum' is: {}", batchNum);
|
|
|
TargetIdentificationSubtaskDetailsBo subtaskDetail = new TargetIdentificationSubtaskDetailsBo();
|
|
|
// 通过算法id获取算法配置
|
|
|
subtaskDetail.setSubtaskId(subtask.getId());
|
|
@@ -466,12 +480,15 @@ public class TargetIdentificationTaskServiceImpl extends BaseServiceImpl<TargetI
|
|
|
|
|
|
if (hasValidationSet(batchNum)) {
|
|
|
subtaskDetail.setName(algName + "_验证");
|
|
|
+ subtaskDetail.setParameters(params.get(1));
|
|
|
copyFilesToPath(batchNum, subtaskPath, true);
|
|
|
subtaskDetail.setType(algorithmModelVo.getVerifyUrl() + ";;;" + records.get(algName));
|
|
|
subtaskDetailsService.insert(subtaskDetail);
|
|
|
+ // reset to '测试'
|
|
|
subtaskPath = "/" + UUID.randomUUID().toString().replace("-", "_");
|
|
|
subtaskDetail.setPreprocessPath(subtaskPath);
|
|
|
subtaskDetail.setResultPath(subtaskPath + "/result");
|
|
|
+ subtaskDetail.setParameters(params.get(2));
|
|
|
}
|
|
|
|
|
|
subtaskDetail.setName(algName + "_测试");
|