notebooks icon indicating copy to clipboard operation
notebooks copied to clipboard

Error in image_classification.ipynb

Open lilyaYAHIAOUI opened this issue 2 years ago • 4 comments
trafficstars

@Rocketknight1 @NielsRogge @NimaBoscarino I got an issue

val_transforms = Compose(
        [
            Resize(feature_extractor.size),
            CenterCrop(feature_extractor.size),
            ToTensor(),
            normalize,
        ]
    )

I got the following error TypeError: Size should be int or sequence. Got <class 'dict'> It can easily solved by changing

val_transforms = Compose(
        [
            Resize((feature_extractor.size['height'],feature_extractor.size['width']) ),
            CenterCrop(feature_extractor.size),
            ToTensor(),
            normalize,
        ]
    )

train_transforms = Compose(
        [
            RandomResizedCrop((feature_extractor.size['height'],feature_extractor.size['width'])),
            RandomHorizontalFlip(),
            ToTensor(),
            normalize,
        ]
    )

lilyaYAHIAOUI avatar Apr 25 '23 18:04 lilyaYAHIAOUI

This looks like an issue in the Torch notebook rather than the TF one - @amyeroberts do you know who wrote the original torch version?

Rocketknight1 avatar Apr 26 '23 12:04 Rocketknight1

@lilyaYAHIAOUI Thanks for reporting and opening a PR!

@Rocketknight1 No idea - probably @NielsRogge :)

amyeroberts avatar Apr 26 '23 12:04 amyeroberts

The image classification notebooks require an update as they still rely on feature extractors.

NielsRogge avatar Apr 29 '23 09:04 NielsRogge

@NielsRogge I updated image_classification.ipynb and image_classification_albumentation.ipynb,I will take for the remaining notebooks.

lilyaYAHIAOUI avatar Apr 29 '23 23:04 lilyaYAHIAOUI