feat(sampling): add adaptive sampling toggle + interactive sampling point viewer
This commit is contained in:
@ -26,6 +26,7 @@ class PredictionStep:
|
||||
glint_mask_path: Optional[str] = None,
|
||||
output_dir: Union[str, Path] = "./10_sampling",
|
||||
callback: Optional[Callable] = None,
|
||||
use_adaptive_sampling: bool = True,
|
||||
) -> str:
|
||||
"""生成水域掩膜内且耀斑掩膜外的采样点,统计平均光谱"""
|
||||
from pathlib import Path
|
||||
@ -83,10 +84,14 @@ class PredictionStep:
|
||||
if glint_mask_to_use is None:
|
||||
print("未检测到耀斑掩膜,将在采样点生成时不做耀斑区域剔除。")
|
||||
|
||||
# 传递极度安全的 deglint_img_str 进底层
|
||||
# 传递极度安全的 deglint_img_str 进底层(关键字传参,避免 positional 参数顺序陷阱)
|
||||
get_spectral_sampling_points_chunked(
|
||||
deglint_img_str, water_mask_path, glint_mask_to_use,
|
||||
output_path, interval, sample_radius, chunk_size
|
||||
output_path,
|
||||
interval=interval,
|
||||
sample_radius=sample_radius,
|
||||
chunk_size=chunk_size,
|
||||
use_adaptive_sampling=use_adaptive_sampling,
|
||||
)
|
||||
|
||||
notify("completed", f"采样点光谱数据已保存: {output_path}")
|
||||
|
||||
@ -753,17 +753,19 @@ class WaterQualityInversionPipeline:
|
||||
chunk_size: int = 1000,
|
||||
water_mask_path: Optional[str] = None,
|
||||
glint_mask_path: Optional[str] = None,
|
||||
use_adaptive_sampling: bool = True,
|
||||
skip_dependency_check: bool = False, **kwargs) -> str:
|
||||
"""
|
||||
步骤7: 生成根据水域掩膜内且耀斑掩膜外的采样点,统计采样点的平均光谱
|
||||
|
||||
|
||||
Args:
|
||||
deglint_img_path: 去除耀斑后的影像文件路径(如果为None,使用步骤3的结果)
|
||||
interval: 采样点间隔(像元数)
|
||||
sample_radius: 采样点半径(像元数)
|
||||
chunk_size: 每次处理的行数(控制内存使用)
|
||||
water_mask_path: dat格式的水域掩膜文件路径(如果为None,将使用步骤1生成的dat格式掩膜)
|
||||
|
||||
use_adaptive_sampling: 是否启用自适应采样(根据水体宽度动态调整间隔)
|
||||
|
||||
Returns:
|
||||
采样点光谱数据CSV文件路径
|
||||
"""
|
||||
@ -786,6 +788,7 @@ class WaterQualityInversionPipeline:
|
||||
water_mask_path=water_mask_path,
|
||||
glint_mask_path=glint_mask_path,
|
||||
output_dir=str(self.sampling_dir),
|
||||
use_adaptive_sampling=use_adaptive_sampling,
|
||||
)
|
||||
self._record_step_time("步骤7: 生成预测采样点", 0, 0)
|
||||
self._notify("completed", f"采样点光谱数据已保存: {result}")
|
||||
|
||||
Reference in New Issue
Block a user