提交 b49363cb 编写于 作者: W wizardforcel

2020-12-10 17:27:59

上级 f4b76692
......@@ -561,7 +561,7 @@ The benefits of batch normalization are as follows:
# 概要
# 总结
......
......@@ -830,7 +830,7 @@ TensorBoard 的 GRAPHS 部分包含两个网络的图形 。 如果网络性能
# 概要
# 总结
......
......@@ -1391,7 +1391,7 @@ TensorBoard 的`GRAPHS`部分包含两个网络的图形。 如果网络性能
# 概要
# 总结
......
......@@ -991,7 +991,7 @@ Tensorboard 的`GRAPHS`部分包含两个网络的图形。 如果网络性能
# 概要
# 总结
......
......@@ -1196,7 +1196,7 @@ TensorBoard 的 GRAPHS 部分包含两个网络的图形。 如果网络性能
# 概要
# 总结
......
......@@ -2002,7 +2002,7 @@ StackGAN 的行业应用包括:
# 概要
# 总结
......
......@@ -1094,7 +1094,7 @@ CycleGAN 有许多应用。 在本章中,我们使用了 CycleGAN 将画作转
# 概要
# 总结
......
......@@ -1411,7 +1411,7 @@ pix2pix 网络有很多应用。 其中包括:
# 概要
# 总结
......
......@@ -176,7 +176,7 @@ GAN 已被证明对图像生成任务很有用。 GAN 中的大部分研究目
# 概要
# 总结
......
......@@ -519,7 +519,7 @@ syn = poisson.rvs(mu, size=2000)
# 概要
# 总结
......
......@@ -941,7 +941,7 @@ Original entropy: 7.726 bits - Quantized entropy: 5.752 bits
# 概要
# 总结
......
......@@ -764,7 +764,7 @@ Incremental adjusted Rand scores as functions of the batches (number of samples)
# 概要
# 总结
......
......@@ -556,7 +556,7 @@ Dataset clustered using the Euclidean distance and average linkage using connect
# 概要
# 总结
......
......@@ -709,7 +709,7 @@ Final configuration, after 10 iterations
# 概要
# 总结
......
......@@ -867,7 +867,7 @@ t-SNE plot for the novelty detection with the wine dataset
# 概要
# 总结
......
......@@ -765,7 +765,7 @@ Topic-mixtures for comp.sys.mac.hardware (left) and rec.autos (right)
# 概要
# 总结
......
......@@ -1123,7 +1123,7 @@ t-SNE plot of the unsupervised DBN output representations
# 概要
# 总结
......
......@@ -907,7 +907,7 @@ Kohonen map weight matrix at the end of the training process
# 概要
# 总结
......
......@@ -299,7 +299,7 @@ open tf_benchmark_example.xcworkspace
# 概要
# 总结
......
......@@ -893,7 +893,7 @@ final List<Classifier.Recognition> results = classifier.recognizeImage(croppedBi
# 概要
# 总结
......
......@@ -732,7 +732,7 @@ YoloPostProcess(model, output->flat<float>(), &top_results);
# 概要
# 总结
......
......@@ -662,7 +662,7 @@ for (int i = 0; i < NUM_STYLES; ++i) {
# 概要
# 总结
......
......@@ -790,7 +790,7 @@ func audioRecorderDidFinishRecording(_ recorder: AVAudioRecorder, successfully f
# 概要
# 总结
......
......@@ -952,7 +952,7 @@ mHandler.sendMessage(msg);
# 概要
# 总结
......
......@@ -34,7 +34,7 @@
![](img/ef475044-6568-4e50-bc98-8ff0a0d6efbf.png)
图 7.1:The drawing classification mode
图 7.1:图纸分类模式
与接受 2D 图像输入的 2D 卷积 API `tf.layers.conv2d` 不同,此处将 1D 卷积 API `tf.layers.conv1d`用于时间卷积(例如绘图)。 默认情况下,在图形分类模型中,使用三个 1D 卷积层,每个层具有 48、64 和 96 个过滤器,其长度分别为 5、5 和 3。 卷积层之后,将创建 3 个 LSTM 层,每层具有 128 个正向`BasicLSTMCell`节点和 128 个反向`BasicLSTMCell`节点,然后将其用于创建动态双向循环神经网络,该网络的输出将发送到最终的完全连接层以计算`logits`(非标准化的对数概率)。
......@@ -87,7 +87,7 @@ drwxr-xr-x 2 jeff jeff 4096 Feb 12 00:11 eval
![](img/479a1d37-1775-459d-a616-c45f2f10f0f1.png)
图 7.2:The accuracy and loss of the model after 300k training steps
图 7.2:300k 训练步骤后模型的准确性和损失
现在,我们可以像上一章一样运行`freeze_graph.py`工具,以生成用于移动设备的模型文件。 但是在执行此操作之前,我们首先来看一下如何在 Python 中使用该模型进行推断,例如上一章中的`run_inference.py`脚本。
......@@ -195,7 +195,7 @@ def predict_input_fn():
![](img/d911bab2-cfc2-41d3-a352-d00db55b1f71.png)
图 7.3:Showing possible output node names of the model
图 7.3:显示模型的可能输出节点名称
用您的`graph.pbtxt`文件的路径和最新的模型检查点前缀替换`--input_graph``--input_checkpoint`值后,在 TensorFlow 根目录中运行以下脚本以获取冻结的图:
......@@ -209,14 +209,15 @@ python tensorflow/python/tools/freeze_graph.py --input_graph=/tmp/graph.pbtxt -
![](img/a88ae370-8a39-4ee3-8ce0-ebaa5fd8a8ed.png)
图 7.4:Finding out possible input node namesYou may wonder why we can't fix the `Not found: Op type not registered 'OneShotIterator'` error with a technique we used before, which is to first find out which source file contains the op using the command `grep 'REGISTER.*"OneShotIterator"' tensorflow/core/ops/*.cc`
(and you'll see the output as `tensorflow/core/ops/dataset_ops.cc:REGISTER_OP("OneShotIterator")`) then add `tensorflow/core/ops/dataset_ops.cc` to `tf_op_files.txt` and rebuild the TensorFlow library. Even if this were feasible, it would complicate the solution as now we need to feed the model with some data related to `OneShotIterator`, instead of the direct user drawing in points.
图 7.4:查找可能的输入节点名称
您可能想知道为什么我们不能使用我们之前使用的技术来解决`Not found: Op type not registered 'OneShotIterator'`错误,即先使用命令`grep 'REGISTER.*"OneShotIterator"' tensorflow/core/ops/*.cc`(您将看到输出为`tensorflow/core/ops/dataset_ops.cc:REGISTER_OP("OneShotIterator")`),然后将`tensorflow/core/ops/dataset_ops.cc`添加到`tf_op_files.txt`并重建 TensorFlow 库。 即使这可行,也会使解决方案复杂化,因为现在我们需要向模型提供一些与`OneShotIterator`相关的数据,而不是以点为单位的直接用户绘图。
此外,在右侧上方一层(图 7.5),还有另一种操作 `Squeeze` ,它是 `rnn_classification` 子图的输入:
![](img/6230229e-1c21-4280-b60a-cac640c1cb1f.png)
图 7.5:Further research to find out input node names
图 7.5:找出输入节点名称的进一步研究
我们不必担心`Reshape`右侧的`Shape`运算,因为它实际上是`rnn_classification`子图的输出。 因此,所有这些研究背后的直觉是,我们可以使用`Reshape``Squeeze`作为两个输入节点,然后使用在上一章中看到的`transform_graph` 工具,我们应该能够删除 `Reshape``Squeeze`以下的节点,包括`OneShotIterator`
......@@ -237,7 +238,7 @@ strip_unused_nodes(name=Squeeze,type_for_name=int64,shape_for_name="8",name=Resh
![](img/6cc9946c-dfb2-41de-af95-a35e47d405a7.png)
图 7.6:Finding out nodes causing model loading error but not related to model inference
图 7.6:查找导致模型加载错误但与模型推断无关的节点
那么,如何摆脱`global_step`以及其他相关的`cond`节点,由于它们的隔离性,它们不会被变换图工具剥离掉? 幸运的是,`freeze_graph`脚本支持这一点 – [仅在其源代码中记录](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/freeze_graph.py)。 我们可以为脚本使用`variable_names_blacklist`参数来指定应在冻结模型中删除的节点:
......@@ -333,7 +334,7 @@ tensorflow/core/kernels/random_op.cc
![](img/ee464972-a065-4400-aea9-72ce9306b901.png)
图 7.7:Showing the QuickDraw Xcode project with initial content of ViewController.mm
图 7.7:显示带有`ViewController`初始内容的`QuickDraw` Xcode 项目。
我们现在准备单独处理`ViewController.mm`,以完成我们的任务。
......@@ -625,7 +626,7 @@ void normalizeScreenCoordinates(NSMutableArray *allPoints, float *normalized) {
![](img/48678dd2-0490-4b97-a0a6-fa4ba52bc27b.png)
图 7.8:Showing drawing and classification results on iOS
图 7.8:在 iOS 上显示绘图和分类结果
......@@ -693,7 +694,7 @@ When using a manually built native library in an Android app, you need to let th
![](img/0865ad60-dece-4349-9825-24ca46220d07.png)
图 7.9:Showing the TensorFlow native library file
图 7.9:显示 TensorFlow 本机库文件
4. 通过运行以下命令构建 TensorFlow 本机库的 Java 接口:
......@@ -705,7 +706,7 @@ bazel build //tensorflow/contrib/android:android_tensorflow_inference_java
![](img/51e4c597-7447-4623-8e07-396b56faddfa.png)
图 7.10:Showing the Java interface file to the TensorFlow library
图 7.10:将 Java 接口文件显示到 TensorFlow 库
现在,我们准备在 Android 中编码和测试模型。
......@@ -1031,7 +1032,7 @@ private double[] normalizeScreenCoordinates() {
![](img/560fa3a2-94a9-4f93-ae05-bd09921b8e0c.png)
图 7.11:Showing drawing and classification results on Android
图 7.11:在 Android 上显示绘图和分类结果
既然您已经了解了训练 Quick Draw 模型的全过程,并在 iOS 和 Android 应用程序中使用了它,那么您当然可以微调训练方法,使其更加准确,并改善移动应用程序的乐趣。
......@@ -1039,11 +1040,10 @@ private double[] normalizeScreenCoordinates() {
![](img/16494075-d42a-4b86-a48a-4cb0bc2ec865.png)
图 7.12:Checking out the TensorFlow native library file with Device File Explorer
图 7.12:使用设备文件资源管理器检出 TensorFlow 本机库文件
# 概要
# 总结
......
......@@ -868,7 +868,7 @@ public void run() {
# 概要
# 总结
......
......@@ -801,7 +801,7 @@ void runPix2PixBlurryModel() {
# 概要
# 总结
......
......@@ -1325,7 +1325,7 @@ void softmax(float vals[], int count) {
# 概要
# 总结
......
......@@ -720,7 +720,7 @@ class ViewController: UIViewController {
# 概要
# 总结
......
......@@ -1017,7 +1017,7 @@ pi@raspberrypi:~/mobiletf/ch12 $ python nn_pg.py
# 概要
# 总结
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册