Skip to content

Instantly share code, notes, and snippets.

@sgl0v
Created June 2, 2021 19:18
Show Gist options
  • Save sgl0v/be0ac3587d7df58b161bbc44538c0404 to your computer and use it in GitHub Desktop.
Save sgl0v/be0ac3587d7df58b161bbc44538c0404 to your computer and use it in GitHub Desktop.
colorizer_coreml = ct.models.MLModel('coremlColorizer.mlmodel') # ➊
img = load_img(opt.img_path)
(tens_l_orig, tens_l_rs) = preprocess_img(img, HW=(256,256)) # ➋
tens_ab_rs = colorizer_coreml.predict({'input1': tens_l_rs.numpy()})['796'] # ➌
# ➍
img_bw = postprocess_tens(tens_l_orig, torch.cat((0*tens_l_orig,0*tens_l_orig),dim=1))
out_img_coreml = postprocess_tens(tens_l_orig, torch.from_numpy(tens_ab_rs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment