@@ -6,6 +6,7 @@ import json | |||||
import datetime | import datetime | ||||
import os | import os | ||||
import sys | import sys | ||||
from utils.utils import send_notifycation | |||||
def getFile(ruleFile): | def getFile(ruleFile): | ||||
if getattr(sys, 'frozen', False): | if getattr(sys, 'frozen', False): | ||||
@@ -84,8 +85,8 @@ class API: | |||||
self.net = PicoDet( | self.net = PicoDet( | ||||
get_settings_status_name(self.args,"ModelSetting","模型版本设置"), | get_settings_status_name(self.args,"ModelSetting","模型版本设置"), | ||||
self.args['classfile'], | self.args['classfile'], | ||||
prob_threshold=get_setting_status(self.args,"ModelSetting",'confThreshold'), | |||||
iou_threshold=get_setting_status(self.args,"ModelSetting",'nmsThreshold')) | |||||
prob_threshold=float(get_setting_status(self.args,"ModelSetting",'confThreshold')), | |||||
iou_threshold=float(get_setting_status(self.args,"ModelSetting",'nmsThreshold'))) | |||||
# net.detect_folder(args['img_fold'], args['result_fold']) | # net.detect_folder(args['img_fold'], args['result_fold']) | ||||
@@ -93,6 +94,8 @@ class API: | |||||
self.cap = cv2.VideoCapture(0) # 开启摄像头 | self.cap = cv2.VideoCapture(0) # 开启摄像头 | ||||
# cv2.namedWindow('Video Cam', cv2.WINDOW_NORMAL) | # cv2.namedWindow('Video Cam', cv2.WINDOW_NORMAL) | ||||
if(self.args['toggle'] and self.args['tip']): | |||||
send_notifycation("功能已开启") | |||||
@@ -2,12 +2,12 @@ | |||||
"classfile": "coco_label.txt", | "classfile": "coco_label.txt", | ||||
"img_fold": "./imgs", | "img_fold": "./imgs", | ||||
"result_fold": "results", | "result_fold": "results", | ||||
"toggle": false, | |||||
"tip": false, | |||||
"toggle": true, | |||||
"tip": true, | |||||
"control": [ | "control": [ | ||||
{ | { | ||||
"name": "嘴控", | "name": "嘴控", | ||||
"status": false | |||||
"status": true | |||||
}, | }, | ||||
{ | { | ||||
"name": "眼控", | "name": "眼控", | ||||
@@ -15,7 +15,7 @@ | |||||
}, | }, | ||||
{ | { | ||||
"name": "嘴/眼控", | "name": "嘴/眼控", | ||||
"status": true | |||||
"status": false | |||||
} | } | ||||
], | ], | ||||
"ControlSetting": [ | "ControlSetting": [ | ||||
@@ -24,7 +24,7 @@ | |||||
"status": [ | "status": [ | ||||
{ | { | ||||
"name": "开/关/开", | "name": "开/关/开", | ||||
"status": true | |||||
"status": false | |||||
}, | }, | ||||
{ | { | ||||
"name": "关/开/关", | "name": "关/开/关", | ||||
@@ -32,7 +32,7 @@ | |||||
}, | }, | ||||
{ | { | ||||
"name": "闭上持续2S", | "name": "闭上持续2S", | ||||
"status": false | |||||
"status": true | |||||
}, | }, | ||||
{ | { | ||||
"name": "张开持续2S", | "name": "张开持续2S", | ||||
@@ -69,15 +69,15 @@ | |||||
}, | }, | ||||
{ | { | ||||
"name": "置信度", | "name": "置信度", | ||||
"status": 0.5 | |||||
"status": "0.5" | |||||
}, | }, | ||||
{ | { | ||||
"name": "confThreshold", | "name": "confThreshold", | ||||
"status": 0.5 | |||||
"status": "0.5" | |||||
}, | }, | ||||
{ | { | ||||
"name": "nmsThreshold", | "name": "nmsThreshold", | ||||
"status": 0.6 | |||||
"status": "0.6" | |||||
}, | }, | ||||
{ | { | ||||
"name": "图片载入方式", | "name": "图片载入方式", | ||||
@@ -42,6 +42,5 @@ if __name__ == "__main__": | |||||
default='False', | default='False', | ||||
help="开发模式") | help="开发模式") | ||||
args = parser.parse_args() | args = parser.parse_args() | ||||
send_notifycation('EMC程序已启动') | |||||
WebViewApp(args.port,args.dev=='True') | WebViewApp(args.port,args.dev=='True') | ||||
@@ -17,6 +17,10 @@ watch(() => props.settingData, () => { | |||||
deep: true, | deep: true, | ||||
}) | }) | ||||
const handleChange = () => { | |||||
} | |||||
const { t } = useI18n() | const { t } = useI18n() | ||||
</script> | </script> | ||||
@@ -38,11 +42,13 @@ const { t } = useI18n() | |||||
</select> --> | </select> --> | ||||
<d-select v-model:options="item.status" class="select select-sm max-w-xs" /> | <d-select v-model:options="item.status" class="select select-sm max-w-xs" /> | ||||
</div> | </div> | ||||
<div v-else-if="typeof (item.status) == 'number'" class="flex justify-between mx-8 items-center"> | |||||
<div v-else class="flex justify-between mx-8 items-center"> | |||||
<div class="setting-item-title self-center flex justify-center items-center " :data-tip="item.description" :class="!!item.description ? 'tooltip tooltip-primary tooltip-right' : ''"> | <div class="setting-item-title self-center flex justify-center items-center " :data-tip="item.description" :class="!!item.description ? 'tooltip tooltip-primary tooltip-right' : ''"> | ||||
{{ t(item.name) }}<div v-if="!!item.description" i-carbon-information class="ml-1 " /> | {{ t(item.name) }}<div v-if="!!item.description" i-carbon-information class="ml-1 " /> | ||||
</div> | </div> | ||||
<input type="range" min="0" max="1" :value="item.status" class="range range-xs" step="0.05"> | |||||
<div class="tooltip tooltip-primary tooltip-left"> | |||||
<input v-model="item.status" type="range" min="0" max="1" class="range range-xs" step="0.05"> | |||||
</div> | |||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
@@ -6,23 +6,19 @@ const props = defineProps({ | |||||
}, | }, | ||||
}) | }) | ||||
const emit = defineEmits(['update:options']) | const emit = defineEmits(['update:options']) | ||||
let selectedOption = $ref(!!props.options && props.options.find(option => option.status === true)?.name) | |||||
const handleChange = () => { | |||||
props.options.forEach((option) => { | |||||
if (option.name === selectedOption) | |||||
option.status = true | |||||
else | |||||
option.status = false | |||||
const selectedOption = computed( | |||||
{ | |||||
get() { | |||||
const opt = !!props.options && props.options.find(option => option.status === true) | |||||
return opt ? opt.name : '' | |||||
}, | |||||
set(newVal) { | |||||
props.options.forEach((option) => { | |||||
option.status = option.name === newVal | |||||
}) | |||||
emit('update:options', props.options) | |||||
}, | |||||
}) | }) | ||||
emit('update:options', props.options) | |||||
} | |||||
watch(() => props.options, () => { // 无延时props不起作用 | |||||
if (selectedOption === false) | |||||
selectedOption = props.options.find(option => option.status === true).name | |||||
}, { | |||||
deep: true, | |||||
}) | |||||
</script> | </script> | ||||
<template> | <template> | ||||
@@ -8,7 +8,6 @@ const settings = reactive({ | |||||
}) | }) | ||||
const getAdvanceSetting = async () => { | const getAdvanceSetting = async () => { | ||||
[settings.ControlSetting, settings.ModelSetting, settings.otherSetting] = await window.pywebview.api.getAdvanceSetting() | [settings.ControlSetting, settings.ModelSetting, settings.otherSetting] = await window.pywebview.api.getAdvanceSetting() | ||||
console.log(settings) | |||||
} | } | ||||
watch(() => settings, async () => { | watch(() => settings, async () => { | ||||