diff --git a/tutorials/notebook/mindinsight/images/histogram.png b/tutorials/notebook/mindinsight/images/histogram.png index a0bea73d058cbd971e56801a0c92d035b20b35c3..8be102f0cc96f27de89e82938c4242b041ec9b2a 100644 Binary files a/tutorials/notebook/mindinsight/images/histogram.png and b/tutorials/notebook/mindinsight/images/histogram.png differ diff --git a/tutorials/notebook/mindinsight/images/image_vi.png b/tutorials/notebook/mindinsight/images/image_vi.png deleted file mode 100644 index a941238ee2fd945bdef5619410ba32a9157e2ff7..0000000000000000000000000000000000000000 Binary files a/tutorials/notebook/mindinsight/images/image_vi.png and /dev/null differ diff --git a/tutorials/notebook/mindinsight/mindinsight_image_histogram_scalar.ipynb b/tutorials/notebook/mindinsight/mindinsight_image_histogram_scalar.ipynb index c4a69bcf7e47a34c8df8ae305fc255d117c5a0bc..940e464ff4c33b6f350922a65401cd02d1b90b8f 100644 --- a/tutorials/notebook/mindinsight/mindinsight_image_histogram_scalar.ipynb +++ b/tutorials/notebook/mindinsight/mindinsight_image_histogram_scalar.ipynb @@ -4,21 +4,25 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# MindInsight之标量、直方图和图像\n", + "# 标量、直方图和图像可视化\n", "\n", "MindInsight可以将神经网络训练过程中的损失值标量、直方图、图像信息记录到日志文件中,通过可视化界面解析以供用户查看。\n", "\n", - "整体流程:\n", + "接下来是本次流程的体验过程。\n", + "\n", + "## 整体流程\n", "\n", "1. 下载MNIST数据集。\n", "\n", "2. 原始数据预处理。\n", "\n", - "3. 初始化`lenet`网络。\n", + "3. 初始化`LeNet`网络。\n", + "\n", + "4. 训练网络,使用`SummaryCollector`记录图像信息、损失值标量、权重梯度等参数,同时启动MindInsight服务,实时查 看损失值、参数直方图和输入图像的变化。\n", "\n", - "4. 执行主程序,使用`SummaryCollector`记录图像信息、损失值标量、权重梯度等参数,启动MindInsight服务。\n", + "5. 完成训练后,查看MindInsight看板中记录到的损失值标量、直方图、图像信息及标量对比信息。\n", "\n", - "5. 在MindInsight可视化面板中查看结果。" + "6. 分别单独记录损失值标量、直方图、图像信息,查看展示结果,关闭MindInsight服务。" ] }, { @@ -37,7 +41,7 @@ "\n", "1. 判断是否存在MNIST数据集目录,不存在则创建目录,存在则跳至[**数据预处理**](#数据预处理)。\n", "\n", - "2. 判断是否存在MNIST数据集,不存在则下载MNIST数据集,存在则跳至[**数据预处理**](#数据预处理)。\n" + "2. 判断是否存在MNIST数据集,不存在则下载MNIST数据集,存在则跳至[**数据预处理**](#数据预处理)。" ] }, { @@ -51,10 +55,12 @@ "from urllib.parse import urlparse\n", "import gzip\n", "\n", - "def unzipfile(gzip_path):\n", - " \"\"\"unzip dataset file\n", + "def unzip_file(gzip_path):\n", + " \"\"\"\n", + " unzip dataset file\n", + " \n", " Args:\n", - " gzip_path: dataset file path\n", + " gzip_path: Dataset file path\n", " \"\"\"\n", " open_file = open(gzip_path.replace('.gz',''), 'wb')\n", " gz_file = gzip.GzipFile(gzip_path)\n", @@ -80,7 +86,7 @@ " file_name = os.path.join(train_path,url_parse.path.split('/')[-1])\n", " if not os.path.exists(file_name.replace('.gz','')):\n", " file = urllib.request.urlretrieve(url, file_name)\n", - " unzipfile(file_name)\n", + " unzip_file(file_name)\n", " os.remove(file_name)\n", " for url in test_url:\n", " url_parse = urlparse(url)\n", @@ -88,7 +94,7 @@ " file_name = os.path.join(test_path,url_parse.path.split('/')[-1])\n", " if not os.path.exists(file_name.replace('.gz','')):\n", " file = urllib.request.urlretrieve(url, file_name)\n", - " unzipfile(file_name)\n", + " unzip_file(file_name)\n", " os.remove(file_name)" ] }, @@ -233,11 +239,11 @@ "source": [ "# 记录标量、直方图、图像\n", "\n", - "在主程序中应用`SummaryCollector`来记录标量、直方图、图像信息。\n", + "在主程序中使用`SummaryCollector`来记录标量、直方图、图像信息。\n", "\n", "## 运行主程序\n", "\n", - "在MindSpore中通过`Callback`机制提供支持快速简易地收集损失值、参数权重、梯度等信息的`Callback`, 叫做`SummaryCollector`。详细的用法可以参考API文档中`mindspore.train.callback.SummaryCollector`。 \n", + "在MindSpore中通过`Callback`机制,提供支持快速简易地收集损失值、参数权重、梯度等信息的`Callback`, 叫做`SummaryCollector`。详细的用法可以参考API文档中`mindspore.train.callback.SummaryCollector`。 \n", "\n", "1. 为了记录损失值标量、直方图、图像信息,在主程序代码中需要在`specified`参数中指定需要记录的信息。\n", "\n", @@ -252,7 +258,7 @@ "\n", "2. 实例化`SummaryCollector`,并将其应用到`model.train`或者`model.eval`中。\n", "\n", - "程序运行过程中将启动MindInsight服务并自动遍历读取当前notebook目录下`summary_dir`子目录下所有日志文件、解析进行可视化展示。" + "  程序运行过程中将在本地`8080`端口自动启动MindInsight服务并自动遍历读取当前notebook目录下`summary_dir`子目录下所有日志文件、解析进行可视化展示。" ] }, { @@ -308,17 +314,17 @@ "\n", "![](https://gitee.com/mindspore/docs/raw/master/tutorials/notebook/mindinsight/images/mindinsight_panel.png)\n", "\n", - "在上图所示面板中可以看到`summary_01`日志文件目录,点击训练看板进入到下图所示的训练数据展示面板,该面板展示了标量数据、直方图和图像信息,并随着训练、测试的进行实时刷新数据,实时显示训练过程参数的变化情况。\n", + "在上图所示面板中可以看到`summary_01`日志文件目录,点击**训练看板**进入到下图所示的训练数据展示面板,该面板展示了标量数据、直方图和图像信息,并随着训练、测试的进行实时刷新数据,实时显示训练过程参数的变化情况。\n", "\n", "![](https://gitee.com/mindspore/docs/raw/master/tutorials/notebook/mindinsight/images/mindinsight_panel2.png)\n", "\n", "## 标量可视化\n", "\n", - "标量可视化用于展示训练过程中标量的变化趋势情况,点击打开标量信息展示面板,该面板记录了迭代计算过程中的学习率(下图左侧所示)和损失值(下图右侧所示)标量信息。\n", + "标量可视化用于展示训练过程中标量的变化趋势情况,点击打开标量信息展示面板,该面板记录了迭代计算过程中的损失值标量信息。\n", "\n", "![](https://gitee.com/mindspore/docs/raw/master/tutorials/notebook/mindinsight/images/scalar_panel.png)\n", "\n", - "如下图的loss值标量可视化信息——标量趋势图。\n", + "如下图的loss值标量趋势图。\n", "\n", "![](https://gitee.com/mindspore/docs/raw/master/tutorials/notebook/mindinsight/images/scalar.png)\n", "\n", @@ -330,7 +336,7 @@ "\n", "- 切换Y轴比例是指可以将Y轴坐标进行对数转换。\n", "\n", - "- 开启/关闭框选是指可以框选图中部分区域,并放大查看该区域, 可以在已放大的图形上叠加框选。\n", + "- 开启/关闭框选是指可以框选图中部分区域,并放大查看该区域,可以在已放大的图形上叠加框选。\n", "\n", "- 分步回退是指对同一个区域连续框选并放大查看时,可以逐步撤销操作。\n", "\n", @@ -360,6 +366,10 @@ "\n", "![](https://gitee.com/mindspore/docs/raw/master/tutorials/notebook/mindinsight/images/histogram.png)\n", "\n", + "下图为直方图功能区。\n", + "\n", + "![](https://gitee.com/mindspore/docs/raw/master/tutorials/notebook/mindinsight/images/histogram_func.png)\n", + "\n", "上图展示直方图的功能区,包含以下内容:\n", "\n", "- 标签选择:提供了对所有标签进行多项选择的功能,用户可以通过勾选所需的标签,查看对应的直方图。\n", @@ -372,11 +382,9 @@ "\n", "图像可视化用于展示用户所指定的图片。点击图像展示面板,展示了每个step进行处理的图像信息。\n", "\n", - "![](https://gitee.com/mindspore/docs/raw/master/tutorials/notebook/mindinsight/images/image_panel.png)\n", - "\n", "下图为展示`summary_01`记录的图像信息。\n", "\n", - "![](https://gitee.com/mindspore/docs/raw/master/tutorials/notebook/mindinsight/images/image_vi.png)\n", + "![](https://gitee.com/mindspore/docs/raw/master/tutorials/notebook/mindinsight/images/image_panel.png)\n", "\n", "通过滑动上图中的\"步骤\"滑条,查看不同步骤的图片。\n", "\n", @@ -397,7 +405,7 @@ "source": [ "## 对比看板\n", "\n", - "对比看板可视用于多个训练之间的标量数据对比,为了展示对比看板,执行以下代码,在可视化面板中可以得到`summary_02`日志记录信息。" + "对比看板可视用于多次训练之间的标量数据对比,为了展示对比看板,执行以下代码,在可视化面板中可以得到`summary_02`日志记录信息。" ] }, { @@ -445,29 +453,17 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "打开对比看板,可以得到`summary_01`和`summary_02`标量对比信息。\n", + "点击MindInsight看板中的**对比看板**,打开对比看板,可以得到`summary_01`和`summary_02`标量对比信息。\n", "\n", "![](https://gitee.com/mindspore/docs/raw/master/tutorials/notebook/mindinsight/images/multi_scalars.png)\n", "\n", - "上图展示了多个训练之间的标量曲线对比效果,横坐标是训练步骤,纵坐标是标量值。\n", - "\n", - "图中右上角有几个按钮功能,从左到右功能分别是全屏展示,切换Y轴比例,开启/关闭框选,分步回退和还原图形。\n", - "\n", - "- 全屏展示即全屏展示该标量曲线,再点击一次即可恢复。\n", - "\n", - "- 切换Y轴比例是指可以将Y轴坐标进行对数转换。\n", - "\n", - "- 开启/关闭框选是指可以框选图中部分区域,并放大查看该区域, 可以在已放大的图形上叠加框选。\n", - "\n", - "- 分步回退是指对同一个区域连续框选并放大查看时,可以逐步撤销操作。\n", - "\n", - "- 还原图形是指进行了多次框选后,点击此按钮可以将图还原回原始状态。\n", + "上图展示了多次训练之间的标量曲线对比效果,横坐标是训练步骤,纵坐标是标量值。\n", "\n", "![](https://gitee.com/mindspore/docs/raw/master/tutorials/notebook/mindinsight/images/multi_scalars_select.png)\n", "\n", "上图展示的对比看板可视的功能区,提供了根据选择不同训练或标签,水平轴的不同维度和平滑度来进行标量对比的功能。\n", "\n", - "- 训练: 提供了对所有训练进行多项选择的功能,用户可以通过勾选或关键字筛选所需的训练。\n", + "- 训练:提供了对所有训练进行多项选择的功能,用户可以通过勾选或关键字筛选所需的训练。\n", "\n", "- 标签:提供了对所有标签进行多项选择的功能,用户可以通过勾选所需的标签,查看对应的标量信息。\n", "\n", @@ -484,7 +480,7 @@ "\n", "以上流程为整体展示Summary算子能记录到的所有数据,也可以单独记录关心的数据,以降低性能开销和日志文件大小。\n", "\n", - "> 为了展示运行的效果,进行以下每个步骤之前先删除当前notebook根目录下的`summary_dir/summary_02`目录,配置完`specified`参数后执行[**对比看板**](#对比看板)中的代码。\n", + "此处利用[**对比看板**](#对比看板)中的代码,为了排除前次训练对MindInsight展示结果的影响,在进行以下每个步骤之前先删除当前notebook根目录下的`summary_dir/summary_02`目录,配置完`specified`参数后执行[**对比看板**](#对比看板)中的代码,在MindInsight看板中查看结果。\n", "\n", "## 单独记录损失值标量\n", "\n", diff --git a/tutorials/source_zh_cn/advanced_use/dashboard_and_lineage.md b/tutorials/source_zh_cn/advanced_use/dashboard_and_lineage.md index 22c8011d107f5d009736ff0e8a7750e6b0d8f46d..ea5aa255c25e2fe7fee14685a3d62e7925bf344e 100644 --- a/tutorials/source_zh_cn/advanced_use/dashboard_and_lineage.md +++ b/tutorials/source_zh_cn/advanced_use/dashboard_and_lineage.md @@ -22,7 +22,7 @@    - + ## 概述 训练过程中的标量、图像、计算图以及模型超参等信息记录到文件中,通过可视化界面供用户查看。