How to train deep learning network on own dataset

username: Trishna_Barman
cooked: <p>I have tried to train the TSAN network on other dataset. TSAN code is available on below link:<br>
I have tried to train the TSAN network on other dataset. TSAN code is available on below link:</p>
<aside class="onebox allowlistedgeneric" data-onebox-src="https://github.com/Jee-King/TSAN/">
  <header class="source">
      <img src="https://github.githubassets.com/favicons/favicon.svg" class="site-icon" width="32" height="32">

      <a href="https://github.com/Jee-King/TSAN/" target="_blank" rel="noopener nofollow ugc">GitHub</a>
  </header>

  <article class="onebox-body">
    <div class="aspect-image" style="--aspect-ratio:690/345;"><img src="https://opengraph.githubassets.com/cadb75325e190294db12e0209fb0fb005347b4ba7e35b2621660bc30574470c7/Jee-King/TSAN" class="thumbnail" width="690" height="345"></div>

<h3><a href="https://github.com/Jee-King/TSAN/" target="_blank" rel="noopener nofollow ugc">GitHub - Jee-King/TSAN: A Two-Stage Attentive Network for Single Image...</a></h3>

  <p>A Two-Stage Attentive Network for Single Image Super-Resolution - GitHub - Jee-King/TSAN: A Two-Stage Attentive Network for Single Image Super-Resolution</p>


  </article>

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

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

<p>For that I have made folder named “dataset”. In dataset folder, two sub-folders named “DIV2K_train_HR” and “DIV2K_train_LR_bicubic” are created under DIV2K folder and HR and LR images are stored in the respective folders. In option.py code, I have changed the path: parser.add_argument(’–dir_data’, type=str, default=‘dataset/DIV2K/’, help=‘dataset directory’)</p>
<p>But, while compiling the train code using this following command: python main.py --template TSAN --save TSAN_X2 --scale 2 --reset --save_results --patch_size 96 --ext sep_reset<br>
I got the following error.</p>
<p>%====================================================================<br>
this name DIV2K<br>
Traceback (most recent call last):<br>
File “main_1.py”, line 12, in <br>
loader = data.Data(args)<br>
File “E:\Deep_learning\TSAN\TSAN_patternnet_test\Train\data_<em>init</em>_.py”, line 11, in <strong>init</strong><br>
trainset = getattr(module_train, args.data_train)(args)<br>
File “E:\Deep_learning\TSAN\TSAN_patternnet_test\Train\data\div2k.py”, line 7, in <strong>init</strong><br>
args, name=name, train=train, benchmark=benchmark<br>
File “E:\Deep_learning\TSAN\TSAN_patternnet_test\Train\data\srdata.py”, line 24, in <strong>init</strong><br>
data_range = [r.split(’-’) for r in args.data_range.split(’/’)]<br>
AttributeError: ‘Namespace’ object has no attribute ‘data_range’</p>
<p>Please help me on this regard.</p>

username: thecho7
cooked: <p>I couldn’t find <code>--data-range</code> from the arguments.<br>
It might be modified.</p>

username: Trishna_Barman
cooked: <p><a class="mention" href="/u/thecho7">@thecho7</a> In the option.py, data_range argument is not defined. I have defined the data_range in such way:<br>
parser.add_argument(’–data_range’, type=str, default=‘1-2/3-4’, help=‘train/test data range’)</p>
<p>I have kept 4 images in DIV2K HR and LR folder. Batch size I have considered only 1, but  now I am getting this error:<br>
Traceback (most recent call last):<br>
File “main_1.py”, line 12, in <br>
loader = data.Data(args)<br>
File “E:\Deep_learning\TSAN\TSAN_patternnet_test\Train\data_<em>init</em>_.py”, line 11, in <strong>init</strong><br>
trainset = getattr(module_train, args.data_train)(args)<br>
File “E:\Deep_learning\TSAN\TSAN_patternnet_test\Train\data\div2k.py”, line 7, in <strong>init</strong><br>
args, name=name, train=train, benchmark=benchmark<br>
File “E:\Deep_learning\TSAN\TSAN_patternnet_test\Train\data\srdata.py”, line 87, in <strong>init</strong><br>
= args.test_every // (len(self.images_hr) // args.batch_size)<br>
ZeroDivisionError: integer division or modulo by zero</p>

username: thecho7
cooked: <p>Make sure <code>self.dir_hr</code> in line 92 indicates the directory which contains the .png images inside it.</p>
<p>self.dir_hr<br>
|- 1.png<br>
|- 2.png<br>
…</p>