Project-MONAI / Project-MONAI/MONAI

Make more (random) transforms traceable

Open
#7,632 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.7k
Forks
1.6k
Avg merge
5d 1h
Merged PRs (30d)
20

Description

Is your feature request related to a problem? Please describe.
Knowing which transforms were applied to a sample can be very helpful in debugging the current transform pipeline and odd samples. Unfortunately it seems like currently only spatial transforms implement the TraceableTransform. This makes it hard to debug samples with overly agressive noise settings for example.
Describe the solution you'd like
Implement the TraceableTransform for more/most monai transforms

Additional context
The transforms might often not record all information (e.g. the complete noise tensor of a GaussianNoise transform), but just whether they were applied or which scalars were sampled for the final noise in the iteration is already very useful (e.g. the standard deviation of the noise)

In case it's useful later, this is a small script I used to get an overview of what implements TraceableTransform

from monai import transforms
import pandas as pd
data = []

for item in dir(transforms):
    cls = getattr(transforms, item)
    if not isinstance(cls, type):
        continue
    is_transform = issubclass(cls, transforms.Transform)
    if not is_transform:
        continue
    if item.endswith('Dict') or item.endswith('D'):
        continue
    is_dict_transform = issubclass(cls, transforms.MapTransform)
    is_randomizable = issubclass(cls, transforms.RandomizableTransform)
    is_traceable = issubclass(cls, transforms.TraceableTransform)
    is_invertible = issubclass(cls, transforms.InvertibleTransform)
    data.append({
        'name': item,
        'is_dict_transform': is_dict_transform,
        'is_randomizable': is_randomizable,
        'is_traceable': is_traceable,
        'is_invertible': is_invertible,
    })

df = pd.DataFrame(data)
df.to_excel('transform_list.xlsx', index=False)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the TraceableTransform and RandomizableTransform implementations and run the provided inventory script against monai.transforms. Identify which random transforms lack tracing and determine the useful sampled state each should record. Done means the selected transforms implement TraceableTransform with tests covering their recorded application or sampled parameters.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.