Skip to content

Commit

Permalink
Merge pull request microsoft#1 from ericallam/replicate
Browse files Browse the repository at this point in the history
Read output png images correctly
  • Loading branch information
chenxwh authored Sep 19, 2021
2 parents 67ef0ba + f959c0b commit a536f15
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,16 @@ def predict(self, image, HR=False, with_scratch=False):

print("All the processing is done. Please check the results.")

img_name = os.path.basename(str(image))
image_restore = cv2.imread(
os.path.join(self.opts.output_folder, "final_output", img_name)
)
## This model only outputs png files so make sure to use .png when
## reading the output file. We do that by replacing the extension of the input image
## but keeping it's filename the same
img_name = Path(os.path.basename(str(image))).with_suffix('.png')

output_img_path = os.path.join(self.opts.output_folder, "final_output", img_name)

print(f'Reading the final output image at path {output_img_path}');

image_restore = cv2.imread(output_img_path)

out_path = Path(tempfile.mkdtemp()) / "out.png"

Expand Down

0 comments on commit a536f15

Please sign in to comment.