28968 пре 7 месеци
родитељ
комит
6c74e4b522
2 измењених фајлова са 238 додато и 27 уклоњено
  1. 137 10
      src/views/demo/dataAugmentation/index.vue
  2. 101 17
      src/views/demo/targetTrack/index.vue

+ 137 - 10
src/views/demo/dataAugmentation/index.vue

@@ -543,17 +543,144 @@ const addParams = params => {
     const obj: { [key: string]: number } = JSON.parse(validJsonString)
     Object.keys(obj).forEach(key => {
       model.value[key] = obj[key]
+      if (key === 'ratio_mix' || key === 'alpha') {
+        itemsOptions.push({
+          label: key,
+          prop: key,
+          rules: [
+            {
+              trigger: 'change',
+              validator: (rule, value, callback) => {
+                if (value === '' || value === undefined) {
+                  return callback()
+                }
+                if (!value) {
+                  return callback(new Error('请输入一个0到1之间的浮点数'))
+                }
+                const regex = /^(0(\.\d+)?|1(\.0+)?)$/
+                if (!regex.test(value)) {
+                  return callback(new Error('请输入一个0到1之间的浮点数'))
+                }
+                callback()
+              }
+            }
+          ],
+          compOptions: {
+            type: 'input',
+            clearable: true,
+            placeholder: '默认值为' + obj[key]
+          }
+        })
+      } else if (key === 'light') {
+        itemsOptions.push({
+          label: key,
+          prop: key,
+          rules: [
+            {
+              trigger: 'change',
+              validator: (rule, value, callback) => {
+                if (value === '' || value === undefined) {
+                  return callback()
+                }
+                const minValue = 40
+                const maxValue = 60
 
-      itemsOptions.push({
-        label: key,
-        prop: key,
-        rules: [{ trigger: 'blur' }],
-        compOptions: {
-          type: 'input',
-          clearable: true,
-          placeholder: '默认值为' + obj[key]
-        }
-      })
+                const intValue = parseInt(value, 10)
+                if (isNaN(intValue) || intValue < minValue || intValue > maxValue) {
+                  return callback(new Error('请输入一个40到60之间的整数'))
+                }
+                callback()
+              }
+            }
+          ],
+          compOptions: {
+            type: 'input',
+            clearable: true,
+            placeholder: '默认值为' + obj[key]
+          }
+        })
+      } else if (key === 'beta') {
+        itemsOptions.push({
+          label: key,
+          prop: key,
+          rules: [
+            {
+              trigger: 'change',
+              validator: (rule, value, callback) => {
+                if (value === '' || value === undefined) {
+                  return callback()
+                }
+                const minValue = -30
+                const maxValue = -10
+
+                const intValue = parseInt(value, 10)
+                if (isNaN(intValue) || intValue < minValue || intValue > maxValue) {
+                  return callback(new Error('请输入一个-30到-10之间的负整数'))
+                }
+                callback()
+              }
+            }
+          ],
+          compOptions: {
+            type: 'input',
+            clearable: true,
+            placeholder: '默认值为' + obj[key]
+          }
+        })
+      } else if (key === 'beta') {
+        itemsOptions.push({
+          label: key,
+          prop: key,
+          rules: [
+            {
+              trigger: 'change',
+              validator: (rule, value, callback) => {
+                if (value === '' || value === undefined) {
+                  return callback()
+                }
+                const minValue = -30
+                const maxValue = -10
+
+                const intValue = parseInt(value, 10)
+                if (isNaN(intValue) || intValue < minValue || intValue > maxValue) {
+                  return callback(new Error('请输入一个-30到-10之间的负整数'))
+                }
+                callback()
+              }
+            }
+          ],
+          compOptions: {
+            type: 'input',
+            clearable: true,
+            placeholder: '默认值为' + obj[key]
+          }
+        })
+      } else if (key === 's_v') {
+        itemsOptions.push({
+          label: key,
+          prop: key,
+          rules: [
+            {
+              trigger: 'change',
+              validator: (rule, value, callback) => {
+                if (value === '' || value === undefined) {
+                  return callback()
+                }
+                const intValue = parseInt(value, 10)
+                if (isNaN(intValue) || intValue <= 0 || intValue % 2 === 0) {
+                  return callback(new Error('请输入一个大于0的奇整数'))
+                }
+                callback()
+              }
+            }
+          ],
+          compOptions: {
+            type: 'input',
+            clearable: true,
+            placeholder: '默认值为' + obj[key]
+          }
+        })
+      }
     })
   } catch (error) {
     console.error('解析 JSON 字符串时出错:', error)

+ 101 - 17
src/views/demo/targetTrack/index.vue

@@ -63,6 +63,9 @@
             <source :src="inputVideoUrl" />
             Your browser does not support the video tag.
           </video>
+          <!-- <video-player ref="videoPlayer" :options="playerOptions" @play="onPlay" @pause="onPause" />
+          <button @click="playVideo">开始播放</button>
+          <button @click="pauseVideo">暂停播放</button> -->
         </div>
         <div style="width: 50%" v-if="outputVideoUrl">
           <video controls width="90%">
@@ -96,7 +99,6 @@ import ProTable from '@/components/ProTable/index.vue'
 import ImportExcel from '@/components/ImportExcel/index.vue'
 import ViewLog from '@/views/demo/components/ViewLog.vue'
 
-import VideoWindow from '@/views/demo/components/VideoWindow.vue'
 import DataAugmentationFormDialog from '@/components/DataAugmentationFormDialog/index.vue'
 import { ProTableInstance, ColumnProps, EnumProps } from '@/components/ProTable/interface'
 import {
@@ -117,13 +119,45 @@ import {
   getMetricApi,
   getVideoUrl
 } from '@/api/modules/demo/dataAugmentation'
-// import {  } from '@/api/modules/system/dictData'
+// import { VideoPlayer } from 'vue-video-player'
+// import 'vue-video-player/dist/simple.css'
 
-const videoWindowRef = ref()
-const playerOptions = ref({})
+// const playerOptions = ref({})
+// const videoPlayer = ref<InstanceType<typeof VideoPlayer> | null>(null);
+
+// const playVideo = () => {
+//   if (videoPlayer.value) {
+//     videoPlayer.value.player.play();
+//   }
+// };
+
+// const pauseVideo = () => {
+//   if (videoPlayer.value) {
+//     videoPlayer.value.player.pause();
+//   }
+// };
+
+// const onPlay = () => {
+//   console.log('视频开始播放');
+// };
+
+// const onPause = () => {
+//   console.log('视频暂停播放');
+// };
+// const setPlayerOptions = (url) => {
+
+//   playerOptions.value = {
+//     sources: [{
+//       type: "video/mp4",
+//       src: url
+//     }],
+//     poster: "", // 视频封面图
+//     autoplay: false,
+//     controls: true,
+//     fluid: true // 响应式布局
+//   }
+// }
 
-const url = 'https://cdn.theguardian.tv/webM/2015/07/20/150716YesMen_synd_768k_vp8.webm'
-//const url = "https://v17.dogevideo.com/vcloud/17/v/20190424/1556036075_818c4125ec9c8cbc7a7a8a7cc1601512/1037/7d515b22c4958598c0fbd1e6290a5ca5.mp4?vkey=B561D3&tkey=17316085819fec852b94&auth_key=1731622981-omcPUa7d7Zy7svg9-1035588803-64c7aed2dc55c2766fcbb126aec1452a"
 //打开指标窗口查看算法指标信息
 const metricDialogVisible = ref(false)
 const metricList = reactive([])
@@ -141,6 +175,9 @@ const openResultDialog = async (id: string | number) => {
   const res: any = await getVideoUrl(id)
   inputVideoUrl.value = res.data.input
   outputVideoUrl.value = res.data.output
+  //setPlayerOptions(inputVideoUrl.value)
+  // inputVideoUrl.value = '/api/public/video/input/' + id
+  // outputVideoUrl.value = '/api/public/video/output/' + id
   console.log(inputVideoUrl)
   dialogVisible.value = true
 }
@@ -524,17 +561,64 @@ const addParams = (params, task_Type) => {
     const obj: { [key: string]: number } = JSON.parse(validJsonString)
     Object.keys(obj).forEach(key => {
       model.value[key] = obj[key]
-
-      itemsOptions.push({
-        label: key,
-        prop: key,
-        rules: [{ trigger: 'blur' }],
-        compOptions: {
-          type: 'input',
-          clearable: true,
-          placeholder: '默认值为' + obj[key]
-        }
-      })
+      if (key === 'conf' || key === 'iou') {
+        itemsOptions.push({
+          label: key,
+          prop: key,
+          rules: [
+            {
+              trigger: 'change',
+              validator: (rule, value, callback) => {
+                if (value === '' || value === undefined) {
+                  return callback()
+                }
+                if (!value) {
+                  return callback(new Error('请输入一个0到1之间的浮点数'))
+                }
+                const regex = /^(0(\.\d+)?|1(\.0+)?)$/
+                if (!regex.test(value)) {
+                  return callback(new Error('请输入一个0到1之间的浮点数'))
+                }
+                callback()
+              }
+            }
+          ],
+          compOptions: {
+            type: 'input',
+            clearable: true,
+            placeholder: '默认值为' + obj[key]
+          }
+        })
+      } else if (key === 'imgsz') {
+        itemsOptions.push({
+          label: key,
+          prop: key,
+          rules: [
+            {
+              trigger: 'change',
+              validator: (rule, value, callback) => {
+                //console.log(value)
+                if (value === '' || value === undefined) {
+                  return callback()
+                }
+                if (!value) {
+                  return callback(new Error('请输入一个大于0的整数'))
+                }
+                const regex = /^[1-9]\d*$/
+                if (!regex.test(value)) {
+                  return callback(new Error('请输入一个大于0的整数'))
+                }
+                callback()
+              }
+            }
+          ],
+          compOptions: {
+            type: 'input',
+            clearable: true,
+            placeholder: '默认值为' + obj[key]
+          }
+        })
+      }
     })
   } catch (error) {
     console.error('解析 JSON 字符串时出错:', error)