Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

freeze_transform does not work for datasets with child AvalancheDataset in _datasets #1353

Closed
HeLehm opened this issue Apr 25, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@HeLehm
Copy link

HeLehm commented Apr 25, 2023

馃悰 Description
If an AvalancheDataset (parent) contains other AvalancheDatasets (children) (in _datasets) and .freeze_transforms() is being called on the parent, the children's transforms are not frozen.

馃悳 To Reproduce

def test_avalanche_inherit_groups_freeze_transforms(self):
            original_dataset = MNIST(
                root=default_dataset_location("mnist"), download=True
            )
    
            transform_groups = dict(
                train=(RandomCrop(16), None), eval=(None, None)
            )
            dataset = make_classification_dataset(
                original_dataset, transform_groups=transform_groups
            )
    
            dataset_inherit = make_classification_dataset(dataset)
            x, *_ = dataset_inherit[0]
    
            dataset_frozen = dataset_inherit.freeze_transforms()
            x2, *_ = dataset_frozen[0]
    
            dataset_frozen_reset = dataset_frozen.replace_current_transform_group(
                None
            )
            x3, *_ = dataset_frozen_reset[0]
    
            self.assertEqual(x.size, (16, 16))
            self.assertEqual(x2.size, (16, 16))
            # should be (16, 16) here as RandomCrop(16) should be frozen
            self.assertEqual(x3.size, (16, 16))

馃悵 Expected behavior
I would expect the transforms of the children to also be frozen.
In the example x3 should be an Image of size (16, 16), but it is of size (28, 28), the original MNIST image size.

馃 Additional context
I am working on a fix right now.

@HeLehm HeLehm added the bug Something isn't working label Apr 25, 2023
HeLehm pushed a commit to HeLehm/avalanche that referenced this issue Apr 25, 2023
AntonioCarta added a commit that referenced this issue Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants