Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
Oil_Level_Recognition_System
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
柳青君
Oil_Level_Recognition_System
Commits
a179dd7d
Commit
a179dd7d
authored
Nov 26, 2025
by
Yuhaibo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2
parent
a4f905c9
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
78 additions
and
78 deletions
+78
-78
app.py
app.py
+8
-8
model_set_handler.py
handlers/modelpage/model_set_handler.py
+22
-22
model_training_handler.py
handlers/modelpage/model_training_handler.py
+7
-7
model_trainingworker_handler.py
handlers/modelpage/model_trainingworker_handler.py
+9
-9
convert_dat_to_cfg.py
handlers/modelpage/tools/convert_dat_to_cfg.py
+1
-1
test_bat_image_detection.py
handlers/modelpage/tools/test_bat_image_detection.py
+2
-2
test_bat_model.py
handlers/modelpage/tools/test_bat_model.py
+1
-1
test_dat_conversion.py
handlers/modelpage/tools/test_dat_conversion.py
+2
-2
test_dat_image_detection.py
handlers/modelpage/tools/test_dat_image_detection.py
+2
-2
test_pt_detection.py
handlers/modelpage/tools/test_pt_detection.py
+2
-2
missionpanel_handler.py
handlers/videopage/missionpanel_handler.py
+14
-14
model_pool_manager.py
handlers/videopage/thread_manager/model_pool_manager.py
+8
-8
No files found.
app.py
View file @
a179dd7d
...
...
@@ -1031,8 +1031,8 @@ class MainWindow(
print
(
f
"⚠️ [通道筛选] 任务配置为空: {config_file}"
)
return
[]
#
🔍
调试:打印配置文件的所有键
print
(
f
"
🔍
[通道筛选] 配置文件键: {list(task_config.keys())}"
)
# 调试:打印配置文件的所有键
print
(
f
" [通道筛选] 配置文件键: {list(task_config.keys())}"
)
# 从配置中提取使用的通道
# 配置格式可能是:selected_channels: ['通道2', '通道3'] 或 channels: ['channel1', 'channel2']
...
...
@@ -1044,7 +1044,7 @@ class MainWindow(
channel_list
=
task_config
[
'selected_channels'
]
if
isinstance
(
channel_list
,
list
):
used_channels
=
[
ch
for
ch
in
channel_list
if
isinstance
(
ch
,
str
)
and
'通道'
in
ch
]
print
(
f
"
🔍
[通道筛选] 从 selected_channels 读取: {used_channels}"
)
print
(
f
" [通道筛选] 从 selected_channels 读取: {used_channels}"
)
# 尝试其他可能的配置键名
elif
'channels'
in
task_config
:
...
...
@@ -1059,7 +1059,7 @@ class MainWindow(
used_channels
.
append
(
f
'通道{ch_num}'
)
elif
isinstance
(
ch
,
int
):
used_channels
.
append
(
f
'通道{ch}'
)
print
(
f
"
🔍
[通道筛选] 从 channels 读取: {used_channels}"
)
print
(
f
" [通道筛选] 从 channels 读取: {used_channels}"
)
elif
'channel_list'
in
task_config
:
# 格式3: channel_list: [1, 2, 3]
...
...
@@ -1067,14 +1067,14 @@ class MainWindow(
if
isinstance
(
channel_list
,
list
):
for
ch_num
in
channel_list
:
used_channels
.
append
(
f
'通道{ch_num}'
)
print
(
f
"
🔍
[通道筛选] 从 channel_list 读取: {used_channels}"
)
print
(
f
" [通道筛选] 从 channel_list 读取: {used_channels}"
)
elif
'task_channels'
in
task_config
:
# 格式4: task_channels: '通道1, 通道2'
channels_str
=
task_config
[
'task_channels'
]
if
isinstance
(
channels_str
,
str
):
used_channels
=
[
ch
.
strip
()
for
ch
in
channels_str
.
split
(
','
)]
print
(
f
"
🔍
[通道筛选] 从 task_channels 读取: {used_channels}"
)
print
(
f
" [通道筛选] 从 task_channels 读取: {used_channels}"
)
else
:
# 如果没有明确的通道配置,尝试从其他字段推断
...
...
@@ -1083,7 +1083,7 @@ class MainWindow(
if
f
'channel{i}'
in
task_config
:
used_channels
.
append
(
f
'通道{i}'
)
if
used_channels
:
print
(
f
"
🔍
[通道筛选] 从 channel 字段推断: {used_channels}"
)
print
(
f
" [通道筛选] 从 channel 字段推断: {used_channels}"
)
# 去重并排序
used_channels
=
sorted
(
list
(
set
(
used_channels
)))
...
...
@@ -1552,7 +1552,7 @@ def main():
app
.
setOrganizationName
(
'Detection'
)
# 🔥 暂时禁用全局字体配置,测试是否解决重复显示问题
print
(
f
"
🔍
[调试] 跳过全局字体应用到应用程序"
)
print
(
f
" [调试] 跳过全局字体应用到应用程序"
)
# FontManager.applyToApplication(app)
# 设置应用样式(可选)
...
...
handlers/modelpage/model_set_handler.py
View file @
a179dd7d
...
...
@@ -420,7 +420,7 @@ class ModelSetHandler:
print
(
"🚀 [模型加载] 开始加载模型列表..."
)
# 1. 加载配置文件
print
(
"
🔍
[模型加载] 步骤1: 加载配置文件"
)
print
(
" [模型加载] 步骤1: 加载配置文件"
)
config
=
self
.
_loadConfigFile
()
if
not
config
:
print
(
"❌ [模型加载] 配置文件加载失败,停止加载"
)
...
...
@@ -428,17 +428,17 @@ class ModelSetHandler:
print
(
"✅ [模型加载] 配置文件加载成功"
)
# 2. 跳过配置文件中的通道模型(只显示train_model目录下的模型)
print
(
"
🔍
[模型加载] 步骤2: 跳过配置文件中的通道模型"
)
print
(
" [模型加载] 步骤2: 跳过配置文件中的通道模型"
)
channel_models
=
[]
# 不加载通道模型
print
(
f
"✅ [模型加载] 跳过通道模型,专注于train_model目录"
)
# 3. 扫描模型目录
print
(
"
🔍
[模型加载] 步骤3: 扫描模型目录"
)
print
(
" [模型加载] 步骤3: 扫描模型目录"
)
scanned_models
=
self
.
_scanModelDirectory
()
print
(
f
"✅ [模型加载] 从目录扫描到 {len(scanned_models)} 个模型"
)
# 4. 直接使用扫描到的模型(不合并通道模型)
print
(
"
🔍
[模型加载] 步骤4: 使用扫描到的模型"
)
print
(
" [模型加载] 步骤4: 使用扫描到的模型"
)
all_models
=
scanned_models
# 直接使用扫描模型
# 设置第一个模型为默认模型(如果有模型的话)
...
...
@@ -449,7 +449,7 @@ class ModelSetHandler:
print
(
f
"✅ [模型加载] 最终显示 {len(all_models)} 个模型"
)
# 5. 更新UI
print
(
"
🔍
[模型加载] 步骤5: 更新UI显示"
)
print
(
" [模型加载] 步骤5: 更新UI显示"
)
self
.
_updateModelList
(
all_models
)
print
(
"✅ [模型加载] 模型列表加载完成"
)
...
...
@@ -543,9 +543,9 @@ class ModelSetHandler:
current_dir
=
Path
(
__file__
)
.
parent
.
parent
.
parent
model_dir
=
current_dir
/
"database"
/
"model"
/
"train_model"
print
(
f
"
🔍
[模型扫描] 项目根目录: {current_dir}"
)
print
(
f
"
🔍
[模型扫描] 模型目录路径: {model_dir}"
)
print
(
f
"
🔍
[模型扫描] 模型目录是否存在: {model_dir.exists()}"
)
print
(
f
" [模型扫描] 项目根目录: {current_dir}"
)
print
(
f
" [模型扫描] 模型目录路径: {model_dir}"
)
print
(
f
" [模型扫描] 模型目录是否存在: {model_dir.exists()}"
)
if
not
model_dir
.
exists
():
print
(
"❌ [模型扫描] 模型目录不存在,返回空列表"
)
...
...
@@ -553,23 +553,23 @@ class ModelSetHandler:
# 列出目录中的所有项目
all_items
=
list
(
model_dir
.
iterdir
())
print
(
f
"
🔍
[模型扫描] 目录中的所有项目: {[item.name for item in all_items]}"
)
print
(
f
" [模型扫描] 目录中的所有项目: {[item.name for item in all_items]}"
)
# 遍历所有子目录,并按目录名排序
sorted_subdirs
=
sorted
(
model_dir
.
iterdir
(),
key
=
lambda
x
:
x
.
name
if
x
.
is_dir
()
else
''
)
print
(
f
"
🔍
[模型扫描] 排序后的子目录: {[subdir.name for subdir in sorted_subdirs if subdir.is_dir()]}"
)
print
(
f
" [模型扫描] 排序后的子目录: {[subdir.name for subdir in sorted_subdirs if subdir.is_dir()]}"
)
for
subdir
in
sorted_subdirs
:
if
subdir
.
is_dir
():
print
(
f
"
🔍
[模型扫描] 正在扫描子目录: {subdir.name} ({subdir})"
)
print
(
f
" [模型扫描] 正在扫描子目录: {subdir.name} ({subdir})"
)
# 列出子目录中的所有文件
subdir_files
=
list
(
subdir
.
iterdir
())
print
(
f
"
🔍
[模型扫描] 子目录 {subdir.name} 中的文件: {[f.name for f in subdir_files]}"
)
print
(
f
" [模型扫描] 子目录 {subdir.name} 中的文件: {[f.name for f in subdir_files]}"
)
# 查找 .dat 文件(优先)
dat_files
=
list
(
subdir
.
glob
(
"*.dat"
))
print
(
f
"
🔍
[模型扫描] 找到的 .dat 文件: {[f.name for f in dat_files]}"
)
print
(
f
" [模型扫描] 找到的 .dat 文件: {[f.name for f in dat_files]}"
)
for
model_file
in
sorted
(
dat_files
):
model_info
=
{
...
...
@@ -584,7 +584,7 @@ class ModelSetHandler:
# 然后查找 .pt 文件
pt_files
=
list
(
subdir
.
glob
(
"*.pt"
))
print
(
f
"
🔍
[模型扫描] 找到的 .pt 文件: {[f.name for f in pt_files]}"
)
print
(
f
" [模型扫描] 找到的 .pt 文件: {[f.name for f in pt_files]}"
)
for
model_file
in
sorted
(
pt_files
):
model_info
=
{
...
...
@@ -604,7 +604,7 @@ class ModelSetHandler:
import
traceback
traceback
.
print_exc
()
print
(
f
"
🔍
[模型扫描] 扫描完成,共找到 {len(models)} 个模型"
)
print
(
f
" [模型扫描] 扫描完成,共找到 {len(models)} 个模型"
)
return
models
def
_mergeModelInfo
(
self
,
channel_models
,
scanned_models
):
...
...
@@ -612,9 +612,9 @@ class ModelSetHandler:
all_models
=
[]
seen_paths
=
set
()
print
(
f
"
🔍
[模型合并] 开始合并模型信息"
)
print
(
f
"
🔍
[模型合并] 通道模型数量: {len(channel_models)}"
)
print
(
f
"
🔍
[模型合并] 扫描模型数量: {len(scanned_models)}"
)
print
(
f
" [模型合并] 开始合并模型信息"
)
print
(
f
" [模型合并] 通道模型数量: {len(channel_models)}"
)
print
(
f
" [模型合并] 扫描模型数量: {len(scanned_models)}"
)
# 优先添加配置文件中的通道模型
for
model
in
channel_models
:
...
...
@@ -642,13 +642,13 @@ class ModelSetHandler:
all_models
[
0
][
'is_default'
]
=
True
print
(
f
"✅ [模型合并] 设置默认模型: {all_models[0]['name']}"
)
print
(
f
"
🔍
[模型合并] 合并完成,最终模型数量: {len(all_models)}"
)
print
(
f
" [模型合并] 合并完成,最终模型数量: {len(all_models)}"
)
return
all_models
def
_updateModelList
(
self
,
all_models
):
"""更新UI中的模型列表"""
try
:
print
(
f
"
🔍
[UI更新] 开始更新模型列表,模型数量: {len(all_models)}"
)
print
(
f
" [UI更新] 开始更新模型列表,模型数量: {len(all_models)}"
)
if
not
hasattr
(
self
,
'modelSetPage'
)
or
not
self
.
modelSetPage
:
print
(
"❌ [UI更新] modelSetPage 不存在,无法更新UI"
)
...
...
@@ -662,7 +662,7 @@ class ModelSetHandler:
# 添加所有模型到UI
for
i
,
model
in
enumerate
(
all_models
):
model_name
=
model
[
'name'
]
print
(
f
"
🔍
[UI更新] 处理模型 {i+1}/{len(all_models)}: {model_name}"
)
print
(
f
" [UI更新] 处理模型 {i+1}/{len(all_models)}: {model_name}"
)
# 创建模型参数
model_params
=
self
.
_createModelParams
(
model
,
{})
...
...
@@ -675,7 +675,7 @@ class ModelSetHandler:
# 刷新UI显示
if
hasattr
(
self
.
modelSetPage
,
'refreshModelList'
):
print
(
f
"
🔍
[UI更新] 调用 refreshModelList 刷新UI"
)
print
(
f
" [UI更新] 调用 refreshModelList 刷新UI"
)
self
.
modelSetPage
.
refreshModelList
()
else
:
print
(
f
"⚠️ [UI更新] modelSetPage 没有 refreshModelList 方法"
)
...
...
handlers/modelpage/model_training_handler.py
View file @
a179dd7d
...
...
@@ -2477,13 +2477,13 @@ class ModelTrainingHandler(ModelTestHandler):
if
model_path
.
endswith
(
'.dat'
):
# 解密 .dat 模型
print
(
f
"
🔍
[模型加载] 原始.dat模型路径: {model_path}"
)
print
(
f
"
🔍
[模型加载] 文件是否存在: {os.path.exists(model_path)}"
)
print
(
f
" [模型加载] 原始.dat模型路径: {model_path}"
)
print
(
f
" [模型加载] 文件是否存在: {os.path.exists(model_path)}"
)
temp_model_path
=
self
.
_decode_dat_model
(
model_path
)
print
(
f
"
🔍
[模型加载] 解密后.pt模型路径: {temp_model_path}"
)
print
(
f
"
🔍
[模型加载] 解密后文件是否存在: {os.path.exists(temp_model_path)}"
)
print
(
f
" [模型加载] 解密后.pt模型路径: {temp_model_path}"
)
print
(
f
" [模型加载] 解密后文件是否存在: {os.path.exists(temp_model_path)}"
)
# 验证解密后的模型文件存在,然后设置离线模式
if
not
os
.
path
.
exists
(
temp_model_path
):
...
...
@@ -2500,9 +2500,9 @@ class ModelTrainingHandler(ModelTestHandler):
print
(
f
"✅ [模型加载] YOLO模型加载成功"
)
else
:
# 验证模型文件存在,然后设置离线模式
print
(
f
"
🔍
[模型加载] .pt模型路径: {model_path}"
)
print
(
f
"
🔍
[模型加载] 文件是否存在: {os.path.exists(model_path)}"
)
print
(
f
"
🔍
[模型加载] 文件大小: {os.path.getsize(model_path) if os.path.exists(model_path) else 'N/A'} bytes"
)
print
(
f
" [模型加载] .pt模型路径: {model_path}"
)
print
(
f
" [模型加载] 文件是否存在: {os.path.exists(model_path)}"
)
print
(
f
" [模型加载] 文件大小: {os.path.getsize(model_path) if os.path.exists(model_path) else 'N/A'} bytes"
)
if
not
os
.
path
.
exists
(
model_path
):
raise
FileNotFoundError
(
f
"模型文件不存在: {model_path}"
)
...
...
handlers/modelpage/model_trainingworker_handler.py
View file @
a179dd7d
...
...
@@ -58,12 +58,12 @@ class TrainingWorker(QThread):
self
.
is_running
=
True
self
.
train_config
=
None
#
🔍
调试信息:显示传入的训练参数
print
(
f
"
\n
🔍
[TrainingWorker初始化] 接收到的训练参数:"
)
# 调试信息:显示传入的训练参数
print
(
f
"
\n
[TrainingWorker初始化] 接收到的训练参数:"
)
for
key
,
value
in
training_params
.
items
():
print
(
f
" {key}: {value}"
)
print
(
f
"
🔍
[TrainingWorker初始化] base_model路径: {training_params.get('base_model', 'None')}"
)
print
(
f
"
🔍
[TrainingWorker初始化] base_model文件存在: {os.path.exists(training_params.get('base_model', '')) if training_params.get('base_model') else False}"
)
print
(
f
" [TrainingWorker初始化] base_model路径: {training_params.get('base_model', 'None')}"
)
print
(
f
" [TrainingWorker初始化] base_model文件存在: {os.path.exists(training_params.get('base_model', '')) if training_params.get('base_model') else False}"
)
self
.
training_report
=
{
"status"
:
"init"
,
...
...
@@ -480,14 +480,14 @@ class TrainingWorker(QThread):
self
.
log_output
.
emit
(
"正在加载模型...
\n
"
)
try
:
#
🔍
详细调试信息
# self.log_output.emit(f"
🔍
[训练工作线程] 模型路径: {model_path}\n")
# self.log_output.emit(f"
🔍
[训练工作线程] 模型路径类型: {type(model_path)}\n")
# self.log_output.emit(f"
🔍
[训练工作线程] 文件是否存在: {os.path.exists(model_path)}\n")
# 详细调试信息
# self.log_output.emit(f" [训练工作线程] 模型路径: {model_path}\n")
# self.log_output.emit(f" [训练工作线程] 模型路径类型: {type(model_path)}\n")
# self.log_output.emit(f" [训练工作线程] 文件是否存在: {os.path.exists(model_path)}\n")
if
os
.
path
.
exists
(
model_path
):
file_size
=
os
.
path
.
getsize
(
model_path
)
self
.
log_output
.
emit
(
f
"
🔍
[训练工作线程] 文件大小: {file_size} bytes ({file_size/1024/1024:.2f} MB)
\n
"
)
self
.
log_output
.
emit
(
f
" [训练工作线程] 文件大小: {file_size} bytes ({file_size/1024/1024:.2f} MB)
\n
"
)
# 在加载模型前验证文件存在,并设置离线模式
if
not
os
.
path
.
exists
(
model_path
):
...
...
handlers/modelpage/tools/convert_dat_to_cfg.py
View file @
a179dd7d
...
...
@@ -62,7 +62,7 @@ class DatToCfgConverter:
print
(
f
"❌ 目录不存在: {directory}"
)
return
False
print
(
f
"
\n
🔍
扫描目录: {directory}"
)
print
(
f
"
\n
扫描目录: {directory}"
)
# 查找所有.dat文件
if
recursive
:
...
...
handlers/modelpage/tools/test_bat_image_detection.py
View file @
a179dd7d
...
...
@@ -32,7 +32,7 @@ class BatImageDetector:
Returns:
是否加载成功
"""
print
(
f
"
🔍
加载.bat模型: {model_path}"
)
print
(
f
" 加载.bat模型: {model_path}"
)
try
:
# 检查文件是否存在
...
...
@@ -277,7 +277,7 @@ def main():
detector
=
BatImageDetector
()
try
:
print
(
"
🔍
开始.bat模型图片检测测试"
)
print
(
" 开始.bat模型图片检测测试"
)
print
(
"="
*
50
)
# 1. 测试模型加载
...
...
handlers/modelpage/tools/test_bat_model.py
View file @
a179dd7d
...
...
@@ -34,7 +34,7 @@ class BatModelTester:
Returns:
是否加载成功
"""
print
(
f
"
🔍
测试模型加载: {model_path}"
)
print
(
f
" 测试模型加载: {model_path}"
)
try
:
# 检查文件是否存在
...
...
handlers/modelpage/tools/test_dat_conversion.py
View file @
a179dd7d
...
...
@@ -36,7 +36,7 @@ def test_dat_conversion():
print
(
f
"📁 找到 {len(test_pt_files)} 个.pt文件用于测试"
)
for
pt_file
in
test_pt_files
:
print
(
f
"
\n
🔍
测试文件: {pt_file}"
)
print
(
f
"
\n
测试文件: {pt_file}"
)
try
:
# 检查文件大小
...
...
@@ -120,7 +120,7 @@ def test_dat_loading():
print
(
f
"📁 找到 {len(dat_files)} 个.dat文件"
)
for
dat_file
in
dat_files
:
print
(
f
"
\n
🔍
测试加载: {dat_file}"
)
print
(
f
"
\n
测试加载: {dat_file}"
)
try
:
# 测试加载.dat模型(内部会自动解码)
...
...
handlers/modelpage/tools/test_dat_image_detection.py
View file @
a179dd7d
...
...
@@ -32,7 +32,7 @@ class DatImageDetector:
Returns:
是否加载成功
"""
print
(
f
"
🔍
加载.dat模型: {model_path}"
)
print
(
f
" 加载.dat模型: {model_path}"
)
try
:
# 检查文件是否存在
...
...
@@ -191,7 +191,7 @@ def main():
detector
=
DatImageDetector
()
try
:
print
(
"
🔍
开始.dat模型图片分割测试"
)
print
(
" 开始.dat模型图片分割测试"
)
print
(
"="
*
50
)
# 1. 测试模型加载
...
...
handlers/modelpage/tools/test_pt_detection.py
View file @
a179dd7d
...
...
@@ -30,7 +30,7 @@ class PtModelTester:
Returns:
是否加载成功
"""
print
(
f
"
🔍
加载.pt模型: {model_path}"
)
print
(
f
" 加载.pt模型: {model_path}"
)
try
:
# 检查文件是否存在
...
...
@@ -422,7 +422,7 @@ def main():
tester
=
PtModelTester
()
try
:
print
(
"
🔍
开始.pt模型检测测试"
)
print
(
" 开始.pt模型检测测试"
)
print
(
"="
*
50
)
# 1. 测试模型加载
...
...
handlers/videopage/missionpanel_handler.py
View file @
a179dd7d
...
...
@@ -932,7 +932,7 @@ class MissionPanelHandler:
"""
try
:
print
(
f
"
\n
{'='*60}"
)
print
(
f
"
🔍
[调试] 开始更新通道列颜色"
)
print
(
f
" [调试] 开始更新通道列颜色"
)
print
(
f
"{'='*60}"
)
# 获取所有任务的行数据
...
...
@@ -962,7 +962,7 @@ class MissionPanelHandler:
channel_current_missions
[
ch_idx
]
=
current_mission
print
(
f
"📝 [调试] {mission_var_name} = {current_mission} (类型: {type(current_mission_obj).__name__})"
)
else
:
print
(
f
"
⚪
[调试] {mission_var_name} = None"
)
print
(
f
" [调试] {mission_var_name} = None"
)
else
:
print
(
f
"❌ [调试] 没有 {mission_var_name} 属性"
)
...
...
@@ -1006,7 +1006,7 @@ class MissionPanelHandler:
else
:
# 其他情况:保持灰色(不修改颜色)
# 通道列默认就是灰色,不需要重新设置
print
(
f
"
⚪
[保持灰色] 行{row_idx} 列{col_idx} {channel_name} (检测={is_detecting}, 当前={is_current_mission})"
)
print
(
f
" [保持灰色] 行{row_idx} 列{col_idx} {channel_name} (检测={is_detecting}, 当前={is_current_mission})"
)
print
(
f
"{'='*60}"
)
print
(
f
"✅ [调试] 通道列颜色更新完成"
)
...
...
@@ -1032,7 +1032,7 @@ class MissionPanelHandler:
detect_var_name
=
f
'{channel_id}detect'
if
hasattr
(
self
,
detect_var_name
):
is_detecting
=
getattr
(
self
,
detect_var_name
,
False
)
print
(
f
"
🔍
[检测状态] {channel_id}: {detect_var_name}={is_detecting}"
)
print
(
f
" [检测状态] {channel_id}: {detect_var_name}={is_detecting}"
)
return
is_detecting
return
False
except
Exception
as
e
:
...
...
@@ -1498,7 +1498,7 @@ class MissionPanelHandler:
# 如果通道有任务且不是当前要分配的任务,记录下来
if
existing_task
and
existing_task
!=
new_task_name
:
channels_with_tasks
.
append
((
channel_key
,
existing_task
))
print
(
f
"
🔍
检测到 {channel_key} 已有任务: {existing_task}"
)
print
(
f
" 检测到 {channel_key} 已有任务: {existing_task}"
)
except
Exception
as
e
:
print
(
f
"❌ 检查通道任务失败: {e}"
)
...
...
@@ -1727,7 +1727,7 @@ class MissionPanelHandler:
status: 任务状态
"""
try
:
print
(
f
"
🔍
[调试] _updateRowColor 被调用: 行={row_index}, 状态='{status}'"
)
print
(
f
" [调试] _updateRowColor 被调用: 行={row_index}, 状态='{status}'"
)
if
not
hasattr
(
self
,
'mission_panel'
):
print
(
f
"⚠️ [调试] mission_panel不存在,退出"
)
...
...
@@ -1737,20 +1737,20 @@ class MissionPanelHandler:
# 🔥 完全使用字体管理器,不使用CSS样式表
is_gray
=
(
status
==
"未配置"
)
print
(
f
"
🔍
[调试] 设置颜色: {'灰色' if is_gray else '默认黑色'}"
)
print
(
f
" [调试] 设置颜色: {'灰色' if is_gray else '默认黑色'}"
)
# 更新所有列的字体颜色(除了按钮列)
for
col
in
range
(
table
.
columnCount
()):
# 跳过曲线按钮列
if
col
==
self
.
mission_panel
.
CURVE_BUTTON_COLUMN
:
print
(
f
"
🔍
[调试] 跳过曲线按钮列: {col}"
)
print
(
f
" [调试] 跳过曲线按钮列: {col}"
)
continue
# 检查是否已经是控件(QLabel)
widget
=
table
.
cellWidget
(
row_index
,
col
)
item
=
table
.
item
(
row_index
,
col
)
print
(
f
"
🔍
[调试] 列{col}: widget={widget is not None}, item={item is not None}"
)
print
(
f
" [调试] 列{col}: widget={widget is not None}, item={item is not None}"
)
if
widget
:
# 检查是否为高亮行(蓝色背景)
...
...
@@ -1759,7 +1759,7 @@ class MissionPanelHandler:
if
is_highlighted
:
# 如果是高亮行,保持高亮样式不变
print
(
f
"
🔍
[调试] 保持高亮样式: 列{col}"
)
print
(
f
" [调试] 保持高亮样式: 列{col}"
)
else
:
# 非高亮行,清除样式表并重新应用字体管理器
widget
.
setStyleSheet
(
""
)
# 清除所有CSS样式
...
...
@@ -1791,11 +1791,11 @@ class MissionPanelHandler:
palette
=
widget
.
palette
()
palette
.
setColor
(
palette
.
WindowText
,
QtGui
.
QColor
(
0
,
0
,
0
))
widget
.
setPalette
(
palette
)
print
(
f
"
🔍
[调试] 更新现有控件: 列{col}"
)
print
(
f
" [调试] 更新现有控件: 列{col}"
)
elif
item
:
# 如果是普通的QTableWidgetItem,转换为QLabel控件
text
=
item
.
text
()
print
(
f
"
🔍
[调试] 转换为QLabel: 列{col}, 文本='{text}'"
)
print
(
f
" [调试] 转换为QLabel: 列{col}, 文本='{text}'"
)
label
=
QtWidgets
.
QLabel
(
text
)
label
.
setAlignment
(
Qt
.
AlignCenter
)
...
...
@@ -1839,7 +1839,7 @@ class MissionPanelHandler:
status: 任务状态
"""
try
:
print
(
f
"
🔍
[调试] _updateRowColorForQTableWidgetItem 被调用: 行={row_index}, 状态='{status}'"
)
print
(
f
" [调试] _updateRowColorForQTableWidgetItem 被调用: 行={row_index}, 状态='{status}'"
)
if
not
hasattr
(
self
,
'mission_panel'
):
print
(
f
"⚠️ [调试] mission_panel不存在,退出"
)
...
...
@@ -1860,7 +1860,7 @@ class MissionPanelHandler:
if
item
:
# 未配置:灰色文字
item
.
setForeground
(
QtGui
.
QColor
(
128
,
128
,
128
))
print
(
f
"
🔍
[调试] 设置灰色文字: 行={row_index}, 列={col}"
)
print
(
f
" [调试] 设置灰色文字: 行={row_index}, 列={col}"
)
print
(
f
"✅ [_updateRowColorForQTableWidgetItem] 已更新行 {row_index} 颜色为: 灰色"
)
else
:
...
...
handlers/videopage/thread_manager/model_pool_manager.py
View file @
a179dd7d
...
...
@@ -241,9 +241,9 @@ class ModelPoolManager:
project_root
=
os
.
path
.
dirname
(
os
.
path
.
dirname
(
os
.
path
.
dirname
(
current_dir
)))
config_file_path
=
os
.
path
.
join
(
project_root
,
'database'
,
'config'
,
'default_config.yaml'
)
print
(
f
"
🔍
[模型池管理器] 当前目录: {current_dir}"
)
print
(
f
"
🔍
[模型池管理器] 项目根目录: {project_root}"
)
print
(
f
"
🔍
[模型池管理器] 配置文件路径: {config_file_path}"
)
print
(
f
" [模型池管理器] 当前目录: {current_dir}"
)
print
(
f
" [模型池管理器] 项目根目录: {project_root}"
)
print
(
f
" [模型池管理器] 配置文件路径: {config_file_path}"
)
if
not
os
.
path
.
exists
(
config_file_path
):
print
(
f
"❌ [模型池管理器] 配置文件不存在: {config_file_path}"
)
...
...
@@ -338,7 +338,7 @@ class ModelPoolManager:
print
(
f
"📝 [模型池管理器] 发现模型: {model_id} -> {model_path}"
)
print
(
f
" - 使用通道: {', '.join(channels)}"
)
print
(
f
"
🔍
[模型池管理器] 扫描完成,发现 {len(unique_models)} 个唯一模型"
)
print
(
f
" [模型池管理器] 扫描完成,发现 {len(unique_models)} 个唯一模型"
)
return
unique_models
except
Exception
as
e
:
...
...
@@ -387,7 +387,7 @@ class ModelPoolManager:
# 确保所有信号处理完成
QApplication
.
processEvents
()
print
(
f
"
🔍
[模型池管理器] 加载结果: _loading_success={self._loading_success}"
)
print
(
f
" [模型池管理器] 加载结果: _loading_success={self._loading_success}"
)
# 返回加载结果
return
self
.
_loading_success
...
...
@@ -428,7 +428,7 @@ class ModelPoolManager:
self
.
_loading_success
=
success
and
len
(
loaded_models
)
>
0
self
.
_loading_finished
=
True
# 标记加载完成
print
(
f
"
🔍
[模型池管理器] 设置加载状态: _loading_success={self._loading_success}, _loading_finished={self._loading_finished}"
)
print
(
f
" [模型池管理器] 设置加载状态: _loading_success={self._loading_success}, _loading_finished={self._loading_finished}"
)
# 关闭进度条对话框
self
.
_close_progress_dialog
(
self
.
_loading_success
)
...
...
@@ -541,7 +541,7 @@ class ModelPoolManager:
# 步骤2: 加载模型文件 (20-60%)
self
.
_update_progress_dialog
(
current_idx
,
model_id
,
"正在加载模型文件到显存..."
,
25
)
print
(
f
"
🔍
[模型池管理器] 正在加载模型: {model_path}"
)
print
(
f
" [模型池管理器] 正在加载模型: {model_path}"
)
if
not
engine
.
load_model
(
model_path
):
print
(
f
"❌ [模型池管理器] 模型加载失败: {model_path}"
)
return
None
...
...
@@ -550,7 +550,7 @@ class ModelPoolManager:
# 步骤3: 读取标注配置 (60-75%)
self
.
_update_progress_dialog
(
current_idx
,
model_id
,
"正在读取标注配置文件..."
,
65
)
print
(
f
"
🔍
[模型池管理器] 正在加载 {model_id} 的标注配置..."
)
print
(
f
" [模型池管理器] 正在加载 {model_id} 的标注配置..."
)
annotation_config
=
self
.
_load_annotation_config_for_model
(
model_id
)
if
not
annotation_config
:
print
(
f
"❌ [模型池管理器] 未找到标注配置: {model_id}"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment