Skip to content

Image size error when training with Swin Backbone and CIFAR datasets #324

@ImaGonEs

Description

@ImaGonEs

Problem
When I try to run CIFAR datasets with Swin-Tiny Backbone, it return the error:
"AssertionError: Input image height (32) doesn't match model (224)."

Reproducibility
I'm using the following configuration file:

defaults:
  - _self_
  - augmentations: asymmetric.yaml
  - wandb: private.yaml
  - override hydra/hydra_logging: disabled
  - override hydra/job_logging: disabled



hydra:
  output_subdir: null
  run:
    dir: .

name: "nnclr-cifar100" # change here for cifar100
method: "nnclr"
backbone:
  name: "swin_tiny"
method_kwargs:
  temperature: 0.2
  proj_hidden_dim: 2048
  pred_hidden_dim: 4096
  proj_output_dim: 256
  queue_size: 98304
data:
  dataset: cifar100 # change here for cifar100
  train_path: "./datasets"
  val_path: "./datasets"
  format: "image_folder"
  num_workers: 4
optimizer:
  name: "lars"
  batch_size: 256
  lr: 0.4
  classifier_lr: 0.1
  weight_decay: 1e-5
  kwargs:
    clip_lr: True
    eta: 0.02
    exclude_bias_n_norm: True
scheduler:
  name: "warmup_cosine"
checkpoint:
  enabled: True
  dir: "trained_models"
  frequency: 1
auto_resume:
  enabled: False

# overwrite PL stuff
max_epochs: 1000
devices: [0]
sync_batchnorm: True
accelerator: "gpu"
strategy: "ddp"
precision: 16

Version used
I'm running the 92ec35f54a507fb5d4edc1dc5723abc022b39eb3 version of the library and this is my environment:

aiohttp==3.8.3
aiosignal==1.3.1
antlr4-python3-runtime==4.9.3
appdirs==1.4.4
astunparse==1.6.3
async-timeout==4.0.2
attrs==22.2.0
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==2.1.1
click==8.1.3
contourpy==1.0.7
cycler==0.11.0
docker-pycreds==0.4.0
einops==0.6.0
filelock==3.9.0
fonttools==4.38.0
frozenlist==1.3.3
fsspec==2023.1.0
gast==0.4.0
gitdb==4.0.10
GitPython==3.1.30
h5py==3.8.0
huggingface-hub==0.12.0
hydra-core==1.3.1
idna==3.4
joblib==1.2.0
kiwisolver==1.4.4
lightning-bolts==0.6.0.post1
lightning-utilities==0.6.0.post0
llvmlite==0.39.1
matplotlib==3.6.3
multidict==6.0.4
numba==0.56.4
numpy==1.23.5
nvidia-cublas-cu11==11.10.3.66
nvidia-cuda-nvrtc-cu11==11.7.99
nvidia-cuda-runtime-cu11==11.7.99
nvidia-cudnn-cu11==8.5.0.96
nvidia-dali-cuda110==1.22.0
omegaconf==2.3.0
packaging==23.0
pandas==1.5.3
pathtools==0.1.2
Pillow==9.4.0
positional-encodings==6.0.1
protobuf==3.20.1
psutil==5.9.4
pynndescent==0.5.8
pyparsing==3.0.9
python-dateutil==2.8.2
pytorch-lightning==1.8.6
pytz==2022.7.1
PyYAML==6.0
requests==2.28.2
scikit-learn==1.2.1
scipy==1.10.0
seaborn==0.12.2
sentry-sdk==1.14.0
setproctitle==1.3.2
six==1.16.0
smmap==5.0.0
-e git+ssh://[email protected]/ImaGonEs/MyNewSolo.git@68e680143284db1992518146f075206e64e451ae#egg=solo_learn
tensorboardX==2.5.1
threadpoolctl==3.1.0
timm==0.6.12
torch==1.13.1
torchmetrics==0.11.0
torchvision==0.14.1
tqdm==4.64.1
typing_extensions==4.4.0
umap-learn==0.5.3
urllib3==1.26.14
wandb==0.13.9
yarl==1.8.2`

Additional comments
I think that on older versions of the library (before the omegaconf update) I could run the Swin Backbone without problems. Also, I believe that, at first, there was a line that changed the window size from 7 to 4 in the case of CIFAR dataset but I can't find it anymore.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions