From 929f8d5c892cb3003b9e7bb9ea688418e4bceb07 Mon Sep 17 00:00:00 2001 From: wizardforcel <562826179@qq.com> Date: Thu, 10 Dec 2020 17:30:55 +0800 Subject: [PATCH] 2020-12-10 17:30:55 --- new/intel-mobi-proj-tf/08.md | 16 ++++++++-------- new/intel-mobi-proj-tf/09.md | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/new/intel-mobi-proj-tf/08.md b/new/intel-mobi-proj-tf/08.md index 0a73ca0e..ae421127 100644 --- a/new/intel-mobi-proj-tf/08.md +++ b/new/intel-mobi-proj-tf/08.md @@ -271,7 +271,7 @@ You can replace BasicRNNCell in step 4 with BasicLSTMCell and run the training c ![](img/71f57975-9e80-4886-a13f-7a38b52dc84d.png) -图 8.1:Showing the stock price prediction correctness trained with TensorFlow RNN +图 8.1:显示使用 TensorFlow RNN 训练的股价预测正确性 注意,每次运行此训练和测试代码时,您获得的比率可能都会有所不同。 通过微调模型的超参数,您可能会获得超过 60% 的比率,这似乎比随机预测要好。 如果您乐观的话,您可能会认为至少有 50% (56.25%)的东西要显示出来,并且可能希望看到该模型在移动设备上运行。 但首先让我们看看是否可以使用酷的 Keras 库来构建更好的模型-在执行此操作之前,让我们通过简单地运行来冻结经过训练的 TensorFlow 模型: @@ -520,7 +520,7 @@ plt.show() ![](img/b8227667-1d0d-4ea7-bf0b-fa7dac192064.png) -图 8.2:Making stock price predictions with the Keras bidirectional and stacked LSTM layers +图 8.2:使用 Keras 双向和堆叠 LSTM 层进行股价预测 很容易在堆栈中添加更多 LSTM 层,或者使用诸如学习率和辍学率以及许多恒定设置之类的超参数。 但是,对于使用`pred_len`和`shift_pred`的不同设置,正确率的差异还没有发现。 也许我们现在应该对接近 60% 的正确率感到满意,并看看如何在 iOS 和 Android 上使用 TensorFlow 和 Keras 训练的模型-我们可以在以后继续尝试改进模型,但是 了解使用 TensorFlow 和 Keras 训练的 RNN 模型是否会遇到任何问题将非常有价值。 @@ -546,7 +546,7 @@ python tensorflow/python/tools/freeze_graph.py --input_meta_graph=/tmp/keras_amz ![](img/454020d6-1f32-480d-b159-b474b6878540.png) -图 8.3:iOS app using the TensorFlow- and Keras-trained models in Xcode +图 8.3:在 Xcode 中使用 TensorFlow 和 Keras 训练的模型的 iOS 应用 在`ViewController.mm`中,我们将首先声明一些变量和一个常量: @@ -689,7 +689,7 @@ const int SEQ_LEN = 20; ![](img/067fa448-a497-4f13-944f-e976240694c9.png) -图 8.4:Selecting the TensorFlow or Keras RNN model +图 8.4:选择 TensorFlow 或 Keras RNN 模型 如果选择 TensorFlow 模型,则可能会出现错误: @@ -713,13 +713,13 @@ Could not create TensorFlow Graph: Invalid argument: No OpKernel was registered ![](img/28715473-1f89-4f14-8e81-f98242a11c8d.png) -图 8.5:Predicting with the TensorFlow RNN model +图 8.5:使用 TensorFlow RNN 模型进行预测 使用 Keras 模型输出不同的预测,如图 8.6 所示: ![](img/4114a6b9-15da-41f7-b535-bf04c7fb4dad.png) -图 8.6:Predicting with the Keras RNN model +图 8.6:使用 Keras RNN 模型进行预测 我们无法确定哪个模型能在没有进一步研究的情况下更好地工作,但是我们可以确定的是,我们的两个 RNN 模型都使用 TensorFlow 和 Keras API 从头开始训练了,其准确性接近 60%, 在 iOS 上运行良好,这很值得我们付出努力,因为我们正在尝试建立一个许多专家认为将达到与随机选择相同的性能的模型,并且在此过程中,我们学到了一些新奇的东西-使用 TensorFlow 和 Keras 构建 RNN 模型并在 iOS 上运行它们。 在下一章中,我们只剩下一件事了:如何在 Android 上使用模型? 我们会遇到新的障碍吗? @@ -858,13 +858,13 @@ public void run() { ![](img/8ce6016b-658a-46c4-a051-04c772d503fc.png) -图 8.7:Using the TensorFlow model to make stock price predictions on Amazon +图 8.7:使用 TensorFlow 模型在亚马逊上进行股价预测 选择 KERAS 预测将为您提供如图 8.8 所示的结果: ![](img/ec5b48b2-0c2a-439a-af59-303b9c628019.png) -图 8.8:Using the Keras model to make stock price predictions on Amazon +图 8.8:使用 Keras 模型在亚马逊上进行股价预测 diff --git a/new/intel-mobi-proj-tf/09.md b/new/intel-mobi-proj-tf/09.md index f9631bd0..aea5eb34 100644 --- a/new/intel-mobi-proj-tf/09.md +++ b/new/intel-mobi-proj-tf/09.md @@ -253,7 +253,7 @@ if a.mode == "test": ![](img/b73deef3-1598-4019-ac72-5c0212d53c74.png) -图 9.1:The original, the blurry, and the generated +图 9.1:原始的,模糊的和生成的 10. 现在,将`newckpt`目录复制到`/tmp`,我们可以如下冻结模型: @@ -332,7 +332,7 @@ No OpKernel was registered to support Op 'FIFOQueueV2' with these attrs. Registe ![](img/9cb1fa66-5a4e-4a1b-aa51-a16fd9051f57.png) -图 9.2:Showing the GAN app in Xcode +图 9.2:在 Xcode 中显示 GAN 应用 我们将创建一个按钮,在点击该按钮时,提示用户选择一个模型以生成数字或增强图像: @@ -545,7 +545,7 @@ No OpKernel was registered to support Op 'FIFOQueueV2' with these attrs. Registe ![](img/0e0f47b1-2efa-4ec0-9eaa-4b21356cad23.png) -图 9.3:Showing GAN model selection and results of generated handwritten digits +图 9.3:显示 GAN 模型选择和生成的手写数字结果 这些数字看起来很像真实的人类手写数字,都是在训练了基本 GAN 模型之后完成的。 如果您返回并查看进行训练的代码,并且停下来思考一下 GAN 的工作原理,一般来说,则生成器和判别器如何相互竞争,以及 尝试达到稳定的纳什均衡状态,在这种状态下,生成器可以生成区分器无法分辨出真实还是伪造的真实假数据,您可能会更欣赏 GAN 的魅力。 @@ -553,7 +553,7 @@ No OpKernel was registered to support Op 'FIFOQueueV2' with these attrs. Registe ![](img/63898b4a-4c1d-4605-9fa3-97c8aa00c968.png) -图 9.4:The original blurry and enhanced images on iOS +图 9.4:iOS 上原始的模糊和增强图像 你知道该怎么做。 是时候将我们的爱献给 Android 了。 @@ -571,7 +571,7 @@ No OpKernel was registered to support Op 'FIFOQueueV2' with these attrs. Registe ![](img/f1c741dd-1fc6-41da-9243-3b0840aa9b20.png) -图 9.5:Android Studio GAN app overview, showing constant definitions +图 9.5:Android Studio GAN 应用概述,显示常量定义 请注意,为简单起见,我们将`BATCH_SIZE`设置为 1。您可以轻松地将其设置为任何数字,并像在 iOS 中一样获得很多输出。 除了图 9.5 中定义的常量之外,我们还将创建一些实例变量: @@ -722,7 +722,7 @@ void runMNISTModel() { ![](img/1b2a1b02-e084-40bf-a33d-ce5561a34850.png) -图 9.6:Showing the generated digits +图 9.6:显示生成的数字 @@ -793,7 +793,7 @@ void runPix2PixBlurryModel() { ![](img/7e7c6110-09d5-4908-bfaa-e9b5b67596d3.png) -图 9.7:The blurry and enhanced images on Android +图 9.7:Android 上的模糊和增强图像 这使用两个 GAN 模型完成了我们的 Android 应用程序。 -- GitLab