Răsfoiți Sursa

feat: 目标检测优化搞定

WANGKANG 8 luni în urmă
părinte
comite
c64b6a7e0a

+ 4 - 0
src/api/modules/demo/TargetDetection.ts

@@ -89,3 +89,7 @@ export const dowloadTargetDetectionApi = (id: string | number): Promise<any> =>
 export const getLogTargetDetectionApi = (id: string | number) => {
   return http.get('/demo/TargetDetection/log/' + id, {}, { loading: false })
 }
+
+export const showTargetDetectionModelApi = (id: string | number) => {
+  return http.get('/demo/TargetDetection/model/' + id, {}, { loading: false })
+}

+ 142 - 13
src/views/demo/TargetDetection/index.vue

@@ -25,7 +25,7 @@
       <template #operation="scope">
         <el-button type="primary" link icon="View" v-if="scope.row.algorithmModelId != null" @click="openModelDialog(scope.row)">
           <!--@click="openStartDialog(scope.row)"  -->
-          模型
+          详情
         </el-button>
         <el-button
           type="primary"
@@ -62,6 +62,16 @@
         >
           下载
         </el-button>
+        <el-button
+          type="primary"
+          link
+          icon="View"
+          v-auth="['demo:ToInfrared:download']"
+          v-if="scope.row.status == '2' && scope.row.type == AlgorithmType2['训练']"
+          @click="showModelDialog(scope.row.id)"
+        >
+          模型
+        </el-button>
         <!--        <el-button-->
         <!--          type="primary"-->
         <!--          link-->
@@ -88,11 +98,38 @@
     <FormDialog ref="formDialogRef" />
     <ImportExcel ref="dialogRef" />
     <ViewLog ref="viewLogRef" :get-log-api="getLogTargetDetectionApi" />
+    <el-dialog v-model="showModelDialogVisible" title="模型列表" width="1000">
+      <el-scrollbar ref="scrollbarRef" id="scrollbarRef1" height="500px">
+        <template v-for="model in model_list" :key="model">
+          <el-card style="width: 100%; margin-bottom: 10px">
+            <el-form label-width="130px" label-position="left">
+              <el-form-item label="Model Name">
+                {{ model.name }}
+              </el-form-item>
+              <el-form-item label="Model Path">
+                {{ model.path }}
+              </el-form-item>
+              <el-form-item label="Model Size">
+                {{ model.size }}
+              </el-form-item>
+              <el-form-item label="操作">
+                <el-link :href="model.url" type="primary" icon="Download" :underline="false" target="_blank" style="margin-right: 20px"
+                  >下载
+                </el-link>
+                <el-button type="success" link @click="addModel(model.path, model.name)"
+                  ><el-icon><Plus /></el-icon>添加模型</el-button
+                >
+              </el-form-item>
+            </el-form>
+          </el-card>
+        </template>
+      </el-scrollbar>
+    </el-dialog>
   </div>
 </template>
 
 <script setup lang="tsx" name="TargetDetection">
-import { ref, reactive, onMounted } from 'vue'
+import { ref, reactive, onMounted, Ref } from 'vue'
 import { useHandleData } from '@/hooks/useHandleData'
 import { useDownload } from '@/hooks/useDownload'
 import { ElMessage, ElMessageBox } from 'element-plus'
@@ -112,7 +149,8 @@ import {
   startTargetDetectionApi,
   dowloadTargetDetectionApi,
   stopTargetDetectionApi,
-  getLogTargetDetectionApi
+  getLogTargetDetectionApi,
+  showTargetDetectionModelApi
 } from '@/api/modules/demo/TargetDetection'
 
 import { listDataSeqApi } from '@/api/modules/demo/DataSeq'
@@ -121,6 +159,102 @@ import { enumAlgorithmModelTrackApi, getAlgorithmModelTrackApi } from '@/api/mod
 import { enumAlgorithmConfigTrackApi } from '@/api/modules/demo/AlgorithmConfigTrack'
 import { updateTrackSequenceApi } from '@/api/modules/demo/trackSequence'
 import ViewLog from '@/views/demo/components/ViewLog.vue'
+import { AlgorithmType2 } from '@/views/demo/utils'
+import { addAlgorithmModelTrackApi } from '@/api/modules/demo/AlgorithmModelTrack'
+
+const enumsAlgorithmConfigTrack = ref<any>([])
+onMounted(async () => {
+  const result = await enumAlgorithmConfigTrackApi()
+  enumsAlgorithmConfigTrack.value = []
+  const tmp_data: any = result['data']
+  for (const item of tmp_data) {
+    if (item.subsystem === SubSystem__['目标检测'] && item.type === AlgorithmType2['预测/推理']) {
+      item['label'] = item['label'] + '-' + SubSystem[item['subsystem']] + '-' + AlgorithmType[item['type']]
+      enumsAlgorithmConfigTrack.value.push(item)
+    }
+  }
+})
+
+const setItemsOptions222 = () => {
+  itemsOptions = [
+    {
+      label: '算法',
+      prop: 'algorithmId',
+      rules: [{ required: true, message: '算法不能为空', trigger: 'blur' }],
+      compOptions: {
+        elTagName: 'select',
+        placeholder: '请输入算法',
+        enum: enumsAlgorithmConfigTrack
+      }
+    },
+    {
+      label: '子系统',
+      prop: 'subSystem',
+      rules: [{ required: true, message: '子系统不能为空', trigger: 'blur' }],
+      compOptions: {
+        disabled: true,
+        elTagName: 'select',
+        placeholder: '请输入子系统',
+        enum: enumsSubSystem
+      }
+    },
+    {
+      label: '模型名称',
+      prop: 'modelName',
+      rules: [{ required: true, message: '模型名称不能为空', trigger: 'blur' }],
+      compOptions: {
+        disabled: true,
+        placeholder: '请输入模型名称'
+      }
+    },
+    {
+      label: '模型路径',
+      prop: 'modelPath',
+      rules: [{ required: false, message: '模型文件不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入模型名称',
+        disabled: true
+      }
+    },
+    {
+      label: '备注',
+      prop: 'remarks',
+      rules: [{ required: false, message: '备注不能为空', trigger: 'blur' }],
+      compOptions: {
+        placeholder: '请输入备注'
+      }
+    }
+  ]
+}
+
+const addModel = async (modelPath: string, modelName: string) => {
+  console.log(modelPath, modelName)
+  let res = { data: { modelPath, subSystem: SubSystem__['可见光转红外'], type: AlgorithmType2['预测/推理'], modelName: modelName } }
+  // 重置表单
+  setItemsOptions222()
+  const params = {
+    title: '添加模型',
+    width: 580,
+    isEdit: true,
+    itemsOptions: itemsOptions,
+    model: res.data,
+    api: addAlgorithmModelTrackApi,
+    getTableList: proTable.value?.getTableList,
+    closedEvent: async () => {
+      await updateWnumsAlgorithmModelTrack()
+    }
+  }
+  formDialogRef.value?.openDialog(params)
+}
+
+const showModelDialogVisible = ref(false)
+const model_list: Ref<any> = ref([])
+
+const showModelDialog = async (id: any) => {
+  const res: any = await showTargetDetectionModelApi(id)
+  model_list.value = res.data
+  showModelDialogVisible.value = true
+}
 
 const viewLogRef = ref()
 
@@ -151,15 +285,6 @@ const startTargetDetection = async (params: any) => {
   proTable.value?.getTableList()
 }
 
-const enumsAlgorithmConfigTrack = ref<any>([])
-onMounted(async () => {
-  const result = await enumAlgorithmConfigTrackApi()
-  // console.log(result)
-  // console.log(result['data'])
-  enumsAlgorithmConfigTrack.value = result['data']
-  return result['data']
-})
-
 const openModelDialog = async row => {
   const algorithmModelId = row.algorithmModelId
   const result: any = await getAlgorithmModelTrackApi(algorithmModelId)
@@ -344,7 +469,7 @@ onMounted(async () => {
 
 const enumsAlgorithmModelTrack = ref<any>([])
 
-onMounted(async () => {
+const updateWnumsAlgorithmModelTrack = async () => {
   const result: any = await enumAlgorithmModelTrackApi()
   // console.log(result.data);
   enumsAlgorithmModelTrack.value = []
@@ -355,6 +480,10 @@ onMounted(async () => {
       enumsAlgorithmModelTrack.value.push(item)
     }
   }
+}
+
+onMounted(async () => {
+  updateWnumsAlgorithmModelTrack()
 })
 
 // 表单配置项

+ 0 - 1
src/views/demo/toInfrared/index.vue

@@ -185,7 +185,6 @@ onMounted(async () => {
       enumsAlgorithmConfigTrack.value.push(item)
     }
   }
-  return result['data']
 })
 
 const setItemsOptions222 = () => {