Skip to content

Commit

Permalink
Rename UNeXt2 (#84)
Browse files Browse the repository at this point in the history
* rename file

* rename the architecture

* fix merge
  • Loading branch information
ziw-liu authored and edyoshikun committed Jun 18, 2024
1 parent 9ae582f commit b4bbf39
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions viscy/light/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def __init__(
test_cellpose_diameter: float = None,
test_evaluate_cellpose: bool = False,
test_time_augmentations: bool = False,
tta_type: Literal["mean", "median","product"] = "mean",
tta_type: Literal["mean", "median", "product"] = "mean",
) -> None:
super().__init__()
net_class = _UNET_ARCHITECTURE.get(architecture)
Expand Down Expand Up @@ -364,7 +364,9 @@ def predict_step(self, batch: Sample, batch_idx: int, dataloader_idx: int = 0):
prediction = torch.stack(predictions).cpu().median(dim=0).values
elif self.tta_type == "product":
# Perform multiplication of predictions in logarithmic space for numerical stability adding epsion to avoid log(0) case
log_predictions = torch.stack([torch.log(p + 1e-9) for p in predictions])
log_predictions = torch.stack(
[torch.log(p + 1e-9) for p in predictions]
)
log_prediction_sum = log_predictions.sum(dim=0)
prediction = torch.exp(log_prediction_sum)
# Put back to GPU
Expand Down

0 comments on commit b4bbf39

Please sign in to comment.