apple / turicreate

Turi Create simplifies the development of custom machine learning models.
BSD 3-Clause "New" or "Revised" License
11.2k stars 1.14k forks source link

Style Transfer: Getting Result as a garbage on Apple M1 Silicon iMac #3422

Open ioskevinshah opened 3 years ago

ioskevinshah commented 3 years ago

Turicreate version: 6.4.1 Python version: 3.7 Using: Jupyter Notebook

Input image: IMG_2367

Output Garbage Image: IMG_2366

Code: import turicreate as tc

tc.config.set_num_gpus(1)

Load the style and content images styles = tc.load_images('Style/') content = tc.load_images('HumanContent/')

Create a StyleTransfer model model = tc.style_transfer.create(styles, content, max_iterations=1000, _advanced_parameters={"style_loss_mult": [1e-4, 1e-4, 1e-4, 1e-4], "pretrained_weights": True, "batch_size": 6, "finetune_all_params": True, "input_shape": (256, 256)})

Save the model for later use in Turi Create model.save('style-transfer6.model')

Export for use in Core ML model.export_coreml('MyCustomStyleTransfer6.mlmodel')

Style Zip: Style.zip

Content Zip: 500 images of human face. Content.zip

Result are same if iterations is 1k, 10k or 20k. Total Garbage.

So, I came up with this issue: https://github.com/apple/turicreate/issues/3018

They are suggesting to use CPU instead of GPU. So I did the same. tc.config.set_num_gpus(0) Kernel keep crashing/died. /// When 1 is change to 0.

Please guide me. I'm not python developer. But I was able to come up with above code by reading document and articles, their results was amazing.

TobyRoseman commented 3 years ago

What do your style images look like? That can make a big difference.

The number of iterations is also important. Is there a reason you are manually setting that instead of letting the algorithms pick it?

ioskevinshah commented 3 years ago

Hello @TobyRoseman,

Thanks for the quick reply.

Already attached Style.zip file. Please do check.

For iterations, I try with 1k, 10k and 20k but the result are same.

Algorithm say Apple M1 GPU 10k Iterations, result still garbage.

ioskevinshah commented 3 years ago

Hello @TobyRoseman,

Did you able to reproduce? Any help from my end?

hacker-jerry commented 2 years ago

Hello @TobyRoseman,

Thanks for the quick reply.

Already attached Style.zip file. Please do check.

For iterations, I try with 1k, 10k and 20k but the result are same.

Algorithm say Apple M1 GPU 10k Iterations, result still garbage.

hi ioskevinshah, I'd like to know how can you install turicreate on m1 mac? Could you please tell me ? I try some ways but not work for it. Thanks!

TobyRoseman commented 2 years ago

TuriCreate does not have native M1 support. You need to use Rosetta.