浏览代码

feat: 可辨识性分析部分完成

WANGKANG 5 月之前
父节点
当前提交
d10eb9e0fb

+ 2 - 0
taais-modules/taais-biz/src/main/java/com/taais/biz/domain/TrackSequence.java

@@ -80,4 +80,6 @@ private static final long serialVersionUID = 1L;
 
     private Long algorithmModelId;
     private Long algorithmId;
+    private String algorithmParameters;
+    private String logPath;
 }

+ 24 - 8
taais-modules/taais-biz/src/main/java/com/taais/biz/domain/bo/TrackSequenceBo.java

@@ -4,15 +4,19 @@
 
 package com.taais.biz.domain.bo;
 
+import com.fasterxml.jackson.annotation.JsonAnySetter;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.taais.biz.domain.TrackSequence;
+import com.taais.common.orm.core.domain.BaseEntity;
 import io.github.linpeilie.annotations.AutoMapper;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
-import jakarta.validation.constraints.*;
-import com.taais.common.orm.core.domain.BaseEntity;
 
 import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * 注视轨迹序列业务对象 track_sequence
@@ -23,7 +27,7 @@ import java.util.Date;
 @Data
 @EqualsAndHashCode(callSuper = true)
 @AutoMapper(target = TrackSequence.class, reverseConvertGenerate = false)
-public class TrackSequenceBo extends BaseEntity{
+public class TrackSequenceBo extends BaseEntity {
     /**
      * ID
      */
@@ -37,11 +41,11 @@ public class TrackSequenceBo extends BaseEntity{
 
     /**
      * 状态
-0:未开始
-1:进行中
-2:完成
-3:失败
-4:中断
+     * 0:未开始
+     * 1:进行中
+     * 2:完成
+     * 3:失败
+     * 4:中断
      */
     private String status;
 
@@ -99,5 +103,17 @@ public class TrackSequenceBo extends BaseEntity{
     private String zipFilePath;
 
     private Long algorithmModelId;
+
+    @NotNull(message = "算法不能为空")
     private Long algorithmId;
+    private String algorithmParameters;
+    private String logPath;
+
+    // 将其他参数存入Map
+    private Map<String, Object> otherParams = new HashMap<>();
+
+    @JsonAnySetter
+    public void addOtherParam(String name, Object value) {
+        this.otherParams.put(name, value);
+    }
 }

+ 6 - 0
taais-modules/taais-biz/src/main/java/com/taais/biz/domain/vo/TrackSequenceImportVo.java

@@ -85,6 +85,12 @@ public class TrackSequenceImportVo implements Serializable
     @ExcelProperty(value = "zip文件输出路径")
     private String zipFilePath;
 
+    @ExcelProperty(value = "算法模型ID")
     private Long algorithmModelId;
+    @ExcelProperty(value = "算法ID")
     private Long algorithmId;
+    @ExcelProperty(value = "算法参数")
+    private String algorithmParameters;
+    @ExcelProperty(value = "日志路径")
+    private String logPath;
 }

+ 8 - 1
taais-modules/taais-biz/src/main/java/com/taais/biz/domain/vo/TrackSequenceVo.java

@@ -122,11 +122,18 @@ public class TrackSequenceVo extends BaseEntity implements Serializable {
     @ExcelProperty(value = "zip文件输出路径")
     private String zipFilePath;
 
-    private Long algorithmModelId;
 
     private String type;
     private String subsystem;
     private String algorithmName;
     private String modelName;
+
+    @ExcelProperty(value = "算法模型ID")
+    private Long algorithmModelId;
+    @ExcelProperty(value = "算法ID")
     private Long algorithmId;
+    @ExcelProperty(value = "算法参数")
+    private String algorithmParameters;
+    @ExcelProperty(value = "日志路径")
+    private String logPath;
 }

+ 161 - 209
taais-modules/taais-biz/src/main/java/com/taais/biz/service/impl/TrackSequenceServiceImpl.java

@@ -4,13 +4,6 @@
 
 package com.taais.biz.service.impl;
 
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.text.DecimalFormat;
-import java.util.*;
-
 import cn.hutool.core.lang.Dict;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson2.JSON;
@@ -25,7 +18,6 @@ import com.taais.biz.domain.vo.StartTaskConfig;
 import com.taais.biz.domain.vo.TrackSequenceVo;
 import com.taais.biz.mapper.TrackSequenceMapper;
 import com.taais.biz.service.ITrackSequenceService;
-import com.taais.biz.utils.CsvReadUtils;
 import com.taais.biz.utils.ZipUtils;
 import com.taais.common.core.config.TaaisConfig;
 import com.taais.common.core.constant.Constants;
@@ -33,8 +25,8 @@ import com.taais.common.core.core.domain.CommonResult;
 import com.taais.common.core.core.page.PageResult;
 import com.taais.common.core.utils.MapstructUtils;
 import com.taais.common.core.utils.StringUtils;
+import com.taais.common.json.utils.JsonUtils;
 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 com.taais.common.websocket.utils.WebSocketUtils;
 import com.taais.system.domain.vo.SysOssVo;
@@ -42,7 +34,6 @@ import com.taais.system.service.ISysOssService;
 import jakarta.annotation.Resource;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.core.io.FileSystemResource;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpStatus;
@@ -50,13 +41,19 @@ import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.text.DecimalFormat;
+import java.util.*;
+
 import static com.taais.biz.constant.BizConstant.VideoStatus.NOT_START;
 import static com.taais.biz.domain.table.TrackSequenceTableDef.TRACK_SEQUENCE;
 import static com.taais.biz.service.impl.TargetDetectionServiceImpl.getFileSize;
 import static com.taais.biz.service.impl.TargetDetectionServiceImpl.port;
 import static com.taais.biz.service.impl.ToInfraredServiceImpl.*;
 import static com.taais.biz.service.impl.VideoStableServiceImpl.*;
-import static com.taais.biz.service.impl.VideoStableServiceImpl.makeDir;
 
 /**
  * 注视轨迹序列Service业务层处理
@@ -70,9 +67,6 @@ public class TrackSequenceServiceImpl extends BaseServiceImpl<TrackSequenceMappe
     private static final String MASC = "MASC";
     private static final String CAT = "CAT";
 
-    @Value("${server.task_stop_url_cat}")
-    private String task_stop_url;
-
     @Autowired
     private AlgorithmConfigTrackServiceImpl algorithmConfigTrackService;
     @Autowired
@@ -84,6 +78,47 @@ public class TrackSequenceServiceImpl extends BaseServiceImpl<TrackSequenceMappe
     @Resource
     private TrackSequenceMapper trackSequenceMapper;
 
+    public String getTrainInputPath(SysOssVo ossEntity) {
+        return getUnZipDirPath(ossEntity);
+    }
+
+    public String getTrainOutputPath(TrackSequence entity, SysOssVo ossEntity) {
+        String resourcePath = getResourcePath(ossEntity);
+        Path path = Paths.get(resourcePath);
+        Path outputPath = path.resolveSibling(entity.getId().toString() + BizConstant.TARGET_DETECTION_SUFFIX);
+        return outputPath.toString();
+    }
+
+
+    public String getPredictInputPath(SysOssVo ossEntity) {
+        // todo
+        return getUnZipDirPath(ossEntity);
+    }
+
+    public String getPredictOutputPath(TrackSequence entity, SysOssVo ossEntity) {
+        // todo
+        String resourcePath = getResourcePath(ossEntity);
+        Path path = Paths.get(resourcePath);
+        Path outputPath = path.resolveSibling(entity.getId().toString() + BizConstant.TARGET_DETECTION_SUFFIX);
+        return outputPath.toString();
+    }
+
+    public String getTestInputPath(SysOssVo ossEntity) {
+        // todo
+        return getUnZipDirPath(ossEntity);
+    }
+
+    public String getTestOutputPath(TrackSequence entity, SysOssVo ossEntity) {
+        // todo
+        return getUnZipDirPath(ossEntity) + File.separator + BizConstant.TO_INFRARED_PREDICT_OUTPUT_DIR;
+    }
+
+    private String getModelPath(TrackSequence entity) {
+        AlgorithmModelTrack algorithmModelTrack = algorithmModelTrackService.getById(entity.getAlgorithmModelId());
+        return algorithmModelTrack.getModelAddress();
+    }
+
+
     @Override
     public QueryWrapper query() {
         return super.query().from(TRACK_SEQUENCE);
@@ -145,30 +180,18 @@ public class TrackSequenceServiceImpl extends BaseServiceImpl<TrackSequenceMappe
         Page<TrackSequenceVo> page = this.pageAs(PageQuery.build(), queryWrapper, TrackSequenceVo.class);
         page.getRecords().forEach(entity -> {
             Long modelId = entity.getAlgorithmModelId();
-            Long algorithmId = entity.getAlgorithmId();
-            if (modelId != null) {
-                AlgorithmModelTrackVo model = algorithmModelTrackService.selectById(modelId);
-                if (ObjectUtil.isNotNull(model)) {
-                    entity.setModelName(model.getModelName());
-                }
+            if (ObjectUtil.isNotNull(modelId)) {
+                AlgorithmModelTrack model = algorithmModelTrackService.getById(modelId);
+                entity.setModelName(model.getModelName());
+
             }
-            if (algorithmId != null) {
+
+            Long algorithmId = entity.getAlgorithmId();
+            if (ObjectUtil.isNotNull(algorithmId)) {
                 AlgorithmConfigTrackVo config = algorithmConfigTrackService.selectById(algorithmId);
-                if (ObjectUtil.isNotNull(config)) {
-                    entity.setType(config.getType());
-                    entity.setSubsystem(config.getSubsystem());
-                    entity.setAlgorithmName(config.getAlgorithmName());
-                }
-            } else {
-                AlgorithmModelTrackVo model = algorithmModelTrackService.selectById(modelId);
-                if (ObjectUtil.isNotNull(model)) {
-                    AlgorithmConfigTrackVo config = algorithmConfigTrackService.selectById(model.getAlgorithmId());
-                    if (ObjectUtil.isNotNull(config)) {
-                        entity.setType(config.getType());
-                        entity.setSubsystem(config.getSubsystem());
-                        entity.setAlgorithmName(config.getAlgorithmName());
-                    }
-                }
+                entity.setType(config.getType());
+                entity.setSubsystem(config.getSubsystem());
+                entity.setAlgorithmName(config.getAlgorithmName());
             }
         });
         page.getRecords().sort(Comparator.comparing(TrackSequenceVo::getCreateTime).reversed());
@@ -178,67 +201,111 @@ public class TrackSequenceServiceImpl extends BaseServiceImpl<TrackSequenceMappe
     /**
      * 新增注视轨迹序列
      *
-     * @param trackSequenceBo 注视轨迹序列Bo
+     * @param entityBo 注视轨迹序列Bo
      * @return 结果:true 操作成功,false 操作失败
      */
     @Override
-    public CommonResult insert(TrackSequenceBo trackSequenceBo) {
-        // 检查任务名称
-        if (ObjectUtil.isEmpty(trackSequenceBo.getName()) || (!trackSequenceBo.getName().startsWith(MASC) && !trackSequenceBo.getName().startsWith(CAT))) {
-            return CommonResult.fail("任务命名错误,需以MASC或CAT开头!");
-        }
-
+    public CommonResult insert(TrackSequenceBo entityBo) {
         // 检查input_oss_id是否存在
-        if (ObjectUtil.isNull(trackSequenceBo.getInputOssId())) {
-            return CommonResult.fail("请上传模型");
+        if (ObjectUtil.isNull(entityBo.getInputOssId())) {
+            return CommonResult.fail("上传文件不能为空");
         }
 
-        SysOssVo ossEntity = ossService.getById(trackSequenceBo.getInputOssId());
+        SysOssVo ossEntity = ossService.getById(entityBo.getInputOssId());
         if (ObjectUtil.isNull(ossEntity)) {
-            return CommonResult.fail("找不到指定模型!");
+            return CommonResult.fail("oss文件不存在");
         }
 
-        if (trackSequenceBo.getName().startsWith(MASC)) {
-            if (ObjectUtil.isEmpty(trackSequenceBo.getAlgorithmId())) {
-                return CommonResult.fail("请指定算法!");
-            }
-
-            AlgorithmConfigTrackVo config = algorithmConfigTrackService.selectById(trackSequenceBo.getAlgorithmId());
-            if (ObjectUtil.isNull(config)) {
-                return CommonResult.fail("找不到指定的算法!");
-            }
+        TrackSequence entity = new TrackSequence();
+        entity.setInputOssId(entityBo.getInputOssId());
+        entity.setUrl(ossEntity.getUrl());
+        entity.setZipFilePath(ossEntity.getFileName());
+        entity.setName(entityBo.getName());
+        entity.setStatus(NOT_START);
+        entity.setRemarks(entityBo.getRemarks());
+        entity.setAlgorithmModelId(entityBo.getAlgorithmModelId());
+        entity.setAlgorithmId(entityBo.getAlgorithmId());
+        boolean flag = this.save(entity);
+
+        if (!flag) {
+            return CommonResult.fail("新增失败");
         }
 
-        TrackSequence trackSequence = new TrackSequence();
-
-        BeanUtils.copyProperties(trackSequenceBo, trackSequence);
+        entity = updateEntity(entity, entityBo, ossEntity);
 
-        trackSequence.setUrl(ossEntity.getUrl());
+        // 步骤 6. 保存算法参数到数据库
+        boolean __ = this.updateById(entity);// 使用全局配置的雪花算法主键生成器生成ID值
+        if (__) {
+            return CommonResult.success();
+        } else {
+            return CommonResult.fail();
+        }
+    }
 
-        String filePath = ossEntity.getFileName();
-        String localPath = TaaisConfig.getProfile();
-        String resourcePath = localPath + StringUtils.substringAfter(filePath, Constants.RESOURCE_PREFIX);
-        trackSequence.setInputPath(resourcePath);
+    private TrackSequence updateEntity(TrackSequence entity, TrackSequenceBo entityBo, SysOssVo ossEntity) {
+        // 从这里开始,配置任务的algorithm_parameters参数
+        // 步骤 1. 首先根据算法id获取算法配置
+        AlgorithmConfigTrack algorithmConfig = algorithmConfigTrackService.getById(entity.getAlgorithmId());
+        if (ObjectUtil.isNull(algorithmConfig)) {
+            throw new RuntimeException("算法配置参数为空");
+        }
 
-        String fileName = StringUtils.substringAfterLast(filePath, "/");
-        String fileName_without_suffix = removeFileExtension(fileName);
+        Map<String, Object> algorithmParameters = getAlgorithmParameters(algorithmConfig.getParameters(), entityBo.getOtherParams());
+
+        // 步骤4. 构造可以直接传给前端的map数据结构
+        Map<String, Object> result = new HashMap<>();
+
+        result.put("biz_id", entity.getId());
+        result.put("biz_type", BizConstant.BizType.TRACK_SEQUENCE);
+
+        if (algorithmConfig.getType().equals(BizConstant.AlgorithmType.TRAIN)) {
+            String source_dir = getTrainInputPath(ossEntity);
+            String result_dir = getTrainOutputPath(entity, ossEntity);
+            String log_path = getLogFilePath(result_dir, entity.getId(), BizConstant.TRACK_SEQUENCE_SUFFIX);
+            result.put("source_dir", source_dir);
+            result.put("result_dir", result_dir);
+            result.put("log_path", log_path);
+        } else if (algorithmConfig.getType().equals(BizConstant.AlgorithmType.REASONING)) {
+            String source_dir = getPredictInputPath(ossEntity);
+            String result_dir = getPredictOutputPath(entity, ossEntity);
+            String log_path = getLogFilePath(result_dir, entity.getId(), BizConstant.TRACK_SEQUENCE_SUFFIX);
+            String model_path = getModelPath(entity);
+            result.put("source_dir", source_dir);
+            result.put("result_dir", result_dir);
+            result.put("log_path", log_path);
+            result.put("model_path", model_path);
+        } else if (algorithmConfig.getType().equals(BizConstant.AlgorithmType.TEST)) {
+            String source_dir = getTestInputPath(ossEntity);
+            String result_dir = getTestOutputPath(entity, ossEntity);
+            String log_path = getLogFilePath(result_dir, entity.getId(), BizConstant.TO_INFRARED_SUFFIX);
+            result.put("source_dir", source_dir);
+            result.put("result_dir", result_dir);
+            result.put("log_path", log_path);
+        } else {
+            throw new RuntimeException("算法类型错误");
+        }
 
-        Path path = Paths.get(resourcePath);
-        Path outPath = path.resolveSibling(fileName_without_suffix + "_images" + System.currentTimeMillis());
-        trackSequence.setOutputPath(outPath.toString());
+        result.put("otherParams", algorithmParameters);
 
-        trackSequence.setZipFilePath(path.resolveSibling(fileName_without_suffix + ".zip").toString());
-        trackSequence.setStatus(NOT_START);
+        entity.setInputPath((String) result.get("source_dir"));
+        entity.setOutputPath((String) result.get("result_dir"));
+        entity.setLogPath((String) result.get("log_path"));
+        // 步骤 5. 将算法参数map序列化为json字符串,保存到数据库中
+        entity.setAlgorithmParameters(JsonUtils.toJsonString(result));
 
+        makeDir(entity.getInputPath());
+        makeDir(entity.getOutputPath());
 
-        boolean __ = this.save(trackSequence);// 使用全局配置的雪花算法主键生成器生成ID值
-        if (__) {
-            return CommonResult.success();
-        } else {
-            return CommonResult.fail();
+        File file = new File(entity.getInputPath());
+        if (!file.exists()) {
+            String resourcePath = getResourcePath(ossService.getById(entity.getInputOssId()));
+            ZipUtils.unzip(resourcePath, entity.getInputPath());
         }
+
+        return entity;
     }
 
+
     /**
      * 修改注视轨迹序列
      *
@@ -247,9 +314,17 @@ public class TrackSequenceServiceImpl extends BaseServiceImpl<TrackSequenceMappe
      */
     @Override
     public boolean update(TrackSequenceBo trackSequenceBo) {
-        TrackSequence trackSequence = MapstructUtils.convert(trackSequenceBo, TrackSequence.class);
-        if (ObjectUtil.isNotNull(trackSequence) && ObjectUtil.isNotNull(trackSequence.getId())) {
-            boolean updated = this.updateById(trackSequence);
+        TrackSequence entity = MapstructUtils.convert(trackSequenceBo, TrackSequence.class);
+
+        SysOssVo ossEntity = ossService.getById(trackSequenceBo.getInputOssId());
+        if (ObjectUtil.isNull(ossEntity)) {
+            throw new RuntimeException("oss文件不存在");
+        }
+
+        entity = updateEntity(entity, trackSequenceBo, ossEntity);
+
+        if (ObjectUtil.isNotNull(entity) && ObjectUtil.isNotNull(entity.getId())) {
+            boolean updated = this.updateById(entity);
             return updated;
         }
         return false;
@@ -269,138 +344,13 @@ public class TrackSequenceServiceImpl extends BaseServiceImpl<TrackSequenceMappe
 
     @Override
     public CommonResult start(Long id) {
-        /*
-         * WANGKANG 望维护此代码的后来者安息。
-         *
-         * 不是我想写这么恶心,只是没办法,算法端的逻辑写的跟屎一样。。。。
-         */
         TrackSequence entity = getById(id);
-        AlgorithmModelTrack algorithmModelTrack = algorithmModelTrackService.getById(entity.getAlgorithmModelId());
-        AlgorithmConfigTrack algorithmConfigTrack = null;
-        try {
-            algorithmConfigTrack = algorithmConfigTrackService.getById(entity.getAlgorithmId());
-        } catch (Exception e) {
-            algorithmConfigTrack = algorithmConfigTrackService.getById(algorithmModelTrack.getAlgorithmId());
-        }
-
-        StartTaskConfig startTaskConfig = new StartTaskConfig();
-
-        if (algorithmConfigTrack.getType().equals(BizConstant.AlgorithmType.TEST) && (entity.getName().startsWith(MASC) || entity.getName().startsWith(CAT))) {
-            startTaskConfig.setBizType(BizConstant.BizType.TRACK_SEQUENCE);
-            startTaskConfig.setBizId(entity.getId());
+        entity.setStartTime(new Date());
 
-            startTaskConfig.setOtherParams(algorithmConfigTrack.getParameterConfig());
+        AlgorithmConfigTrack algorithmConfigTrack = algorithmConfigTrackService.getById(entity.getAlgorithmId());
+        Map<String, Object> startTaskConfig = JsonUtils.parseMap(entity.getAlgorithmParameters());
 
-            startTaskConfig.setSource_dir(entity.getInputPath());
-            startTaskConfig.setResult_dir(entity.getOutputPath());
-            startTaskConfig.setLog_path(entity.getOutputPath() + File.separator + getLogFileName(entity));
-        } else {
-            SysOssVo inputOssEntity = ossService.getById(entity.getInputOssId());
-
-            String filePath = inputOssEntity.getFileName();
-            String localPath = TaaisConfig.getProfile();
-            String resourcePath = localPath + StringUtils.substringAfter(filePath, Constants.RESOURCE_PREFIX);
-
-            String fileName = StringUtils.substringAfterLast(filePath, "/");
-            String fileName_without_suffix = removeFileExtension(fileName);
-
-            Path path = Paths.get(resourcePath);
-            Path inputPath = path.resolveSibling(fileName_without_suffix + BizConstant.UNZIP_SUFFIX);
-            Path outputPath = path.resolveSibling(entity.getId().toString() + BizConstant.TRACK_SEQUENCE_SUFFIX);
-
-//        makeDir(inputPath.toString());
-            makeDir(outputPath.toString());
-
-            File file = new File(inputPath.toString());
-            if (!file.exists()) {
-                ZipUtils.unzip(resourcePath, inputPath.toString());
-            }
-
-            entity.setInputPath(inputPath.toString());
-            entity.setOutputPath(outputPath.toString());
-
-            entity.setStartTime(new Date());
-
-            startTaskConfig.setBizType(BizConstant.BizType.TRACK_SEQUENCE);
-            startTaskConfig.setBizId(entity.getId());
-
-            startTaskConfig.setOtherParams(algorithmConfigTrack.getParameterConfig());
-
-            startTaskConfig.setSource_dir(entity.getInputPath());
-            startTaskConfig.setResult_dir(entity.getOutputPath());
-            startTaskConfig.setLog_path(entity.getOutputPath() + File.separator + getLogFileName(entity));
-
-            if (BizConstant.AlgorithmType.REASONING.equals(algorithmConfigTrack.getType())) {
-                String modelPath = algorithmModelTrack.getModelAddress();
-                startTaskConfig.setModel_path(modelPath);
-                if (entity.getName().startsWith(CAT)) {
-                    startTaskConfig.setSource_dir(startTaskConfig.getSource_dir());
-//                    File file________ = new File(startTaskConfig.getSource_dir());
-//                    if (!file________.exists()) {
-//                        return CommonResult.fail("数据集为空!");
-//                    }
-//                    if (file________.listFiles() != null && file________.listFiles().length > 0) {
-//                        for (File file___________________tmp : file________.listFiles()) {
-//                            if (file___________________tmp.isDirectory()) {
-//                                startTaskConfig.setSource_dir(file___________________tmp.getPath());
-//                                break;
-//                            }
-//                        }
-//                    }
-
-                    File file___________________________ = new File(startTaskConfig.getModel_path());
-                    if (!file___________________________.exists()) {
-                        return CommonResult.fail("模型不存在!");
-                    }
-                    if (file___________________________.listFiles() != null && file___________________________.listFiles().length > 0) {
-                        for (File file___________________tmp : file___________________________.listFiles()) {
-                            if (file___________________tmp.isDirectory()) {
-                                startTaskConfig.setModel_path(file___________________tmp.getPath());
-                                break;
-                            }
-                        }
-                    }
-                }
-//            if (algorithmModelTrack.getModelName().startsWith("masc") || algorithmModelTrack.getModelName().startsWith("MASC")) {
-//                String modelPath = algorithmModelTrack.getModelAddress() + File.separator + algorithmModelTrack.getModelName().substring(5);
-//                startTaskConfig.setModel_path(modelPath);
-//            } else if (algorithmModelTrack.getModelName().startsWith("cat") || algorithmModelTrack.getModelName().startsWith("CAT")) {
-//                String modelPath = algorithmModelTrack.getModelAddress();
-//                startTaskConfig.setModel_path(modelPath);
-//            } else {
-//                return CommonResult.fail("模型命名失败,请以MASC或CAT开头命名模型");
-//            }
-            } else if (BizConstant.AlgorithmType.TRAIN.equals(algorithmConfigTrack.getType()) && entity.getName().startsWith(CAT)) {
-                File file________ = new File(startTaskConfig.getSource_dir());
-                if (!file________.exists()) {
-                    return CommonResult.fail("数据集为空!");
-                }
-                boolean flag = false;
-                if (file________.listFiles() != null && file________.listFiles().length > 0) {
-                    for (File file___________________tmp : file________.listFiles()) {
-                        if (file___________________tmp.isDirectory()) {
-                            startTaskConfig.setSource_dir(file___________________tmp.getPath());
-                            flag = true;
-//                            if (file___________________tmp.listFiles() != null && file___________________tmp.listFiles().length > 0) {
-//                                for (File file________________________________________________________________________________________ : file___________________tmp.listFiles()) {
-//                                    if (file________________________________________________________________________________________.isDirectory() &&
-//                                        file________________________________________________________________________________________.getName().equals("images")) {
-//                                        startTaskConfig.setSource_dir(file________________________________________________________________________________________.getPath());
-//                                        flag = true;
-//                                        break;
-//                                    }
-//                                }
-//                            }
-//                            break;
-                        }
-                    }
-                }
-                if (!(flag && !false && (1 != 2) && (1 == 1))) {
-                    return CommonResult.fail("数据集错误!!!!!!");
-                }
-            }
-        }
-        HttpResponseEntity responseEntity = sendPostMsg(algorithmConfigTrack.getAlgorithmAddress(), startTaskConfig);
+        HttpResponseEntity responseEntity = sendPostMsg(algorithmConfigTrack.getStartApi(), startTaskConfig);
         if (ObjectUtil.isNotNull(responseEntity) && responseEntity.getStatus() == 200) {
             entity.setStatus(BizConstant.VideoStatus.RUNNING);
             updateById(entity);
@@ -420,7 +370,9 @@ public class TrackSequenceServiceImpl extends BaseServiceImpl<TrackSequenceMappe
         startTaskConfig.setBizType(BizConstant.BizType.TRACK_SEQUENCE);
         startTaskConfig.setBizId(entity.getId());
 
-        HttpResponseEntity responseEntity = sendPostMsg(task_stop_url, startTaskConfig);
+        AlgorithmConfigTrack algorithmConfigTrack = algorithmConfigTrackService.getById(entity.getAlgorithmId());
+
+        HttpResponseEntity responseEntity = sendPostMsg(algorithmConfigTrack.getTerminateApi(), startTaskConfig);
         if (ObjectUtil.isNotNull(responseEntity) && responseEntity.getStatus() == 200) {
             entity.setStatus(BizConstant.VideoStatus.INTERRUPTED);
             updateById(entity);