提交 52ae456d 编写于 作者: O ougongchang

Add some tutorials for the scalar threshold feature.

And add a note for custom callback and SummaryCollecot are used at the same time.
上级 767c399c
......@@ -7,6 +7,7 @@
- [Operation Process](#operation-process)
- [Preparing the Training Script](#preparing-the-training-script)
- [Collect Summary Data](#collect-summary-data)
- [Notices](#Notices)
- [Visualization Components](#visualization-components)
- [Training Dashboard](#training-dashboard)
- [Scalar Visualization](#scalar-visualization)
......@@ -278,8 +279,43 @@ the `save_graphs` option of `context.set_context` in the training script is set
In the saved files, `ms_output_after_hwopt.pb` is the computational graph after operator fusion, which can be viewed on the web page.
> - Currently MindSpore supports recording computational graph after operator fusion for Ascend 910 AI processor only.
> - When using the Summary operator to collect data in training, 'HistogramSummary' operator affects performance, so please use as little as possible.
### Notices
1. Currently MindSpore supports recording computational graph after operator fusion for Ascend 910 AI processor only.
2. When using the Summary operator to collect data in training, 'HistogramSummary' operator affects performance, so please use as little as possible.
3. Multiple `SummaryRecord` instances can not be used at the same time. (`SummaryRecord` is used in `SummaryCollector`)
If you use two or more instances of `SummaryCollector` in the callback list of 'model.train' or 'model.eval', it is seen as using multiple `SummaryRecord` instances at the same time, and it will cause recoding data fail.
If the custom callback use `SummaryRecord`, it can not be used with `SummaryCollector` at the same time.
Right code:
```python3
...示例
summary_collector = SummaryCollecotor('./summary_dir')
model.train(epoch=2, train_dataset, callbacks=[summary_collector])
...
model.eval(dataset, callbacks=[summary_collector])
```
Wrong code:
```python3
...
summary_collector1 = SummaryCollecotor('./summary_dir1')
summary_collector2 = SummaryCollecotor('./summary_dir2')
model.train(epoch=2, train_dataset, callbacks=[summary_collector1, summary_collector2])
```
Wrong code:
```python3
...
# Note: the 'ConfusionMatrixCallback' is user-defined, and it uses SummaryRecord to record data.
confusion_callback = ConfusionMatrixCallback('./summary_dir1')
summary_collector = SummaryCollecotor('./summary_dir2')
model.train(epoch=2, train_dataset, callbacks=[confusion_callback, summary_collector])
```
## Visualization Components
......@@ -305,6 +341,8 @@ Buttons from left to right in the upper right corner of the figure are used to d
- Step-by-step Rollback: Cancel operations step by step after continuously drawing rectangles to select and zooming in the same area.
- Restore Chart: Restore a chart to the original state.
There can set the threshold value to highlight the value or delete the threshold value in the lower right corner of the figure. As shown in the figure, the threshold set is less than 0.3, highlighted in red shows what is below the threshold, and it is intuitive to see the expected data value or some unusual value.
![scalar_select.png](./images/scalar_select.png)
Figure 2: Scalar visualization function area
......
......@@ -7,6 +7,7 @@
- [操作流程](#操作流程)
- [准备训练脚本](#准备训练脚本)
- [Summary数据收集](#summary数据收集)
- [注意事项](#注意事项)
- [可视化组件](#可视化组件)
- [训练看板](#训练看板)
- [标量可视化](#标量可视化)
......@@ -280,8 +281,42 @@ model.train(cnn_network, callbacks=[confusion_martrix])
在保存的文件中,`ms_output_after_hwopt.pb` 即为算子融合后的计算图,可以使用可视化页面对其进行查看。
> - 目前MindSpore仅支持在Ascend 910 AI处理器上导出算子融合后的计算图。
> - 在训练中使用Summary算子收集数据时,`HistogramSummary`算子会影响性能,所以请尽量少地使用。
### 注意事项
1. 目前MindSpore仅支持在Ascend 910 AI处理器上导出算子融合后的计算图。
2. 在训练中使用Summary算子收集数据时,`HistogramSummary` 算子会影响性能,所以请尽量少地使用。
3. 不能同时使用多个 `SummaryRecord` 实例 (`SummaryCollector` 中使用了 `SummaryRecord`)。
如果在 `model.train` 或者 `model.eval` 的callback列表中使用两个及以上的 `SummaryCollector` 实例,则视为同时使用 `SummaryRecord`,导致记录数据失败。
自定义callback中如果使用 `SummaryRecord`,则其不能和 `SummaryCollector` 同时使用。
正确代码:
```python3
...
summary_collector = SummaryCollecotor('./summary_dir')
model.train(epoch=2, train_dataset, callbacks=[summary_collector])
...
model.eval(dataset, callbacks=[summary_collector])
```
错误代码:
```python3
...
summary_collector1 = SummaryCollecotor('./summary_dir1')
summary_collector2 = SummaryCollecotor('./summary_dir2')
model.train(epoch=2, train_dataset, callbacks=[summary_collector1, summary_collector2])
```
错误代码:
```python3
...
# Note: the 'ConfusionMatrixCallback' is user-defined, and it uses SummaryRecord to record data.
confusion_callback = ConfusionMatrixCallback('./summary_dir1')
summary_collector = SummaryCollecotor('./summary_dir2')
model.train(epoch=2, train_dataset, callbacks=[confusion_callback, summary_collector])
```
## 可视化组件
......@@ -307,6 +342,8 @@ model.train(cnn_network, callbacks=[confusion_martrix])
- 分步回退是指对同一个区域连续框选并放大查看时,可以逐步撤销操作。
- 还原图形是指进行了多次框选后,点击此按钮可以将图还原回原始状态。
图中右下角可以设置阈值并高亮显示或者删除阈值。如图所示,设置的阈值为小于0.3,红色高亮部分显示出超出阈值的部分,能够直观地看到预期的数据值或者一些异常的数值。
![scalar_select.png](./images/scalar_select.png)
图2:标量可视化功能区
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册