三步实现CoreML的使用介绍

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/mandagod/article/details/85386678

两个步骤:

1.找到(或者自己生成)需要的.mlmodel;

2.将这个model拖到项目中,然后使用之。

以苹果提供的一个预测价格的model为例子:

    MarsHabitatPricer *model = [[MarsHabitatPricer alloc] init];
    MarsHabitatPricerOutput *result = [model predictionFromSolarPanels:5.0 greenhouses:5 size:4000 error:nil];
    double price = result.price;
    NSLog(@"%@", @(price));

说到这里有标题党的嫌疑,实际上最难的部分就是如何生成一个很棒的模型,还让它可以有很棒的速度和结果。我们只是使用它,苹果又为我们打造了如此易用的框架,所以它看起来如此简单。

猜你喜欢

转载自blog.csdn.net/mandagod/article/details/85386678