Step3 插值算法 OOM 修复 + 多进程加速 + 全链路累积改动(14 文件)
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Step5 面板 - 光谱提取
|
||||
Step6 面板 - 光谱特征提取
|
||||
"""
|
||||
|
||||
import os
|
||||
@ -27,7 +27,7 @@ class Step6FeaturePanel(QWidget):
|
||||
layout = QVBoxLayout()
|
||||
|
||||
# 标题
|
||||
title = QLabel("步骤5:训练样本光谱提取")
|
||||
title = QLabel("步骤6:光谱特征提取")
|
||||
title.setFont(QFont("Arial", 12, QFont.Bold))
|
||||
layout.addWidget(title)
|
||||
|
||||
@ -58,12 +58,12 @@ class Step6FeaturePanel(QWidget):
|
||||
"Mask Files (*.dat *.tif);;All Files (*.*)"
|
||||
)
|
||||
layout.addWidget(self.glint_mask_file)
|
||||
step5_glint_hint = QLabel(
|
||||
step6_glint_hint = QLabel(
|
||||
"提示:独立运行本步骤时必须选择耀斑掩膜(通常为步骤2输出的 severe_glint_area.dat),用于在采样时避开耀斑像元。"
|
||||
)
|
||||
step5_glint_hint.setWordWrap(True)
|
||||
step5_glint_hint.setStyleSheet("color: #666; font-size: 10px;")
|
||||
layout.addWidget(step5_glint_hint)
|
||||
step6_glint_hint.setWordWrap(True)
|
||||
step6_glint_hint.setStyleSheet("color: #666; font-size: 10px;")
|
||||
layout.addWidget(step6_glint_hint)
|
||||
|
||||
# 参数设置
|
||||
params_group = QGroupBox("提取参数")
|
||||
@ -200,20 +200,22 @@ class Step6FeaturePanel(QWidget):
|
||||
else:
|
||||
self.output_file.set_path("")
|
||||
|
||||
# 5. 尝试从 Step4 界面读取已处理的水质参数 CSV 路径,自动填入本面板
|
||||
# 5. 尝试从 Step5 Clean 界面读取已处理的清洗后 CSV 路径,自动填入本面板
|
||||
main_window = self.window()
|
||||
if main_window and hasattr(main_window, 'step5_panel'):
|
||||
step4_output_path = main_window.step5_panel.output_file.get_path()
|
||||
if step4_output_path:
|
||||
if main_window and hasattr(main_window, 'step5_clean_panel'):
|
||||
step5_clean_output_path = main_window.step5_clean_panel.output_file.get_path()
|
||||
if step5_clean_output_path:
|
||||
# 若为相对路径,使用 work_dir 合成为绝对路径
|
||||
if not os.path.isabs(step4_output_path):
|
||||
step4_output_path = os.path.join(self.work_dir or '', step4_output_path).replace('\\', '/')
|
||||
if not os.path.isabs(step5_clean_output_path):
|
||||
step5_clean_output_path = os.path.join(
|
||||
self.work_dir or '', step5_clean_output_path
|
||||
).replace('\\', '/')
|
||||
existing_csv = self.csv_file.get_path()
|
||||
if not existing_csv or not existing_csv.strip():
|
||||
self.csv_file.set_path(step4_output_path)
|
||||
self.csv_file.set_path(step5_clean_output_path)
|
||||
|
||||
def run_step(self):
|
||||
"""独立运行步骤5"""
|
||||
"""独立运行步骤6"""
|
||||
# 验证输入
|
||||
deglint_img_path = self.deglint_img_file.get_path()
|
||||
csv_path = self.csv_file.get_path()
|
||||
|
||||
@ -1393,9 +1393,7 @@ class WaterQualityGUI(QMainWindow):
|
||||
'deglint_img_path': ('step3', 'deglint_image', 'deglint_img_file'),
|
||||
'water_mask_path': ('step1', 'water_mask', 'water_mask_file')
|
||||
},
|
||||
'step5_clean': {
|
||||
'csv_path': ('step4_sampling', 'sampling_spectra', 'csv_file') # step5 寻找 step4 的采样点
|
||||
},
|
||||
# 'step5_clean': 业务要求保持输入源独立,不自动抓取 step4_sampling 的输出;用户手动浏览导入
|
||||
'step6_feature': {
|
||||
'deglint_img_path': ('step3', 'deglint_image', 'deglint_img_file'),
|
||||
'csv_path': ('step5_clean', 'processed_data', 'csv_file'),
|
||||
@ -2252,21 +2250,32 @@ class WaterQualityGUI(QMainWindow):
|
||||
# 检查面板是否有对应的属性
|
||||
if not hasattr(panel, panel_attr):
|
||||
continue
|
||||
|
||||
|
||||
file_widget = getattr(panel, panel_attr)
|
||||
|
||||
|
||||
# ★ 兼容 FileSelectWidget 与原生 QLineEdit
|
||||
current_text = (
|
||||
file_widget.get_path().strip()
|
||||
if hasattr(file_widget, 'get_path')
|
||||
else file_widget.text().strip()
|
||||
)
|
||||
|
||||
# 如果输入框已经有内容,跳过自动填充
|
||||
if file_widget.get_path().strip():
|
||||
if current_text:
|
||||
continue
|
||||
|
||||
|
||||
# 查找依赖步骤的输出文件
|
||||
output_path = self.find_step_output(work_path, dep_step, output_type)
|
||||
|
||||
|
||||
if output_path and Path(output_path).exists():
|
||||
file_widget.set_path(output_path)
|
||||
# ★ 兼容 FileSelectWidget 与原生 QLineEdit
|
||||
if hasattr(file_widget, 'set_path'):
|
||||
file_widget.set_path(str(output_path))
|
||||
else:
|
||||
file_widget.setText(str(output_path))
|
||||
self.log_message(f"自动填充 {step_id}.{input_field}: {output_path}", "info")
|
||||
filled_count += 1
|
||||
|
||||
|
||||
return filled_count
|
||||
|
||||
def get_step_panel(self, step_id):
|
||||
|
||||
Reference in New Issue
Block a user