MCPcopy Create free account
hub / github.com/pytorch/executorch / __init__

Method __init__

examples/mediatek/model_export_scripts/edsr.py:38–53  ·  view source on GitHub ↗
(self, hr_dir: str, lr_dir: str)

Source from the content-addressed store, hash-verified

36
37class SrDataset(Dataset):
38 def __init__(self, hr_dir: str, lr_dir: str):
39 self.input_size = np.asanyarray([224, 224])
40 self.hr = []
41 self.lr = []
42
43 for file in sorted(os.listdir(hr_dir)):
44 self.hr.append(self._resize_img(os.path.join(hr_dir, file), 2))
45
46 for file in sorted(os.listdir(lr_dir)):
47 self.lr.append(self._resize_img(os.path.join(lr_dir, file), 1))
48
49 if len(self.hr) != len(self.lr):
50 raise AssertionError(
51 "The number of high resolution pics is not equal to low "
52 "resolution pics"
53 )
54
55 def __getitem__(self, idx: int):
56 return self.hr[idx], self.lr[idx]

Callers 1

__init__Method · 0.45

Calls 2

_resize_imgMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected