Commit a179dd7d by Yuhaibo

2

parent a4f905c9
...@@ -1031,8 +1031,8 @@ class MainWindow( ...@@ -1031,8 +1031,8 @@ class MainWindow(
print(f"⚠️ [通道筛选] 任务配置为空: {config_file}") print(f"⚠️ [通道筛选] 任务配置为空: {config_file}")
return [] return []
# 🔍 调试:打印配置文件的所有键 # 调试:打印配置文件的所有键
print(f"🔍 [通道筛选] 配置文件键: {list(task_config.keys())}") print(f" [通道筛选] 配置文件键: {list(task_config.keys())}")
# 从配置中提取使用的通道 # 从配置中提取使用的通道
# 配置格式可能是:selected_channels: ['通道2', '通道3'] 或 channels: ['channel1', 'channel2'] # 配置格式可能是:selected_channels: ['通道2', '通道3'] 或 channels: ['channel1', 'channel2']
...@@ -1044,7 +1044,7 @@ class MainWindow( ...@@ -1044,7 +1044,7 @@ class MainWindow(
channel_list = task_config['selected_channels'] channel_list = task_config['selected_channels']
if isinstance(channel_list, list): if isinstance(channel_list, list):
used_channels = [ch for ch in channel_list if isinstance(ch, str) and '通道' in ch] 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: elif 'channels' in task_config:
...@@ -1059,7 +1059,7 @@ class MainWindow( ...@@ -1059,7 +1059,7 @@ class MainWindow(
used_channels.append(f'通道{ch_num}') used_channels.append(f'通道{ch_num}')
elif isinstance(ch, int): elif isinstance(ch, int):
used_channels.append(f'通道{ch}') used_channels.append(f'通道{ch}')
print(f"🔍 [通道筛选] 从 channels 读取: {used_channels}") print(f" [通道筛选] 从 channels 读取: {used_channels}")
elif 'channel_list' in task_config: elif 'channel_list' in task_config:
# 格式3: channel_list: [1, 2, 3] # 格式3: channel_list: [1, 2, 3]
...@@ -1067,14 +1067,14 @@ class MainWindow( ...@@ -1067,14 +1067,14 @@ class MainWindow(
if isinstance(channel_list, list): if isinstance(channel_list, list):
for ch_num in channel_list: for ch_num in channel_list:
used_channels.append(f'通道{ch_num}') used_channels.append(f'通道{ch_num}')
print(f"🔍 [通道筛选] 从 channel_list 读取: {used_channels}") print(f" [通道筛选] 从 channel_list 读取: {used_channels}")
elif 'task_channels' in task_config: elif 'task_channels' in task_config:
# 格式4: task_channels: '通道1, 通道2' # 格式4: task_channels: '通道1, 通道2'
channels_str = task_config['task_channels'] channels_str = task_config['task_channels']
if isinstance(channels_str, str): if isinstance(channels_str, str):
used_channels = [ch.strip() for ch in channels_str.split(',')] used_channels = [ch.strip() for ch in channels_str.split(',')]
print(f"🔍 [通道筛选] 从 task_channels 读取: {used_channels}") print(f" [通道筛选] 从 task_channels 读取: {used_channels}")
else: else:
# 如果没有明确的通道配置,尝试从其他字段推断 # 如果没有明确的通道配置,尝试从其他字段推断
...@@ -1083,7 +1083,7 @@ class MainWindow( ...@@ -1083,7 +1083,7 @@ class MainWindow(
if f'channel{i}' in task_config: if f'channel{i}' in task_config:
used_channels.append(f'通道{i}') used_channels.append(f'通道{i}')
if used_channels: if used_channels:
print(f"🔍 [通道筛选] 从 channel 字段推断: {used_channels}") print(f" [通道筛选] 从 channel 字段推断: {used_channels}")
# 去重并排序 # 去重并排序
used_channels = sorted(list(set(used_channels))) used_channels = sorted(list(set(used_channels)))
...@@ -1552,7 +1552,7 @@ def main(): ...@@ -1552,7 +1552,7 @@ def main():
app.setOrganizationName('Detection') app.setOrganizationName('Detection')
# 🔥 暂时禁用全局字体配置,测试是否解决重复显示问题 # 🔥 暂时禁用全局字体配置,测试是否解决重复显示问题
print(f"🔍 [调试] 跳过全局字体应用到应用程序") print(f" [调试] 跳过全局字体应用到应用程序")
# FontManager.applyToApplication(app) # FontManager.applyToApplication(app)
# 设置应用样式(可选) # 设置应用样式(可选)
......
...@@ -420,7 +420,7 @@ class ModelSetHandler: ...@@ -420,7 +420,7 @@ class ModelSetHandler:
print("🚀 [模型加载] 开始加载模型列表...") print("🚀 [模型加载] 开始加载模型列表...")
# 1. 加载配置文件 # 1. 加载配置文件
print("🔍 [模型加载] 步骤1: 加载配置文件") print(" [模型加载] 步骤1: 加载配置文件")
config = self._loadConfigFile() config = self._loadConfigFile()
if not config: if not config:
print("❌ [模型加载] 配置文件加载失败,停止加载") print("❌ [模型加载] 配置文件加载失败,停止加载")
...@@ -428,17 +428,17 @@ class ModelSetHandler: ...@@ -428,17 +428,17 @@ class ModelSetHandler:
print("✅ [模型加载] 配置文件加载成功") print("✅ [模型加载] 配置文件加载成功")
# 2. 跳过配置文件中的通道模型(只显示train_model目录下的模型) # 2. 跳过配置文件中的通道模型(只显示train_model目录下的模型)
print("🔍 [模型加载] 步骤2: 跳过配置文件中的通道模型") print(" [模型加载] 步骤2: 跳过配置文件中的通道模型")
channel_models = [] # 不加载通道模型 channel_models = [] # 不加载通道模型
print(f"✅ [模型加载] 跳过通道模型,专注于train_model目录") print(f"✅ [模型加载] 跳过通道模型,专注于train_model目录")
# 3. 扫描模型目录 # 3. 扫描模型目录
print("🔍 [模型加载] 步骤3: 扫描模型目录") print(" [模型加载] 步骤3: 扫描模型目录")
scanned_models = self._scanModelDirectory() scanned_models = self._scanModelDirectory()
print(f"✅ [模型加载] 从目录扫描到 {len(scanned_models)} 个模型") print(f"✅ [模型加载] 从目录扫描到 {len(scanned_models)} 个模型")
# 4. 直接使用扫描到的模型(不合并通道模型) # 4. 直接使用扫描到的模型(不合并通道模型)
print("🔍 [模型加载] 步骤4: 使用扫描到的模型") print(" [模型加载] 步骤4: 使用扫描到的模型")
all_models = scanned_models # 直接使用扫描模型 all_models = scanned_models # 直接使用扫描模型
# 设置第一个模型为默认模型(如果有模型的话) # 设置第一个模型为默认模型(如果有模型的话)
...@@ -449,7 +449,7 @@ class ModelSetHandler: ...@@ -449,7 +449,7 @@ class ModelSetHandler:
print(f"✅ [模型加载] 最终显示 {len(all_models)} 个模型") print(f"✅ [模型加载] 最终显示 {len(all_models)} 个模型")
# 5. 更新UI # 5. 更新UI
print("🔍 [模型加载] 步骤5: 更新UI显示") print(" [模型加载] 步骤5: 更新UI显示")
self._updateModelList(all_models) self._updateModelList(all_models)
print("✅ [模型加载] 模型列表加载完成") print("✅ [模型加载] 模型列表加载完成")
...@@ -543,9 +543,9 @@ class ModelSetHandler: ...@@ -543,9 +543,9 @@ class ModelSetHandler:
current_dir = Path(__file__).parent.parent.parent current_dir = Path(__file__).parent.parent.parent
model_dir = current_dir / "database" / "model" / "train_model" model_dir = current_dir / "database" / "model" / "train_model"
print(f"🔍 [模型扫描] 项目根目录: {current_dir}") print(f" [模型扫描] 项目根目录: {current_dir}")
print(f"🔍 [模型扫描] 模型目录路径: {model_dir}") print(f" [模型扫描] 模型目录路径: {model_dir}")
print(f"🔍 [模型扫描] 模型目录是否存在: {model_dir.exists()}") print(f" [模型扫描] 模型目录是否存在: {model_dir.exists()}")
if not model_dir.exists(): if not model_dir.exists():
print("❌ [模型扫描] 模型目录不存在,返回空列表") print("❌ [模型扫描] 模型目录不存在,返回空列表")
...@@ -553,23 +553,23 @@ class ModelSetHandler: ...@@ -553,23 +553,23 @@ class ModelSetHandler:
# 列出目录中的所有项目 # 列出目录中的所有项目
all_items = list(model_dir.iterdir()) 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 '') 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: for subdir in sorted_subdirs:
if subdir.is_dir(): if subdir.is_dir():
print(f"🔍 [模型扫描] 正在扫描子目录: {subdir.name} ({subdir})") print(f" [模型扫描] 正在扫描子目录: {subdir.name} ({subdir})")
# 列出子目录中的所有文件 # 列出子目录中的所有文件
subdir_files = list(subdir.iterdir()) 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 文件(优先)
dat_files = list(subdir.glob("*.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): for model_file in sorted(dat_files):
model_info = { model_info = {
...@@ -584,7 +584,7 @@ class ModelSetHandler: ...@@ -584,7 +584,7 @@ class ModelSetHandler:
# 然后查找 .pt 文件 # 然后查找 .pt 文件
pt_files = list(subdir.glob("*.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): for model_file in sorted(pt_files):
model_info = { model_info = {
...@@ -604,7 +604,7 @@ class ModelSetHandler: ...@@ -604,7 +604,7 @@ class ModelSetHandler:
import traceback import traceback
traceback.print_exc() traceback.print_exc()
print(f"🔍 [模型扫描] 扫描完成,共找到 {len(models)} 个模型") print(f" [模型扫描] 扫描完成,共找到 {len(models)} 个模型")
return models return models
def _mergeModelInfo(self, channel_models, scanned_models): def _mergeModelInfo(self, channel_models, scanned_models):
...@@ -612,9 +612,9 @@ class ModelSetHandler: ...@@ -612,9 +612,9 @@ class ModelSetHandler:
all_models = [] all_models = []
seen_paths = set() seen_paths = set()
print(f"🔍 [模型合并] 开始合并模型信息") print(f" [模型合并] 开始合并模型信息")
print(f"🔍 [模型合并] 通道模型数量: {len(channel_models)}") print(f" [模型合并] 通道模型数量: {len(channel_models)}")
print(f"🔍 [模型合并] 扫描模型数量: {len(scanned_models)}") print(f" [模型合并] 扫描模型数量: {len(scanned_models)}")
# 优先添加配置文件中的通道模型 # 优先添加配置文件中的通道模型
for model in channel_models: for model in channel_models:
...@@ -642,13 +642,13 @@ class ModelSetHandler: ...@@ -642,13 +642,13 @@ class ModelSetHandler:
all_models[0]['is_default'] = True all_models[0]['is_default'] = True
print(f"✅ [模型合并] 设置默认模型: {all_models[0]['name']}") print(f"✅ [模型合并] 设置默认模型: {all_models[0]['name']}")
print(f"🔍 [模型合并] 合并完成,最终模型数量: {len(all_models)}") print(f" [模型合并] 合并完成,最终模型数量: {len(all_models)}")
return all_models return all_models
def _updateModelList(self, all_models): def _updateModelList(self, all_models):
"""更新UI中的模型列表""" """更新UI中的模型列表"""
try: try:
print(f"🔍 [UI更新] 开始更新模型列表,模型数量: {len(all_models)}") print(f" [UI更新] 开始更新模型列表,模型数量: {len(all_models)}")
if not hasattr(self, 'modelSetPage') or not self.modelSetPage: if not hasattr(self, 'modelSetPage') or not self.modelSetPage:
print("❌ [UI更新] modelSetPage 不存在,无法更新UI") print("❌ [UI更新] modelSetPage 不存在,无法更新UI")
...@@ -662,7 +662,7 @@ class ModelSetHandler: ...@@ -662,7 +662,7 @@ class ModelSetHandler:
# 添加所有模型到UI # 添加所有模型到UI
for i, model in enumerate(all_models): for i, model in enumerate(all_models):
model_name = model['name'] 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, {}) model_params = self._createModelParams(model, {})
...@@ -675,7 +675,7 @@ class ModelSetHandler: ...@@ -675,7 +675,7 @@ class ModelSetHandler:
# 刷新UI显示 # 刷新UI显示
if hasattr(self.modelSetPage, 'refreshModelList'): if hasattr(self.modelSetPage, 'refreshModelList'):
print(f"🔍 [UI更新] 调用 refreshModelList 刷新UI") print(f" [UI更新] 调用 refreshModelList 刷新UI")
self.modelSetPage.refreshModelList() self.modelSetPage.refreshModelList()
else: else:
print(f"⚠️ [UI更新] modelSetPage 没有 refreshModelList 方法") print(f"⚠️ [UI更新] modelSetPage 没有 refreshModelList 方法")
......
...@@ -2477,13 +2477,13 @@ class ModelTrainingHandler(ModelTestHandler): ...@@ -2477,13 +2477,13 @@ class ModelTrainingHandler(ModelTestHandler):
if model_path.endswith('.dat'): if model_path.endswith('.dat'):
# 解密 .dat 模型 # 解密 .dat 模型
print(f"🔍 [模型加载] 原始.dat模型路径: {model_path}") print(f" [模型加载] 原始.dat模型路径: {model_path}")
print(f"🔍 [模型加载] 文件是否存在: {os.path.exists(model_path)}") print(f" [模型加载] 文件是否存在: {os.path.exists(model_path)}")
temp_model_path = self._decode_dat_model(model_path) temp_model_path = self._decode_dat_model(model_path)
print(f"🔍 [模型加载] 解密后.pt模型路径: {temp_model_path}") print(f" [模型加载] 解密后.pt模型路径: {temp_model_path}")
print(f"🔍 [模型加载] 解密后文件是否存在: {os.path.exists(temp_model_path)}") print(f" [模型加载] 解密后文件是否存在: {os.path.exists(temp_model_path)}")
# 验证解密后的模型文件存在,然后设置离线模式 # 验证解密后的模型文件存在,然后设置离线模式
if not os.path.exists(temp_model_path): if not os.path.exists(temp_model_path):
...@@ -2500,9 +2500,9 @@ class ModelTrainingHandler(ModelTestHandler): ...@@ -2500,9 +2500,9 @@ class ModelTrainingHandler(ModelTestHandler):
print(f"✅ [模型加载] YOLO模型加载成功") print(f"✅ [模型加载] YOLO模型加载成功")
else: else:
# 验证模型文件存在,然后设置离线模式 # 验证模型文件存在,然后设置离线模式
print(f"🔍 [模型加载] .pt模型路径: {model_path}") print(f" [模型加载] .pt模型路径: {model_path}")
print(f"🔍 [模型加载] 文件是否存在: {os.path.exists(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" [模型加载] 文件大小: {os.path.getsize(model_path) if os.path.exists(model_path) else 'N/A'} bytes")
if not os.path.exists(model_path): if not os.path.exists(model_path):
raise FileNotFoundError(f"模型文件不存在: {model_path}") raise FileNotFoundError(f"模型文件不存在: {model_path}")
......
...@@ -58,12 +58,12 @@ class TrainingWorker(QThread): ...@@ -58,12 +58,12 @@ class TrainingWorker(QThread):
self.is_running = True self.is_running = True
self.train_config = None self.train_config = None
# 🔍 调试信息:显示传入的训练参数 # 调试信息:显示传入的训练参数
print(f"\n🔍 [TrainingWorker初始化] 接收到的训练参数:") print(f"\n [TrainingWorker初始化] 接收到的训练参数:")
for key, value in training_params.items(): for key, value in training_params.items():
print(f" {key}: {value}") print(f" {key}: {value}")
print(f"🔍 [TrainingWorker初始化] base_model路径: {training_params.get('base_model', 'None')}") 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文件存在: {os.path.exists(training_params.get('base_model', '')) if training_params.get('base_model') else False}")
self.training_report = { self.training_report = {
"status": "init", "status": "init",
...@@ -480,14 +480,14 @@ class TrainingWorker(QThread): ...@@ -480,14 +480,14 @@ class TrainingWorker(QThread):
self.log_output.emit("正在加载模型...\n") self.log_output.emit("正在加载模型...\n")
try: try:
# 🔍 详细调试信息 # 详细调试信息
# self.log_output.emit(f"🔍 [训练工作线程] 模型路径: {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" [训练工作线程] 模型路径类型: {type(model_path)}\n")
# self.log_output.emit(f"🔍 [训练工作线程] 文件是否存在: {os.path.exists(model_path)}\n") # self.log_output.emit(f" [训练工作线程] 文件是否存在: {os.path.exists(model_path)}\n")
if os.path.exists(model_path): if os.path.exists(model_path):
file_size = os.path.getsize(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): if not os.path.exists(model_path):
......
...@@ -62,7 +62,7 @@ class DatToCfgConverter: ...@@ -62,7 +62,7 @@ class DatToCfgConverter:
print(f"❌ 目录不存在: {directory}") print(f"❌ 目录不存在: {directory}")
return False return False
print(f"\n🔍 扫描目录: {directory}") print(f"\n 扫描目录: {directory}")
# 查找所有.dat文件 # 查找所有.dat文件
if recursive: if recursive:
......
...@@ -32,7 +32,7 @@ class BatImageDetector: ...@@ -32,7 +32,7 @@ class BatImageDetector:
Returns: Returns:
是否加载成功 是否加载成功
""" """
print(f"🔍 加载.bat模型: {model_path}") print(f" 加载.bat模型: {model_path}")
try: try:
# 检查文件是否存在 # 检查文件是否存在
...@@ -277,7 +277,7 @@ def main(): ...@@ -277,7 +277,7 @@ def main():
detector = BatImageDetector() detector = BatImageDetector()
try: try:
print("🔍 开始.bat模型图片检测测试") print(" 开始.bat模型图片检测测试")
print("=" * 50) print("=" * 50)
# 1. 测试模型加载 # 1. 测试模型加载
......
...@@ -34,7 +34,7 @@ class BatModelTester: ...@@ -34,7 +34,7 @@ class BatModelTester:
Returns: Returns:
是否加载成功 是否加载成功
""" """
print(f"🔍 测试模型加载: {model_path}") print(f" 测试模型加载: {model_path}")
try: try:
# 检查文件是否存在 # 检查文件是否存在
......
...@@ -36,7 +36,7 @@ def test_dat_conversion(): ...@@ -36,7 +36,7 @@ def test_dat_conversion():
print(f"📁 找到 {len(test_pt_files)} 个.pt文件用于测试") print(f"📁 找到 {len(test_pt_files)} 个.pt文件用于测试")
for pt_file in test_pt_files: for pt_file in test_pt_files:
print(f"\n🔍 测试文件: {pt_file}") print(f"\n 测试文件: {pt_file}")
try: try:
# 检查文件大小 # 检查文件大小
...@@ -120,7 +120,7 @@ def test_dat_loading(): ...@@ -120,7 +120,7 @@ def test_dat_loading():
print(f"📁 找到 {len(dat_files)} 个.dat文件") print(f"📁 找到 {len(dat_files)} 个.dat文件")
for dat_file in dat_files: for dat_file in dat_files:
print(f"\n🔍 测试加载: {dat_file}") print(f"\n 测试加载: {dat_file}")
try: try:
# 测试加载.dat模型(内部会自动解码) # 测试加载.dat模型(内部会自动解码)
......
...@@ -32,7 +32,7 @@ class DatImageDetector: ...@@ -32,7 +32,7 @@ class DatImageDetector:
Returns: Returns:
是否加载成功 是否加载成功
""" """
print(f"🔍 加载.dat模型: {model_path}") print(f" 加载.dat模型: {model_path}")
try: try:
# 检查文件是否存在 # 检查文件是否存在
...@@ -191,7 +191,7 @@ def main(): ...@@ -191,7 +191,7 @@ def main():
detector = DatImageDetector() detector = DatImageDetector()
try: try:
print("🔍 开始.dat模型图片分割测试") print(" 开始.dat模型图片分割测试")
print("=" * 50) print("=" * 50)
# 1. 测试模型加载 # 1. 测试模型加载
......
...@@ -30,7 +30,7 @@ class PtModelTester: ...@@ -30,7 +30,7 @@ class PtModelTester:
Returns: Returns:
是否加载成功 是否加载成功
""" """
print(f"🔍 加载.pt模型: {model_path}") print(f" 加载.pt模型: {model_path}")
try: try:
# 检查文件是否存在 # 检查文件是否存在
...@@ -422,7 +422,7 @@ def main(): ...@@ -422,7 +422,7 @@ def main():
tester = PtModelTester() tester = PtModelTester()
try: try:
print("🔍 开始.pt模型检测测试") print(" 开始.pt模型检测测试")
print("=" * 50) print("=" * 50)
# 1. 测试模型加载 # 1. 测试模型加载
......
...@@ -932,7 +932,7 @@ class MissionPanelHandler: ...@@ -932,7 +932,7 @@ class MissionPanelHandler:
""" """
try: try:
print(f"\n{'='*60}") print(f"\n{'='*60}")
print(f"🔍 [调试] 开始更新通道列颜色") print(f" [调试] 开始更新通道列颜色")
print(f"{'='*60}") print(f"{'='*60}")
# 获取所有任务的行数据 # 获取所有任务的行数据
...@@ -962,7 +962,7 @@ class MissionPanelHandler: ...@@ -962,7 +962,7 @@ class MissionPanelHandler:
channel_current_missions[ch_idx] = current_mission channel_current_missions[ch_idx] = current_mission
print(f"📝 [调试] {mission_var_name} = {current_mission} (类型: {type(current_mission_obj).__name__})") print(f"📝 [调试] {mission_var_name} = {current_mission} (类型: {type(current_mission_obj).__name__})")
else: else:
print(f" [调试] {mission_var_name} = None") print(f" [调试] {mission_var_name} = None")
else: else:
print(f"❌ [调试] 没有 {mission_var_name} 属性") print(f"❌ [调试] 没有 {mission_var_name} 属性")
...@@ -1006,7 +1006,7 @@ class MissionPanelHandler: ...@@ -1006,7 +1006,7 @@ class MissionPanelHandler:
else: 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"{'='*60}")
print(f"✅ [调试] 通道列颜色更新完成") print(f"✅ [调试] 通道列颜色更新完成")
...@@ -1032,7 +1032,7 @@ class MissionPanelHandler: ...@@ -1032,7 +1032,7 @@ class MissionPanelHandler:
detect_var_name = f'{channel_id}detect' detect_var_name = f'{channel_id}detect'
if hasattr(self, detect_var_name): if hasattr(self, detect_var_name):
is_detecting = getattr(self, detect_var_name, False) 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 is_detecting
return False return False
except Exception as e: except Exception as e:
...@@ -1498,7 +1498,7 @@ class MissionPanelHandler: ...@@ -1498,7 +1498,7 @@ class MissionPanelHandler:
# 如果通道有任务且不是当前要分配的任务,记录下来 # 如果通道有任务且不是当前要分配的任务,记录下来
if existing_task and existing_task != new_task_name: if existing_task and existing_task != new_task_name:
channels_with_tasks.append((channel_key, existing_task)) channels_with_tasks.append((channel_key, existing_task))
print(f"🔍 检测到 {channel_key} 已有任务: {existing_task}") print(f" 检测到 {channel_key} 已有任务: {existing_task}")
except Exception as e: except Exception as e:
print(f"❌ 检查通道任务失败: {e}") print(f"❌ 检查通道任务失败: {e}")
...@@ -1727,7 +1727,7 @@ class MissionPanelHandler: ...@@ -1727,7 +1727,7 @@ class MissionPanelHandler:
status: 任务状态 status: 任务状态
""" """
try: try:
print(f"🔍 [调试] _updateRowColor 被调用: 行={row_index}, 状态='{status}'") print(f" [调试] _updateRowColor 被调用: 行={row_index}, 状态='{status}'")
if not hasattr(self, 'mission_panel'): if not hasattr(self, 'mission_panel'):
print(f"⚠️ [调试] mission_panel不存在,退出") print(f"⚠️ [调试] mission_panel不存在,退出")
...@@ -1737,20 +1737,20 @@ class MissionPanelHandler: ...@@ -1737,20 +1737,20 @@ class MissionPanelHandler:
# 🔥 完全使用字体管理器,不使用CSS样式表 # 🔥 完全使用字体管理器,不使用CSS样式表
is_gray = (status == "未配置") is_gray = (status == "未配置")
print(f"🔍 [调试] 设置颜色: {'灰色' if is_gray else '默认黑色'}") print(f" [调试] 设置颜色: {'灰色' if is_gray else '默认黑色'}")
# 更新所有列的字体颜色(除了按钮列) # 更新所有列的字体颜色(除了按钮列)
for col in range(table.columnCount()): for col in range(table.columnCount()):
# 跳过曲线按钮列 # 跳过曲线按钮列
if col == self.mission_panel.CURVE_BUTTON_COLUMN: if col == self.mission_panel.CURVE_BUTTON_COLUMN:
print(f"🔍 [调试] 跳过曲线按钮列: {col}") print(f" [调试] 跳过曲线按钮列: {col}")
continue continue
# 检查是否已经是控件(QLabel) # 检查是否已经是控件(QLabel)
widget = table.cellWidget(row_index, col) widget = table.cellWidget(row_index, col)
item = table.item(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: if widget:
# 检查是否为高亮行(蓝色背景) # 检查是否为高亮行(蓝色背景)
...@@ -1759,7 +1759,7 @@ class MissionPanelHandler: ...@@ -1759,7 +1759,7 @@ class MissionPanelHandler:
if is_highlighted: if is_highlighted:
# 如果是高亮行,保持高亮样式不变 # 如果是高亮行,保持高亮样式不变
print(f"🔍 [调试] 保持高亮样式: 列{col}") print(f" [调试] 保持高亮样式: 列{col}")
else: else:
# 非高亮行,清除样式表并重新应用字体管理器 # 非高亮行,清除样式表并重新应用字体管理器
widget.setStyleSheet("") # 清除所有CSS样式 widget.setStyleSheet("") # 清除所有CSS样式
...@@ -1791,11 +1791,11 @@ class MissionPanelHandler: ...@@ -1791,11 +1791,11 @@ class MissionPanelHandler:
palette = widget.palette() palette = widget.palette()
palette.setColor(palette.WindowText, QtGui.QColor(0, 0, 0)) palette.setColor(palette.WindowText, QtGui.QColor(0, 0, 0))
widget.setPalette(palette) widget.setPalette(palette)
print(f"🔍 [调试] 更新现有控件: 列{col}") print(f" [调试] 更新现有控件: 列{col}")
elif item: elif item:
# 如果是普通的QTableWidgetItem,转换为QLabel控件 # 如果是普通的QTableWidgetItem,转换为QLabel控件
text = item.text() text = item.text()
print(f"🔍 [调试] 转换为QLabel: 列{col}, 文本='{text}'") print(f" [调试] 转换为QLabel: 列{col}, 文本='{text}'")
label = QtWidgets.QLabel(text) label = QtWidgets.QLabel(text)
label.setAlignment(Qt.AlignCenter) label.setAlignment(Qt.AlignCenter)
...@@ -1839,7 +1839,7 @@ class MissionPanelHandler: ...@@ -1839,7 +1839,7 @@ class MissionPanelHandler:
status: 任务状态 status: 任务状态
""" """
try: try:
print(f"🔍 [调试] _updateRowColorForQTableWidgetItem 被调用: 行={row_index}, 状态='{status}'") print(f" [调试] _updateRowColorForQTableWidgetItem 被调用: 行={row_index}, 状态='{status}'")
if not hasattr(self, 'mission_panel'): if not hasattr(self, 'mission_panel'):
print(f"⚠️ [调试] mission_panel不存在,退出") print(f"⚠️ [调试] mission_panel不存在,退出")
...@@ -1860,7 +1860,7 @@ class MissionPanelHandler: ...@@ -1860,7 +1860,7 @@ class MissionPanelHandler:
if item: if item:
# 未配置:灰色文字 # 未配置:灰色文字
item.setForeground(QtGui.QColor(128, 128, 128)) item.setForeground(QtGui.QColor(128, 128, 128))
print(f"🔍 [调试] 设置灰色文字: 行={row_index}, 列={col}") print(f" [调试] 设置灰色文字: 行={row_index}, 列={col}")
print(f"✅ [_updateRowColorForQTableWidgetItem] 已更新行 {row_index} 颜色为: 灰色") print(f"✅ [_updateRowColorForQTableWidgetItem] 已更新行 {row_index} 颜色为: 灰色")
else: else:
......
...@@ -241,9 +241,9 @@ class ModelPoolManager: ...@@ -241,9 +241,9 @@ class ModelPoolManager:
project_root = os.path.dirname(os.path.dirname(os.path.dirname(current_dir))) 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') config_file_path = os.path.join(project_root, 'database', 'config', 'default_config.yaml')
print(f"🔍 [模型池管理器] 当前目录: {current_dir}") print(f" [模型池管理器] 当前目录: {current_dir}")
print(f"🔍 [模型池管理器] 项目根目录: {project_root}") print(f" [模型池管理器] 项目根目录: {project_root}")
print(f"🔍 [模型池管理器] 配置文件路径: {config_file_path}") print(f" [模型池管理器] 配置文件路径: {config_file_path}")
if not os.path.exists(config_file_path): if not os.path.exists(config_file_path):
print(f"❌ [模型池管理器] 配置文件不存在: {config_file_path}") print(f"❌ [模型池管理器] 配置文件不存在: {config_file_path}")
...@@ -338,7 +338,7 @@ class ModelPoolManager: ...@@ -338,7 +338,7 @@ class ModelPoolManager:
print(f"📝 [模型池管理器] 发现模型: {model_id} -> {model_path}") print(f"📝 [模型池管理器] 发现模型: {model_id} -> {model_path}")
print(f" - 使用通道: {', '.join(channels)}") print(f" - 使用通道: {', '.join(channels)}")
print(f"🔍 [模型池管理器] 扫描完成,发现 {len(unique_models)} 个唯一模型") print(f" [模型池管理器] 扫描完成,发现 {len(unique_models)} 个唯一模型")
return unique_models return unique_models
except Exception as e: except Exception as e:
...@@ -387,7 +387,7 @@ class ModelPoolManager: ...@@ -387,7 +387,7 @@ class ModelPoolManager:
# 确保所有信号处理完成 # 确保所有信号处理完成
QApplication.processEvents() QApplication.processEvents()
print(f"🔍 [模型池管理器] 加载结果: _loading_success={self._loading_success}") print(f" [模型池管理器] 加载结果: _loading_success={self._loading_success}")
# 返回加载结果 # 返回加载结果
return self._loading_success return self._loading_success
...@@ -428,7 +428,7 @@ class ModelPoolManager: ...@@ -428,7 +428,7 @@ class ModelPoolManager:
self._loading_success = success and len(loaded_models) > 0 self._loading_success = success and len(loaded_models) > 0
self._loading_finished = True # 标记加载完成 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) self._close_progress_dialog(self._loading_success)
...@@ -541,7 +541,7 @@ class ModelPoolManager: ...@@ -541,7 +541,7 @@ class ModelPoolManager:
# 步骤2: 加载模型文件 (20-60%) # 步骤2: 加载模型文件 (20-60%)
self._update_progress_dialog(current_idx, model_id, "正在加载模型文件到显存...", 25) self._update_progress_dialog(current_idx, model_id, "正在加载模型文件到显存...", 25)
print(f"🔍 [模型池管理器] 正在加载模型: {model_path}") print(f" [模型池管理器] 正在加载模型: {model_path}")
if not engine.load_model(model_path): if not engine.load_model(model_path):
print(f"❌ [模型池管理器] 模型加载失败: {model_path}") print(f"❌ [模型池管理器] 模型加载失败: {model_path}")
return None return None
...@@ -550,7 +550,7 @@ class ModelPoolManager: ...@@ -550,7 +550,7 @@ class ModelPoolManager:
# 步骤3: 读取标注配置 (60-75%) # 步骤3: 读取标注配置 (60-75%)
self._update_progress_dialog(current_idx, model_id, "正在读取标注配置文件...", 65) 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) annotation_config = self._load_annotation_config_for_model(model_id)
if not annotation_config: if not annotation_config:
print(f"❌ [模型池管理器] 未找到标注配置: {model_id}") print(f"❌ [模型池管理器] 未找到标注配置: {model_id}")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment