XiaoMi / mace-models

Mobile AI Compute Engine Model Zoo
Apache License 2.0
368 stars 72 forks source link

How to transform the outputs of fast-style-transfer into image? #5

Closed wuyajun0627 closed 6 years ago

TonyMou commented 6 years ago
  1. At first, find the output data file which is numpy-format and usually under the directory like this:

/path/to/mace/builds/library_name/_tmp/model_name/d6439802297f6ec8dc0904b88da6eedb(random numbers)/general/target-abi_name/model_out_output_node_name

  1. Use this python code to transform npy data to a *.jpg file
import sys
import os
import numpy as np
from scipy import misc
input_file = sys.argv[1]
out_path = sys.argv[2]
arr = np.fromfile(file=input_file, dtype=np.float32)
#arr = arr * 128.0 + 128.0
np.clip(arr, 0, 255).astype(np.uint8)
arr = np.reshape(arr, (480, 640, 3))
misc.imsave(out_path, arr)
llhe commented 6 years ago

@wuyajun19900627 Is your issue resolved? Close due to inactivity, feel free to reopen it if the issue still exists.