结构修改,后端文件跟前端内容进行适配
This commit is contained in:
@ -272,10 +272,10 @@ class WorkerThread(QThread):
|
||||
ctx = PipelineContext(
|
||||
img_path=self.config.get('step1', {}).get('img_path'),
|
||||
water_mask_path=self.config.get('step1', {}).get('mask_path'),
|
||||
csv_path=self.config.get('step4', {}).get('csv_path'),
|
||||
boundary_path=self.config.get('step5', {}).get('boundary_path'),
|
||||
boundary_shp_path=self.config.get('step14', {}).get('boundary_shp_path'),
|
||||
formula_csv_path=self.config.get('step12', {}).get('formula_csv_path'),
|
||||
csv_path=self.config.get('step4_sampling', {}).get('csv_path'),
|
||||
boundary_path=self.config.get('step5_clean', {}).get('boundary_path'),
|
||||
boundary_shp_path=self.config.get('step11_map', {}).get('boundary_shp_path'),
|
||||
formula_csv_path=self.config.get('step8_non_empirical_modeling', {}).get('formula_csv_path'),
|
||||
work_dir=self.work_dir,
|
||||
user_config=self.config
|
||||
)
|
||||
@ -323,21 +323,16 @@ class WorkerThread(QThread):
|
||||
'step1': 'step1_generate_water_mask',
|
||||
'step2': 'step2_find_glint_area',
|
||||
'step3': 'step3_remove_glint',
|
||||
'step4': 'step5_process_csv',
|
||||
'step5': 'step6_extract_spectra',
|
||||
'step7': 'step7_calc_indices',
|
||||
'step4_sampling': 'step4_sampling',
|
||||
'step5_clean': 'step5_process_csv',
|
||||
'step6_feature': 'step6_extract_spectra',
|
||||
'step7_index': 'step7_calc_indices',
|
||||
'step8': 'step8_train_ml',
|
||||
'step8_ml_train': 'step8_train_ml',
|
||||
'step8_non_empirical_modeling': 'step8_non_empirical_modeling',
|
||||
'step8_qaa': 'step8_qaa_inversion',
|
||||
'step9': 'step9_watercolor_inversion',
|
||||
'step9_ml_predict': 'step9_predict_ml',
|
||||
'step10': 'step4_sampling',
|
||||
'step10_map': 'step10_map',
|
||||
'step11_ml': 'step9_predict_ml',
|
||||
'step11': 'step11_non_empirical_prediction',
|
||||
'step14': 'step10_map'
|
||||
'step10_watercolor': 'step9_watercolor_inversion',
|
||||
'step11_map': 'step10_map',
|
||||
}
|
||||
|
||||
if step_name not in step_method_map:
|
||||
@ -367,17 +362,9 @@ class WorkerThread(QThread):
|
||||
|
||||
step_config['skip_dependency_check'] = True
|
||||
|
||||
if step_name == 'step14':
|
||||
step_config.pop('step9_batch_mode', None)
|
||||
step_config.pop('prediction_csv_dir', None)
|
||||
step_config.pop('recursive_csv_scan', None)
|
||||
|
||||
if step_name in ['step2', 'step3', 'step4', 'step5', 'step7', 'step10', 'step11_ml', 'step11', 'step12']:
|
||||
if step_name in ['step2', 'step3', 'step4_sampling', 'step5_clean', 'step7_index', 'step9_ml_predict']:
|
||||
step_config.pop('output_path', None)
|
||||
|
||||
if step_name == 'step11' and 'models_dir' in step_config:
|
||||
step_config['non_empirical_models_dir'] = step_config.pop('models_dir')
|
||||
|
||||
method = getattr(self.pipeline, method_name)
|
||||
result = method(**step_config)
|
||||
|
||||
@ -436,100 +423,76 @@ class WorkerThread(QThread):
|
||||
" → 请确认「耀斑去除」已成功运行,或重新配置路径。"
|
||||
)
|
||||
|
||||
# ── 步骤4:实测水质数据 CSV ──
|
||||
step4_cfg = config.get('step4', {})
|
||||
# ── 步骤4_sampling:实测水质数据 CSV ──
|
||||
step4_cfg = config.get('step4_sampling', {})
|
||||
csv_path = step4_cfg.get('csv_path')
|
||||
if csv_path and not os.path.isfile(csv_path):
|
||||
errors.append(
|
||||
f"步骤 4:实测水质数据文件不存在:\n {csv_path}\n"
|
||||
f"步骤 4_sampling:实测水质数据文件不存在:\n {csv_path}\n"
|
||||
" → 请检查 CSV 路径是否正确,或重新上传数据文件。"
|
||||
)
|
||||
|
||||
# ── 步骤5:采样点平均光谱提取 ──
|
||||
step5_cfg = config.get('step5', {})
|
||||
# ── 步骤5_clean:采样点平均光谱提取 ──
|
||||
step5_cfg = config.get('step5_clean', {})
|
||||
step5_csv = step5_cfg.get('csv_path')
|
||||
boundary_path = step5_cfg.get('boundary_path')
|
||||
if step5_csv and not os.path.isfile(step5_csv):
|
||||
errors.append(
|
||||
f"步骤 5:实测水质数据文件不存在:\n {step5_csv}\n"
|
||||
f"步骤 5_clean:实测水质数据文件不存在:\n {step5_csv}\n"
|
||||
" → 请检查「流程步骤-阶段五」中的 CSV 路径。"
|
||||
)
|
||||
if boundary_path and not os.path.isfile(boundary_path):
|
||||
errors.append(
|
||||
f"步骤 5:边界矢量文件不存在:\n {boundary_path}\n"
|
||||
f"步骤 5_clean:边界矢量文件不存在:\n {boundary_path}\n"
|
||||
" → 请确认「流程步骤-阶段五」中已填写有效的边界 shp 路径。"
|
||||
)
|
||||
|
||||
# ── 步骤6(水质光谱指数):训练光谱 CSV ──
|
||||
step6_cfg = config.get('step6', {})
|
||||
# ── 步骤6_feature(水质光谱指数):训练光谱 CSV ──
|
||||
step6_cfg = config.get('step6_feature', {})
|
||||
training_csv = step6_cfg.get('training_csv_path')
|
||||
if training_csv and not os.path.isfile(training_csv):
|
||||
errors.append(
|
||||
f"步骤 6(水质光谱指数):训练光谱文件不存在:\n {training_csv}\n"
|
||||
" → 请确认步骤 5 已成功运行并生成了训练光谱。"
|
||||
f"步骤 6_feature(水质光谱指数):训练光谱文件不存在:\n {training_csv}\n"
|
||||
" → 请确认步骤 5_clean 已成功运行并生成了训练光谱。"
|
||||
)
|
||||
|
||||
# ── 步骤7(ML 建模) ──
|
||||
step7_cfg = config.get('step7', {})
|
||||
# ── 步骤8_ml_train(ML 建模) ──
|
||||
step7_cfg = config.get('step8_ml_train', {})
|
||||
step7_csv = step7_cfg.get('training_csv_path')
|
||||
if step7_csv and not os.path.isfile(step7_csv):
|
||||
errors.append(
|
||||
f"步骤 7(ML 建模):训练光谱文件不存在:\n {step7_csv}\n"
|
||||
" → 请确认步骤 5 已成功运行并生成了训练光谱。"
|
||||
f"步骤 8_ml_train(ML 建模):训练光谱文件不存在:\n {step7_csv}\n"
|
||||
" → 请确认步骤 5_clean 已成功运行并生成了训练光谱。"
|
||||
)
|
||||
|
||||
# ── 步骤11 ML 预测:密集采样点 CSV + 模型目录 ──
|
||||
step11_ml_cfg = config.get('step11_ml', {})
|
||||
ml_csv = step11_ml_cfg.get('sampling_csv_path')
|
||||
models_dir = step11_ml_cfg.get('models_dir')
|
||||
# ── 步骤9_ml_predict:密集采样点 CSV + 模型目录 ──
|
||||
step9_cfg = config.get('step9_ml_predict', {})
|
||||
ml_csv = step9_cfg.get('sampling_csv_path')
|
||||
models_dir = step9_cfg.get('models_dir')
|
||||
if ml_csv and not os.path.isfile(ml_csv):
|
||||
errors.append(
|
||||
f"步骤 11 ML 预测:采样点 CSV 不存在:\n {ml_csv}\n"
|
||||
f"步骤 9_ml_predict:采样点 CSV 不存在:\n {ml_csv}\n"
|
||||
" → 请确认「流程步骤-阶段七(采样点布设)」已成功运行。"
|
||||
)
|
||||
if models_dir and not os.path.isdir(models_dir):
|
||||
errors.append(
|
||||
f"步骤 11 ML 预测:模型目录不存在:\n {models_dir}\n"
|
||||
f"步骤 9_ml_predict:模型目录不存在:\n {models_dir}\n"
|
||||
" → 请确认「流程步骤-阶段六(机器学习建模)」已成功运行。"
|
||||
)
|
||||
|
||||
# ── 步骤11 回归预测:模型目录 ──
|
||||
step11_cfg = config.get('step11', {})
|
||||
step11_csv = step11_cfg.get('sampling_csv_path')
|
||||
step11_dir = step11_cfg.get('models_dir')
|
||||
if step11_csv and not os.path.isfile(step11_csv):
|
||||
errors.append(
|
||||
f"步骤 11 回归预测:采样点 CSV 不存在:\n {step11_csv}\n"
|
||||
" → 请确认「流程步骤-阶段七(采样点布设)」已成功运行。"
|
||||
)
|
||||
if step11_dir and not os.path.isdir(step11_dir):
|
||||
errors.append(
|
||||
f"步骤 11 回归预测:模型目录不存在:\n {step11_dir}\n"
|
||||
" → 请确认「流程步骤-阶段八(非经验建模)」已成功运行。"
|
||||
)
|
||||
|
||||
# ── 步骤12 自定义回归预测:公式 CSV ──
|
||||
step12_cfg = config.get('step12', {})
|
||||
formula_csv = step12_cfg.get('formula_csv_path')
|
||||
if formula_csv and not os.path.isfile(formula_csv):
|
||||
errors.append(
|
||||
f"步骤 12(自定义回归预测):公式 CSV 文件不存在:\n {formula_csv}\n"
|
||||
" → 请确认「流程步骤-阶段十二」中已填写有效的公式文件路径。"
|
||||
)
|
||||
|
||||
# ── 步骤14 专题图:预测结果 CSV + 边界 shp ──
|
||||
step14_cfg = config.get('step14', {})
|
||||
pred_csv = step14_cfg.get('prediction_csv_path')
|
||||
boundary_shp = step14_cfg.get('boundary_shp_path')
|
||||
# ── 步骤11_map 专题图:预测结果 CSV + 边界 shp ──
|
||||
step11_cfg = config.get('step11_map', {})
|
||||
pred_csv = step11_cfg.get('prediction_csv_path')
|
||||
boundary_shp = step11_cfg.get('boundary_shp_path')
|
||||
if pred_csv and not os.path.isfile(pred_csv):
|
||||
errors.append(
|
||||
f"步骤 14(专题图):预测结果 CSV 不存在:\n {pred_csv}\n"
|
||||
f"步骤 11_map(专题图):预测结果 CSV 不存在:\n {pred_csv}\n"
|
||||
" → 请确认机器学习或回归预测步骤已成功运行。"
|
||||
)
|
||||
if boundary_shp and not os.path.isfile(boundary_shp):
|
||||
errors.append(
|
||||
f"步骤 14(专题图):边界 shp 文件不存在:\n {boundary_shp}\n"
|
||||
" → 请确认「流程步骤-阶段十四」中已填写有效的边界矢量文件路径。"
|
||||
f"步骤 11_map(专题图):边界 shp 文件不存在:\n {boundary_shp}\n"
|
||||
" → 请确认「流程步骤-阶段十一」中已填写有效的边界矢量文件路径。"
|
||||
)
|
||||
|
||||
# ── 汇总报错:任一缺失立即抛出 PipelineHalt ──
|
||||
|
||||
Reference in New Issue
Block a user