Skip to content

Transform synchronization #100

Closed
@aylward

Description

@aylward

Reported by @HastingsGreer @brad-t-moore @floryst

The transforms are synchronized by resetting the random seed, which I guess is fine. Documentation might be needed to clarify that (this is hypothetical)

imtrans=transforms.Compose([
    Rescale(),
    AddChannel(),
    AddGaussianNoise(sigma=.5),
    UniformRandomPatch((64, 64, 64)),
    ToTensor()
 ])    

segtrans=transforms.Compose([
    AddChannel(),
    UniformRandomPatch((64, 64, 64)),
    ToTensor()
])  

wouldn’t work because the AddGaussianNoise layer would desync the random seeds. This would be hard to debug as a beginner!

One guard against this is to check that the random seed is still synchronized after applying the transforms. I put a proof of concept at
HastingsGreer@2295721

Another option is to somehow enforce that random transforms that should apply to both images and segmentations come before random transforms that only apply to images in the compose object.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions