Skip to content

Commit

Permalink
seems a bit faster
Browse files Browse the repository at this point in the history
  • Loading branch information
TNTwise committed May 25, 2024
1 parent 52deb0d commit 1efa8be
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/torch/UpscaleImageNCNN.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ def ProcessNCNN(self,npArrayImage)-> np.asarray:
mean_vals = []
norm_vals = [255.0, 255.0, 255.0]
mat_out.substract_mean_normalize(mean_vals, norm_vals)
arr = np.array(mat_out)
min_val = np.min(arr)
max_val = np.max(arr)
out = np.ascontiguousarray(mat_out)
min_val = np.min(out)
max_val = np.max(out)
if min_val < 0 or max_val > 255:
out = ((arr - min_val) / (max_val - min_val)) * 255
out = ((out - min_val) / (max_val - min_val)) * 255
output = out.transpose(1, 2, 0)
output = np.ascontiguousarray(output,dtype=np.uint8)
return output
Expand Down

0 comments on commit 1efa8be

Please sign in to comment.