RuntimeError: Trying to resize storage that is not resizable

username: Aradhana
cooked: <p>The scenario: Training SWINIR for classical Super resolution.</p>
<ol>
<li>Using Available DIV2K (900 image pairs, using Ground truth and bicubic x2). It works</li>
<li>Using combination of DIV2K and Flickr total 3550 images, facing above issue. Now Flickr pair was not available, therefore I down sized bicubic x2 and create the pairs.</li>
</ol>
<p>To give an idea: ground truth image: 2040 pixels. X2 bicubic: 1020 pixels</p>
<p>I am giving the code github here:</p>
<aside class="onebox githubblob" data-onebox-src="https://github.com/cszn/KAIR/blob/master/docs/README_SwinIR.md">
  <header class="source">

      <a href="https://github.com/cszn/KAIR/blob/master/docs/README_SwinIR.md" target="_blank" rel="noopener nofollow ugc">github.com</a>
  </header>

  <article class="onebox-body">
    <h4><a href="https://github.com/cszn/KAIR/blob/master/docs/README_SwinIR.md" target="_blank" rel="noopener nofollow ugc">cszn/KAIR/blob/master/docs/README_SwinIR.md</a></h4>


      <pre><code class="lang-md"># SwinIR: Image Restoration Using Shifted Window Transformer
[paper](https://arxiv.org/abs/2108.10257)
**|** 
[supplementary](https://github.com/JingyunLiang/SwinIR/releases/tag/v0.0)
**|** 
[visual results](https://github.com/JingyunLiang/SwinIR/releases/tag/v0.0)
**|** 
[original project page](https://github.com/JingyunLiang/SwinIR)
**|**
[online Colab demo](https://colab.research.google.com/gist/JingyunLiang/a5e3e54bc9ef8d7bf594f6fee8208533/swinir-demo-on-real-world-image-sr.ipynb)

[![arXiv](https://img.shields.io/badge/arXiv-Paper-&lt;COLOR&gt;.svg)](https://arxiv.org/abs/2108.10257)
[![GitHub Stars](https://img.shields.io/github/stars/JingyunLiang/SwinIR?style=social)](https://github.com/JingyunLiang/SwinIR)
[![download](https://img.shields.io/github/downloads/JingyunLiang/SwinIR/total.svg)](https://github.com/JingyunLiang/SwinIR/releases)
[ &lt;a href="https://colab.research.google.com/gist/JingyunLiang/a5e3e54bc9ef8d7bf594f6fee8208533/swinir-demo-on-real-world-image-sr.ipynb"&gt;&lt;img src="https://colab.research.google.com/assets/colab-badge.svg" alt="google colab logo"&gt;&lt;/a&gt;](https://colab.research.google.com/gist/JingyunLiang/a5e3e54bc9ef8d7bf594f6fee8208533/swinir-demo-on-real-world-image-sr.ipynb)

&gt; Image restoration is a long-standing low-level vision problem that aims to restore high-quality images from low-quality images (e.g., downscaled, noisy and compressed images). While state-of-the-art image restoration methods are based on convolutional neural networks, few attempts have been made with Transformers which show impressive performance on high-level vision tasks. In this paper, we propose a strong baseline model SwinIR for image restoration based on the Swin Transformer. SwinIR consists of three parts: shallow feature extraction, deep feature extraction and high-quality image reconstruction. In particular, the deep feature extraction module is composed of several residual Swin Transformer blocks (RSTB), each of which has several Swin Transformer layers together with a residual connection. We conduct experiments on three representative tasks: image super-resolution (including classical, lightweight and real-world image super-resolution), image denoising (including grayscale and color image denoising) and JPEG compression artifact reduction. Experimental results demonstrate that SwinIR outperforms state-of-the-art methods on different tasks by up to 0.14~0.45dB, while the total number of parameters can be reduced by up to 67%.


### Dataset Preparation
</code></pre>



  This file has been truncated. <a href="https://github.com/cszn/KAIR/blob/master/docs/README_SwinIR.md" target="_blank" rel="noopener nofollow ugc">show original</a>

  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>Also full error:</p>
<p>Traceback (most recent call last):<br>
File “/data1/aradhana/KAIR/main_train_psnr.py”, line 253, in <br>
main()<br>
File “/data1/aradhana/KAIR/main_train_psnr.py”, line 173, in main<br>
for i, train_data in enumerate(train_loader):<br>
File “/home/aradhana/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/torch/utils/data/dataloader.py”, line 633, in <strong>next</strong><br>
data = self._next_data()<br>
File “/home/aradhana/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/torch/utils/data/dataloader.py”, line 1345, in _next_data<br>
return self._process_data(data)<br>
File “/home/aradhana/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/torch/utils/data/dataloader.py”, line 1371, in _process_data<br>
data.reraise()<br>
File “/home/aradhana/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/torch/_utils.py”, line 644, in reraise<br>
raise exception<br>
RuntimeError: Caught RuntimeError in DataLoader worker process 0.<br>
Original Traceback (most recent call last):<br>
File “/home/aradhana/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py”, line 308, in _worker_loop<br>
data = fetcher.fetch(index)<br>
File “/home/aradhana/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py”, line 54, in fetch<br>
return self.collate_fn(data)<br>
File “/home/aradhana/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/torch/utils/data/_utils/collate.py”, line 265, in default_collate<br>
return collate(batch, collate_fn_map=default_collate_fn_map)<br>
File “/home/aradhana/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/torch/utils/data/_utils/collate.py”, line 127, in collate<br>
return elem_type({key: collate([d[key] for d in batch], collate_fn_map=collate_fn_map) for key in elem})<br>
File “/home/aradhana/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/torch/utils/data/_utils/collate.py”, line 127, in <br>
return elem_type({key: collate([d[key] for d in batch], collate_fn_map=collate_fn_map) for key in elem})<br>
File “/home/aradhana/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/torch/utils/data/_utils/collate.py”, line 119, in collate<br>
return collate_fn_map[elem_type](batch, collate_fn_map=collate_fn_map)<br>
File "/home/aradhana/PycharmProjects/pythonProject/venv/lib/python3.8/site-packages/torch/utils/data/<em>utils/collate.py", line 161, in collate_tensor_fn<br>
out = elem.new(storage).resize</em>(len(batch), *list(elem.size()))<br>
RuntimeError: Trying to resize storage that is not resizable</p>