|
@@ -124,8 +124,8 @@ import {
|
|
|
getCompareImageApiNew
|
|
|
} from '@/api/modules/demo/dataAugmentation'
|
|
|
// import { } from '@/api/modules/system/dictData'
|
|
|
-import { S } from 'vite/dist/node/types.d-aGj9QkWt'
|
|
|
-import { servicesVersion } from 'typescript'
|
|
|
+// import { S } from 'vite/dist/node/types.d-aGj9QkWt'
|
|
|
+// import { servicesVersion } from 'typescript'
|
|
|
|
|
|
const previewCompareImagesRef = ref()
|
|
|
const preview = async row => {
|
|
@@ -183,32 +183,27 @@ const openLogDialog = async (id: string | number) => {
|
|
|
logDialogVisible.value = true
|
|
|
}
|
|
|
const getTaskType = async () => {
|
|
|
- const res: any = await getTaskDictData()
|
|
|
+ const res: any = await getTaskDictData('数据增强')
|
|
|
+ console.log(res.data)
|
|
|
if (res.data.length != 0) {
|
|
|
taskType.value = res.data
|
|
|
.map(item => {
|
|
|
- if (item.taskType === '图像逆光' || item.taskType === '图像增强') {
|
|
|
- return {
|
|
|
- label: item.taskType,
|
|
|
- value: item.taskType
|
|
|
- }
|
|
|
- } else {
|
|
|
- return null
|
|
|
+ return {
|
|
|
+ label: item.taskType,
|
|
|
+ value: item.taskType
|
|
|
}
|
|
|
})
|
|
|
.filter(item => item !== null)
|
|
|
res.data.forEach(item => {
|
|
|
- if (item.taskType === '图像增强' || item.taskType === '图像逆光') {
|
|
|
- taskTypeEnums.push({
|
|
|
- label: item.taskType,
|
|
|
- value: item.taskType,
|
|
|
- disabled: false,
|
|
|
- tagType: 'default'
|
|
|
- })
|
|
|
- let obj = {}
|
|
|
- obj[item.taskType] = item.hyperparameterConfiguration
|
|
|
- hyperparameterConfiguration.push(obj)
|
|
|
- }
|
|
|
+ taskTypeEnums.push({
|
|
|
+ label: item.taskType,
|
|
|
+ value: item.taskType,
|
|
|
+ disabled: false,
|
|
|
+ tagType: 'default'
|
|
|
+ })
|
|
|
+ let obj = {}
|
|
|
+ obj[item.taskType] = item.hyperparameterConfiguration
|
|
|
+ hyperparameterConfiguration.push(obj)
|
|
|
})
|
|
|
}
|
|
|
}
|
|
@@ -553,148 +548,164 @@ const addParams = params => {
|
|
|
}
|
|
|
let validJsonString = params.replace(/'/g, '"')
|
|
|
try {
|
|
|
- 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
|
|
|
+ const obj = JSON.parse(validJsonString)
|
|
|
+ obj.forEach(param => {
|
|
|
+ model.value[param.agName] = param.defaultValue
|
|
|
+ itemsOptions.push({
|
|
|
+ // hideLabelSuffix: false,
|
|
|
+ label: param.name,
|
|
|
+ tooltip: param.prompt,
|
|
|
+ prop: param.agName,
|
|
|
+ rules: [],
|
|
|
+ compOptions: {
|
|
|
+ type: 'input',
|
|
|
+ clearable: true,
|
|
|
+ placeholder: '默认值为' + param.defaultValue
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ //console.log(obj)
|
|
|
+ // 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
|
|
|
|
|
|
- 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('请输入一个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 === '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]
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
+ // 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)
|
|
|
}
|