avans06 commited on
Commit
8cbd0a5
·
1 Parent(s): 308a135

Added support for parsing ATD models from the ATD project by author LabShuHangGU.

Browse files
Files changed (1) hide show
  1. app.py +28 -4
app.py CHANGED
@@ -270,15 +270,17 @@ Optimized primarily for PAL resolution (NTSC might work good as well)."""],
270
  "https://openmodeldb.info/models/4x-NomosWebPhoto-RealPLKSR",
271
  """4x RealPLKSR model for photography, trained with realistic noise, lens blur, jpg and webp re-compression."""],
272
 
 
273
  "4xNomos2_hq_drct-l.pth" : ["https://github.com/Phhofm/models/releases/download/4xNomos2_hq_drct-l/4xNomos2_hq_drct-l.pth",
274
  "https://github.com/Phhofm/models/releases/tag/4xNomos2_hq_drct-l",
275
  """An drct-l 4x upscaling model, similiar to the 4xNomos2_hq_atd, 4xNomos2_hq_dat2 and 4xNomos2_hq_mosr models, trained and for usage on non-degraded input to give good quality output.
276
  """],
277
 
278
- # "4xNomos2_hq_atd.pth" : ["https://github.com/Phhofm/models/releases/download/4xNomos2_hq_atd/4xNomos2_hq_atd.pth",
279
- # "https://github.com/Phhofm/models/releases/tag/4xNomos2_hq_atd",
280
- # """An atd 4x upscaling model, similiar to the 4xNomos2_hq_dat2 or 4xNomos2_hq_mosr models, trained and for usage on non-degraded input to give good quality output.
281
- # """]
 
282
  }
283
 
284
  example_list = ["images/a01.jpg", "images/a02.jpg", "images/a03.jpg", "images/a04.jpg", "images/bus.jpg", "images/zidane.jpg",
@@ -425,6 +427,28 @@ class Upscale:
425
  conv_scale= 0.01, overlap_ratio= 0.5, img_range= 1., depths=depths,
426
  embed_dim=embed_dim, num_heads=num_heads, gc= 32,
427
  mlp_ratio=mlp_ratio, upsampler=upsampler, resi_connection= '1conv')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
 
429
  self.upsampler = None
430
  if model:
 
270
  "https://openmodeldb.info/models/4x-NomosWebPhoto-RealPLKSR",
271
  """4x RealPLKSR model for photography, trained with realistic noise, lens blur, jpg and webp re-compression."""],
272
 
273
+ # DRCT
274
  "4xNomos2_hq_drct-l.pth" : ["https://github.com/Phhofm/models/releases/download/4xNomos2_hq_drct-l/4xNomos2_hq_drct-l.pth",
275
  "https://github.com/Phhofm/models/releases/tag/4xNomos2_hq_drct-l",
276
  """An drct-l 4x upscaling model, similiar to the 4xNomos2_hq_atd, 4xNomos2_hq_dat2 and 4xNomos2_hq_mosr models, trained and for usage on non-degraded input to give good quality output.
277
  """],
278
 
279
+ # ATD
280
+ "4xNomos2_hq_atd.pth" : ["https://github.com/Phhofm/models/releases/download/4xNomos2_hq_atd/4xNomos2_hq_atd.pth",
281
+ "https://github.com/Phhofm/models/releases/tag/4xNomos2_hq_atd",
282
+ """An atd 4x upscaling model, similiar to the 4xNomos2_hq_dat2 or 4xNomos2_hq_mosr models, trained and for usage on non-degraded input to give good quality output.
283
+ """],
284
  }
285
 
286
  example_list = ["images/a01.jpg", "images/a02.jpg", "images/a03.jpg", "images/a04.jpg", "images/bus.jpg", "images/zidane.jpg",
 
427
  conv_scale= 0.01, overlap_ratio= 0.5, img_range= 1., depths=depths,
428
  embed_dim=embed_dim, num_heads=num_heads, gc= 32,
429
  mlp_ratio=mlp_ratio, upsampler=upsampler, resi_connection= '1conv')
430
+ elif upscale_type == "ATD":
431
+ half = False
432
+ from basicsr.archs.atd_arch import ATD
433
+ window_size = 16
434
+ depths=[6, 6, 6, 6, 6, 6,]
435
+ embed_dim=210
436
+ num_heads=[6, 6, 6, 6, 6, 6,]
437
+ mlp_ratio=2
438
+ upsampler='pixelshuffle'
439
+ model = ATD(upscale=self.netscale,
440
+ embed_dim=embed_dim,
441
+ depths=depths,
442
+ num_heads=num_heads,
443
+ window_size=window_size,
444
+ category_size=256,
445
+ num_tokens=128,
446
+ reducted_dim=20,
447
+ convffn_kernel_size=5,
448
+ mlp_ratio=mlp_ratio,
449
+ upsampler=upsampler,
450
+ use_checkpoint=False,
451
+ )
452
 
453
  self.upsampler = None
454
  if model: