Skip to content

Commit 741d836

Browse files
committed
Remove legacy config fields and their fallback logic
Completely removes deprecated configuration fields instead of just comments: **Removed Config Fields:** 1. `DataConfig.test_transpose` - Use `inference.data.test_transpose` instead 2. `TestTimeAugmentationConfig.act` - Use `channel_activations` instead **Removed Fallback Logic:** 1. build.py: Remove cfg.data.test_transpose fallback (lines 262-263) - Now only uses cfg.inference.data.test_transpose 2. lit_model.py: Remove single activation fallback (lines 331-348) - Now requires channel_activations for TTA **Impact:** - 3 files modified - 24 lines removed - Breaking change: Old configs using deprecated fields will no longer work - Users must update to modern config structure
1 parent 9638774 commit 741d836

File tree

3 files changed

+2
-24
lines changed

3 files changed

+2
-24
lines changed

connectomics/config/hydra_config.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ class DataConfig:
392392
default_factory=list
393393
) # Axis permutation for training data (e.g., [2,1,0] for xyz->zyx)
394394
val_transpose: List[int] = field(default_factory=list) # Axis permutation for validation data
395-
test_transpose: List[int] = field(default_factory=list) # Axis permutation for test data
396395

397396
# Dataset statistics (for auto-planning)
398397
target_spacing: Optional[List[float]] = None # Target voxel spacing [z, y, x] in mm
@@ -866,7 +865,6 @@ class TestTimeAugmentationConfig:
866865
flip_axes: Any = (
867866
None # TTA flip strategy: "all" (8 flips), null (no aug), or list like [[0], [1], [2]]
868867
)
869-
act: Optional[str] = None # Single activation for all channels: 'softmax', 'sigmoid', 'tanh', None
870868
channel_activations: Optional[List[Any]] = (
871869
None # Per-channel activations: [[start_ch, end_ch, 'activation'], ...] e.g., [[0, 2, 'softmax'], [2, 3, 'sigmoid'], [3, 4, 'tanh']]
872870
)

connectomics/data/augment/build.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,15 @@ def _build_eval_transforms_impl(
257257
if mode == "val":
258258
transpose_axes = cfg.data.val_transpose if cfg.data.val_transpose else []
259259
else: # mode == "test"
260-
# Check both data.test_transpose and inference.data.test_transpose
260+
# Use inference.data.test_transpose
261261
transpose_axes = []
262-
if cfg.data.test_transpose:
263-
transpose_axes = cfg.data.test_transpose
264262
if (
265263
hasattr(cfg, "inference")
266264
and hasattr(cfg.inference, "data")
267265
and hasattr(cfg.inference.data, "test_transpose")
268266
and cfg.inference.data.test_transpose
269267
):
270-
transpose_axes = cfg.inference.data.test_transpose # inference takes precedence
268+
transpose_axes = cfg.inference.data.test_transpose
271269

272270
transforms.append(
273271
LoadVolumed(keys=keys, transpose_axes=transpose_axes if transpose_axes else None)

connectomics/lightning/lit_model.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -328,24 +328,6 @@ def _apply_tta_preprocessing(self, tensor: torch.Tensor) -> torch.Tensor:
328328

329329
# Concatenate all channels back together
330330
tensor = torch.cat(activated_channels, dim=1)
331-
else:
332-
# Fall back to single activation for all channels (old approach)
333-
tta_act = getattr(self.cfg.inference.test_time_augmentation, 'act', None)
334-
if tta_act is None:
335-
tta_act = getattr(self.cfg.inference, 'output_act', None)
336-
337-
# Apply activation function
338-
if tta_act == 'softmax':
339-
tensor = torch.softmax(tensor, dim=1)
340-
elif tta_act == 'sigmoid':
341-
tensor = torch.sigmoid(tensor)
342-
elif tta_act == 'tanh':
343-
tensor = torch.tanh(tensor)
344-
elif tta_act is not None and tta_act.lower() != 'none':
345-
warnings.warn(
346-
f"Unknown TTA activation function '{tta_act}'. Supported: 'softmax', 'sigmoid', 'tanh', None",
347-
UserWarning,
348-
)
349331

350332
# Get TTA-specific channel selection or fall back to output_channel
351333
tta_channel = getattr(self.cfg.inference.test_time_augmentation, 'select_channel', None)

0 commit comments

Comments
 (0)