Skip to content

Instantly share code, notes, and snippets.

@sgl0v
Created June 2, 2021 19:17
Show Gist options
  • Save sgl0v/6b82ae0d19a80b2325b155d4e3b3e3fb to your computer and use it in GitHub Desktop.
Save sgl0v/6b82ae0d19a80b2325b155d4e3b3e3fb to your computer and use it in GitHub Desktop.
from colorizers import *
import coremltools as ct
import torch
siggraph17_model = siggraph17(pretrained=True).eval() # ➊
example_input = torch.rand(1, 1, 256, 256)
traced_model = torch.jit.trace(siggraph17_model, example_input) # ➋
coreml_model = ct.convert(
traced_model,
inputs=[ct.TensorType(name="input1", shape=(1, 1, 256, 256))]
)
coreml_model.save("coremlColorizer.mlmodel") # ➌
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment