Spaces:
Sleeping
Sleeping
Update main_test_CMFNet.py
Browse files- main_test_CMFNet.py +6 -11
main_test_CMFNet.py
CHANGED
|
@@ -55,14 +55,14 @@ def main():
|
|
| 55 |
input_ = F.pad(input_, (0, padw, 0, padh), 'reflect')
|
| 56 |
with torch.no_grad():
|
| 57 |
restored = model(input_)
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
|
| 64 |
f = os.path.splitext(os.path.split(file_)[-1])[0]
|
| 65 |
-
save_img((os.path.join(out_dir, '
|
| 66 |
|
| 67 |
|
| 68 |
|
|
@@ -82,11 +82,6 @@ def load_checkpoint(model, weights):
|
|
| 82 |
new_state_dict[name] = v
|
| 83 |
model.load_state_dict(new_state_dict)
|
| 84 |
|
| 85 |
-
def setup(args):
|
| 86 |
-
save_dir = 'result/'
|
| 87 |
-
folder = 'test/'
|
| 88 |
-
|
| 89 |
-
return folder, save_dir
|
| 90 |
|
| 91 |
if __name__ == '__main__':
|
| 92 |
main()
|
|
|
|
| 55 |
input_ = F.pad(input_, (0, padw, 0, padh), 'reflect')
|
| 56 |
with torch.no_grad():
|
| 57 |
restored = model(input_)
|
| 58 |
+
|
| 59 |
+
restored = torch.clamp(restored[1], 0, 1)
|
| 60 |
+
restored = restored[:, :, :h, :w]
|
| 61 |
+
restored = restored.permute(0, 2, 3, 1).cpu().detach().numpy()
|
| 62 |
+
restored = img_as_ubyte(restored[0])
|
| 63 |
|
| 64 |
f = os.path.splitext(os.path.split(file_)[-1])[0]
|
| 65 |
+
save_img((os.path.join(out_dir, f + '.png')), restored_)
|
| 66 |
|
| 67 |
|
| 68 |
|
|
|
|
| 82 |
new_state_dict[name] = v
|
| 83 |
model.load_state_dict(new_state_dict)
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
if __name__ == '__main__':
|
| 87 |
main()
|