Skip to content

Commit

Permalink
2024-02-08 19:41:20
Browse files Browse the repository at this point in the history
  • Loading branch information
wizardforcel committed Feb 8, 2024
1 parent 86e4137 commit 1e33a54
Show file tree
Hide file tree
Showing 2 changed files with 529 additions and 0 deletions.
26 changes: 26 additions & 0 deletions totrans/prac-dl-cld_12.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,8 @@
id: totrans-108
prefs: []
type: TYPE_NORMAL
zh: 使用Create ML的一个主要动机是其输出的模型大小。完整模型可以分解为基础模型(生成特征)和更轻的特定任务分类层。苹果将基础模型内置到其每个操作系统中。因此,Create
ML只需要输出特定任务的分类器。这些模型有多小?仅几千字节(与MobileNet模型的15 MB相比,后者已经相当小了)。在越来越多的应用开发人员开始将深度学习整合到其应用中的今天,这一点至关重要。同一神经网络不需要在多个应用程序中不必要地复制,消耗宝贵的存储空间。
- en: In short, Create ML is easy, speedy, and tiny. Sounds too good to be true. Turns
out the flip-side of having full vertical integration is that the developers are
tied into the Apple ecosystem. Create ML exports only *.mlmodel* files, which
Expand All @@ -774,10 +776,13 @@
id: totrans-109
prefs: []
type: TYPE_NORMAL
zh: 简而言之,Create ML易于使用,速度快,体积小。听起来太好了。事实证明,完全垂直集成的反面是开发人员被绑定到苹果生态系统中。Create ML只导出*.mlmodel*文件,这些文件只能在iOS、iPadOS、macOS、tvOS和watchOS等苹果操作系统上使用。遗憾的是,Create
ML尚未实现与Android的集成。
- en: 'In this section, we build the Not Hotdog classifier using Create ML:'
id: totrans-110
prefs: []
type: TYPE_NORMAL
zh: 在本节中,我们使用Create ML构建Not Hotdog分类器:
- en: Open the Create ML app, click New Document, and select the Image Classifier
template from among the several options available (including Sound, Activity,
Text, Tabular), as shown in [Figure 12-10](part0014.html#choosing_a_template_for_a_new_project).
Expand All @@ -787,22 +792,27 @@
prefs:
- PREF_OL
type: TYPE_NORMAL
zh: 打开Create ML应用程序,点击新建文档,从可用的几个选项中选择图像分类器模板(包括声音、活动、文本、表格),如[图12-10](part0014.html#choosing_a_template_for_a_new_project)所示。请注意,这仅适用于Xcode
11(或更高版本),macOS 10.15(或更高版本)。
- en: '![Choosing a template for a new project](../images/00277.jpeg)'
id: totrans-112
prefs:
- PREF_IND
type: TYPE_IMG
zh: '![选择新项目的模板](../images/00277.jpeg)'
- en: Figure 12-10\. Choosing a template for a new project
id: totrans-113
prefs:
- PREF_IND
- PREF_H6
type: TYPE_NORMAL
zh: 图12-10。选择新项目的模板
- en: In the next screen, enter a name for the project, and then select Done.
id: totrans-114
prefs:
- PREF_OL
type: TYPE_NORMAL
zh: 在下一个屏幕中,输入项目名称,然后选择完成。
- en: We need to sort the data into the correct directory structure. As [Figure 12-11](part0014.html#train_and_test_data_in_separate_director)
illustrates, we place images in directories that have the names of their labels.
It is useful to have separate train and test datasets with their corresponding
Expand All @@ -811,33 +821,39 @@
prefs:
- PREF_OL
type: TYPE_NORMAL
zh: 我们需要将数据分类到正确的目录结构中。如[图12-11](part0014.html#train_and_test_data_in_separate_director)所示,我们将图像放在以其标签名称命名的目录中。将训练和测试数据分别放在相应的目录中是有用的。
- en: '![Train and test data in separate directories](../images/00235.jpeg)'
id: totrans-116
prefs:
- PREF_IND
type: TYPE_IMG
zh: '![将训练和测试数据放在不同的目录中](../images/00235.jpeg)'
- en: Figure 12-11\. Train and test data in separate directories
id: totrans-117
prefs:
- PREF_IND
- PREF_H6
type: TYPE_NORMAL
zh: 图12-11。将训练和测试数据放在不同的目录中
- en: Point the UI to the training and test data directories, as shown in [Figure 12-12](part0014.html#training_interface_in_create_ml).
id: totrans-118
prefs:
- PREF_OL
type: TYPE_NORMAL
zh: 将UI指向训练和测试数据目录,如[图12-12](part0014.html#training_interface_in_create_ml)所示。
- en: '![Training interface in Create ML](../images/00200.jpeg)'
id: totrans-119
prefs:
- PREF_IND
type: TYPE_IMG
zh: '![Create ML中的训练界面](../images/00200.jpeg)'
- en: Figure 12-12\. Training interface in Create ML
id: totrans-120
prefs:
- PREF_IND
- PREF_H6
type: TYPE_NORMAL
zh: 图12-12。Create ML中的训练界面
- en: '[Figure 12-12](part0014.html#training_interface_in_create_ml) shows the UI
after you select the train and test data directories. Notice that the validation
data was automatically selected by Create ML. Additionally, notice the augmentation
Expand All @@ -848,23 +864,28 @@
prefs:
- PREF_OL
type: TYPE_NORMAL
zh: 在选择训练和测试数据目录后,[图12-12](part0014.html#training_interface_in_create_ml)显示了UI。请注意,验证数据是由Create
ML自动选择的。此外,请注意可用的增强选项。在这一点上,我们可以点击播放按钮(右向三角形;参见[图12-13](part0014.html#create_ml_screen_that_opens_after_loadin))开始训练过程。
- en: '![Create ML screen that opens after loading train and test data](../images/00164.jpeg)'
id: totrans-122
prefs:
- PREF_IND
type: TYPE_IMG
zh: '![加载训练和测试数据后打开的Create ML屏幕](../images/00164.jpeg)'
- en: Figure 12-13\. Create ML screen that opens after loading train and test data
id: totrans-123
prefs:
- PREF_IND
- PREF_H6
type: TYPE_NORMAL
zh: 图12-13。加载训练和测试数据后打开的Create ML屏幕
- en: Note
id: totrans-124
prefs:
- PREF_IND
- PREF_H6
type: TYPE_NORMAL
zh: 注意
- en: As you experiment, you will quickly notice that each augmentation that we add
will make the training slower. To set a quick baseline performance metric, we
should avoid using augmentations in the first run. Subsequently, we can experiment
Expand All @@ -874,6 +895,7 @@
prefs:
- PREF_IND
type: TYPE_NORMAL
zh: 当您进行实验时,您会很快注意到每个添加的增强都会使训练变慢。为了设定一个快速的基准性能指标,我们应该避免在第一次运行中使用增强。随后,我们可以尝试添加更多增强来评估它们对模型质量的影响。
- en: When the training completes, we can see how the model performed on the training
data, (auto-selected) validation data, and the test data, as depicted in [Figure 12-14](part0014.html#the_create_ml_screen_after_training_comp).
At the bottom of the screen, we can also observe how long the training process
Expand All @@ -883,17 +905,21 @@
prefs:
- PREF_OL
type: TYPE_NORMAL
zh: 当训练完成时,我们可以看到模型在训练数据、(自动选择的)验证数据和测试数据上的表现,如[图12-14](part0014.html#the_create_ml_screen_after_training_comp)所示。在屏幕底部,我们还可以看到训练过程花费的时间以及最终模型的大小。在不到两分钟内达到97%的测试准确率。而且输出只有17
KB。相当不错。
- en: '![The Create ML screen after training completes](../images/00113.jpeg)'
id: totrans-127
prefs:
- PREF_IND
type: TYPE_IMG
zh: '![训练完成后的Create ML屏幕](../images/00113.jpeg)'
- en: Figure 12-14\. The Create ML screen after training completes
id: totrans-128
prefs:
- PREF_IND
- PREF_H6
type: TYPE_NORMAL
zh: 图12-14。训练完成后的Create ML屏幕
- en: We’re so close now—we just need to export the final model. Drag the Output button
(highlighted in [Figure 12-14](part0014.html#the_create_ml_screen_after_training_comp))
to the desktop to create the *.mlmodel* file.
Expand Down
Loading

0 comments on commit 1e33a54

Please sign in to comment.