feat: implement comprehensive land cover classification pipeline with model benchmarking and experiment logging

This commit is contained in:
2026-07-17 18:54:25 +07:00
parent a258db54cd
commit abab846884
69 changed files with 155558 additions and 105 deletions
+17
View File
@@ -9,6 +9,7 @@ from typing import Tuple, Optional, Dict
from sklearn.neighbors import KNeighborsRegressor
from sklearn.ensemble import RandomForestRegressor
import warnings
from pathlib import Path
warnings.filterwarnings('ignore')
@@ -375,6 +376,22 @@ class DeepInpaintingStrategy(CloudRemovalStrategy):
# Convert to tensor and add batch dimension
input_tensor = torch.from_numpy(input_array).unsqueeze(0).to(self.device)
if hasattr(self.model, 'encoder'):
# Custom UNet from train_cloud_removal.py
expected_channels = self.model.encoder[0].double_conv[0].in_channels
elif hasattr(self.model, 'inc') and hasattr(self.model.inc.double_conv[0], 'in_channels'):
expected_channels = self.model.inc.double_conv[0].in_channels
elif hasattr(self.model, 'conv1') and hasattr(self.model.conv1, 'in_channels'):
expected_channels = self.model.conv1.in_channels
else:
expected_channels = 6
if expected_channels > input_tensor.shape[1]:
pad_channels = expected_channels - input_tensor.shape[1]
padding = torch.zeros(1, pad_channels, *input_tensor.shape[2:]).to(self.device)
input_tensor = torch.cat([input_tensor, padding], dim=1)
# Run through U-Net
with torch.no_grad():
output_tensor = self.model(input_tensor)