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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tuple object is not callable #15

Open
sahilmodi opened this issue Mar 31, 2022 · 1 comment
Open

Tuple object is not callable #15

sahilmodi opened this issue Mar 31, 2022 · 1 comment

Comments

@sahilmodi
Copy link

sahilmodi commented Mar 31, 2022

Hello,

I am trying to reproduce the training for resnet18 with the following command:

python tools/train.py configs/r18_sgd_cos_100e_r2_1xNx8_k400.py

but I receive the following error within mmaction:

...
2022-03-31 11:09:23,556 - mmaction - INFO - workflow: [('train', 1)], max: 100 epochs
2022-03-31 11:09:23,556 - mmaction - INFO - Checkpoints will be saved to /home/smodi9/cs598/VFS/work_dirs/r18_sgd_cos_100e_r2_1xNx8_k400 by HardDiskBackend.
Traceback (most recent call last):
  File "tools/train.py", line 181, in <module>
    main()
  File "tools/train.py", line 177, in main
    meta=meta)
  File "/home/smodi9/cs598/VFS/mmaction/apis/train.py", line 119, in train_model
    runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
  File "/home/smodi9/miniconda3/envs/vfs/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 127, in run
    epoch_runner(data_loaders[i], **kwargs)
  File "/home/smodi9/miniconda3/envs/vfs/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 47, in train
    for i, data_batch in enumerate(self.data_loader):
  File "/home/smodi9/miniconda3/envs/vfs/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 517, in __next__
    data = self._next_data()
  File "/home/smodi9/miniconda3/envs/vfs/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1199, in _next_data
    return self._process_data(data)
  File "/home/smodi9/miniconda3/envs/vfs/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1225, in _process_data
    data.reraise()
  File "/home/smodi9/miniconda3/envs/vfs/lib/python3.7/site-packages/torch/_utils.py", line 429, in reraise
    raise self.exc_type(msg)
TypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/home/smodi9/miniconda3/envs/vfs/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 202, in _worker_loop
    data = fetcher.fetch(index)
  File "/home/smodi9/miniconda3/envs/vfs/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/smodi9/miniconda3/envs/vfs/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/smodi9/cs598/VFS/mmaction/datasets/dataset_wrappers.py", line 26, in __getitem__
    return self.dataset[idx % self._ori_len]
  File "/home/smodi9/cs598/VFS/mmaction/datasets/base.py", line 139, in __getitem__
    data = self.prepare_train_frames(idx)
  File "/home/smodi9/cs598/VFS/mmaction/datasets/base.py", line 119, in prepare_train_frames
    return self.pipeline(results)
  File "/home/smodi9/cs598/VFS/mmaction/datasets/pipelines/compose.py", line 41, in __call__
    data = t(data)
  File "/home/smodi9/cs598/VFS/mmaction/datasets/pipelines/augmentations.py", line 1315, in __call__
    img = np.array(trans(Image.fromarray(img)))
TypeError: 'tuple' object is not callable

I followed the instructions in the installation README and I believe the issue is caused by _ColorJitter.get_params(...) which returns a tuple. I am on Pytorch 1.8 and Torchvision 0.9.0.

Any help would be greatly appreciated!

@xvjiarui
Copy link
Owner

xvjiarui commented Apr 1, 2022

Hi @sahilmodi
A quick fix would be use PyTorch 1.6 and corresponding torch vision.

I will create a PR to fix it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants