We want to use animation conversion on iPhone — — How to convert AnimeGAN2 to CoreML
How to convert AnimeGAN2-pytorch to a format that can be used on iPhone
Make AnimeGAN2, an anime conversion machine learning model, available in the iPhone app.
If you just want converted CoreML model:


AnimeGAN is cool, but Python. .. ..
To use the Python model in our application, uploading an image to the server and processing it seems to be little bit complex.
If we convert to CoreML, we can use the model on iPhone
With CoreML format, we can easily incorporate AnimeGAN into our iPhone app.
procedure
Load the model from Torch-Hub.
Convert the model.
The output shape of the model is [1,3,512,512].
Since the dimension with only the first dimension is unnecessary and
we want to make the shape [3,512,512] for image output,
add a layer to reduce the first dimension.
Since the model input is normalized to the range -1 to 1
, add an activation layer that returns to a value in the range 0 to 255.
Explicitly specify the output name of the activation layer in the output name of the model.
Otherwise, the output of the model will remain output from the original var_444 layer, which is a necessary step.
Specify an image as the output type of the model.
Save the model.
How to use on iOS
Execute the request in Vision.




Conversion Colab is here:
🐣
I’m a freelance engineer.
Work consultation
Please feel free to contact us with a brief development description.
rockyshikoku@gmail.com
I am making an app that uses Core ML and ARKit.
We send machine learning / AR related information.