Skip to content

Enhance evaluation suite to support visualization of multi-input and target#35

Open
wli51 wants to merge 1 commit into
WayScience:mainfrom
wli51:viz-multi-chan
Open

Enhance evaluation suite to support visualization of multi-input and target#35
wli51 wants to merge 1 commit into
WayScience:mainfrom
wli51:viz-multi-chan

Conversation

@wli51

@wli51 wli51 commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Helps with visualization of multi channel dataset and multi channel prediction

…put and multi-target dataset and predictions

@d33bs d33bs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Consider also adding tests to prove these capabilities out a bit more. Given that visualization is involved, it could be helpful to rapidly perform a visual test as well (something static perhaps but that would change in the source diff if something changed).

Comment on lines +13 to +19
def _to_numpy_image(value: Any) -> np.ndarray:
if isinstance(value, torch.Tensor):
return value.detach().cpu().numpy()
return np.asarray(value)


def _normalize_to_list(sample: Any) -> List[np.ndarray]:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider docstrings providing information as to what these do and why.

Comment on lines +85 to +86
inputs.append(input_list[0] if len(input_list) == 1 else input_list)
targets.append(target_list[0] if len(target_list) == 1 else target_list)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the normalization step do this?

Comment on lines +23 to +32
def _to_numpy_image(value: Any) -> np.ndarray:
if isinstance(value, torch.Tensor):
return value.detach().cpu().numpy()
return np.asarray(value)


def _normalize_to_list(sample: Any) -> List[np.ndarray]:
if isinstance(sample, (list, tuple)):
return [_to_numpy_image(item) for item in sample]
return [_to_numpy_image(sample)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These seem to be repeats from another module. Consider reusing them instead of reinventing.

return [_to_numpy_image(sample)]


def _split_channels(img: np.ndarray, channel_indices: Optional[List[int]]) -> List[np.ndarray]:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar comments here, consider adding docstrings for all functions in this PR.

return split_images


def _build_titles(prefix: str, count: int) -> List[str]:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a pretty thin function. Consider a lambda closer to where needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants