ios create ml_什么是create ml框架

CreateML是Apple提供的工具,允许iOS和macOS开发者无需Python或TensorFlow技能即可创建机器学习模型。支持五种类别:图片、声音、运动、文本和表格。以创建图像分类模型为例,演示了模型创建和在iOS应用中使用的流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

ios create ml

Create ML is Apple’s latest addition to a robust suite of first-party development tools.

Create ML是Apple对功能强大的第一方开发工具套件的最新添加。

Starting in WWDC17, which I had the opportunity to attend on scholarship, Apple unveiled Core ML — their first-party ML framework to enable ML models to be embedded into iOS and macOS apps seamlessly. Create ML, both a framework and an application, was unveiled a year later at WWDC18.

从我有机会参加奖学金的WWDC17开始,Apple推出了Core ML –他们的第一方ML框架,使ML模型可以无缝地嵌入到iOS和macOS应用程序中。 一年后,在WWDC18上发布了Create ML,它既是框架又是应用程序。

Per the Core ML documentation, Core ML serves the purpose of “integrating machine learning models into your app.” That’s great! But what if you’re an iOS developer by training and don’t have any Python/TensorFlow skills to create models yourself? Well, Create ML serves as a complement for that.

根据Core ML文档 ,Core ML的目的是“将机器学习模型集成到您的应用程序中”。 那很棒! 但是,如果您是经过培训的iOS开发人员,并且没有任何Python / TensorFlow技能自己创建模型怎么办? 好吧,Create ML对此起到了补充作用。

Create ML’s documentation states that Create ML’s purpose is “creating machine learning models for use in your app.” So now there is an end-to-end pathway for iOS and macOS developers to create models for use in their applications.

Create ML的文档指出,Create ML的目的是“创建要在您的应用中使用的机器学习模型”。 因此,现在有了iOS和macOS开发人员创建用于其应用程序的模型的端到端途径。

在创建ML中可以创建哪些模型? (What Kinds of Models Can Be Created in Create ML?)

Create ML supports five different categories of models:

Create ML支持五种不同类别的模型:

  • Image

    图片
  • Sound

    声音
  • Motion

    运动
  • Text

    文本
  • Table

Within Image, users can make classification and detection models. Sound and Motion support just classification. Text supports classification and tagging. Table supports creating classifier, regressor, and recommender models.

在Image中,用户可以建立分类和检测模型。 声音和运动仅支持分类。 文本支持分类和标记。 表支持创建分类器,回归器和推荐器模型。

在创建ML中创建模型有多容易? (Just How Easy Is It to Make a Model in Create ML?)

To demonstrate, I’m going to create an Image classification model to classify whether an image is a cat or dog.

为了演示,我将创建一个图像分类模型来对图像是猫还是狗进行分类。

With Create ML opened, I created a new Image Classifier project:

打开“创建ML”后,我创建了一个新的Image Classifier项目:

Image for post
A blank Create ML project
一个空白的Create ML项目

On my first model source, what is called for me MyImageClassifier 1, I will be uploading a folder containing all of my training data. The folder I uploaded is called test and has this basic structure:

在我的第一个模型源中,我叫MyImageClassifier 1 ,我将上载一个包含所有训练数据的文件夹。 我上传的文件夹称为test ,具有以下基本结构:

Image for post
Structure for training data
训练数据的结构

The Cat folder contains all my training images of cats, and my Dog folder contains all my training images of dogs.

Cat文件夹包含我所有的猫训练图像,而Dog文件夹包含我的所有狗训练图像。

After uploading my training data, Create ML looks like this:

上传训练数据后,创建ML如下所示:

Image for post
A Create ML project ready to train
准备训练的Create ML项目

At this point, the model is ready to train — though you can augment the data, set how much of the data you want to use as validation, and add testing data.

此时,该模型已准备好进行训练-尽管您可以扩充数据,设置要用作验证的数据量以及添加测试数据。

You can now simply click “Train” and a model will be created.

现在,您只需单击“训练”即可创建模型。

Image for post
Result of training using Create ML
使用创建ML进行培训的结果

As you can see, the output is a Create ML model called a with the type of .mlmodel.

如您所见,输出是一个名为a的Create ML模型,其类型为.mlmodel

在iOS应用中的使用 (Usage in an iOS App)

To use your newly created .mlmodel in your iOS app, you simply drag and drop that .mlmodel into your iOS app and then integration is a simple one-liner:

要在iOS应用中使用新创建的.mlmodel ,您只需将该.mlmodel到iOS应用中,然后进行集成.mlmodel简单了:

CatDogClassifier is the name of your .mlmodel.

CatDogClassifier是你的名字.mlmodel

To use your model in your app, you will use a VNCoreMLRequest object:

要在您的应用中使用模型,您将使用VNCoreMLRequest对象:

This object calls into processClassifications, which can be defined like so:

该对象调用processClassifications ,可以这样定义:

In this function, it will print to the console if there is > 90% confidence that the request was a specific label. With the VNClassificationObservation, we can access the confidence with .confidence and we can access the label with .identifier.

在此功能中,如果有90%的置信度认为请求是特定标签,它将打印到控制台。 随着VNClassificationObservation ,我们可以访问的信心.confidence ,我们可以访问标签.identifier

结论 (Conclusion)

At the end of the day, Create ML is an easy and effective way to create simple ML models for use in iOS and macOS products. It requires no coding to create the model itself (though integrating it into an app will require some). All you need is to, possibly, tune the model and structure your data in folders.

归根结底,Create ML是创建用于iOS和macOS产品的简单ML模型的简便有效的方法。 它不需要编码即可创建模型本身(尽管将其集成到应用程序中将需要一些)。 您所需要的只是可能调整模型并在文件夹中构造数据。

If you’re developing software for Apple products, this is a great way to quickly get a model up and running — all with a seamless first-party experience.

如果您要为Apple产品开发软件,那么这是快速建立并运行模型的好方法-所有这些都具有无缝的第一方体验。

翻译自: https://medium.com/better-programming/what-is-the-create-ml-framework-d269cff60dcc

ios create ml

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值