Skip to content
This repository was archived by the owner on Jan 2, 2021. It is now read-only.

Commit 689aacd

Browse files
committed
Nicer console output while enhancing
file.png (tile 4 of 9) instead of just printing dots
1 parent fabe04f commit 689aacd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

enhance.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,12 +555,21 @@ def process(self, original):
555555
image = np.pad(original, ((p, p), (p, p), (0, 0)), mode='reflect')
556556
output = np.zeros((original.shape[0] * z, original.shape[1] * z, 3), dtype=np.float32)
557557

558+
numtiles=0
559+
for y, x in itertools.product(range(0, original.shape[0], s), range(0, original.shape[1], s)):
560+
numtiles+=1
561+
562+
curtile=1
563+
558564
# Iterate through the tile coordinates and pass them through the network.
559565
for y, x in itertools.product(range(0, original.shape[0], s), range(0, original.shape[1], s)):
560566
img = np.transpose(image[y:y+p*2+s,x:x+p*2+s,:] / 255.0 - 0.5, (2, 0, 1))[np.newaxis].astype(np.float32)
561567
*_, repro = self.model.predict(img)
562568
output[y*z:(y+s)*z,x*z:(x+s)*z,:] = np.transpose(repro[0] + 0.5, (1, 2, 0))[p*z:-p*z,p*z:-p*z,:]
563-
print('.', end='', flush=True)
569+
if curtile > 1:
570+
print("\x7f" * 19, end='')
571+
print("(tile %4d of %4d)"%(curtile,numtiles), end='', flush=True)
572+
curtile+=1
564573
output = output.clip(0.0, 1.0) * 255.0
565574

566575
# Match color histograms if the user specified this option.

0 commit comments

Comments
 (0)