工具链版本: HBDK3.2.0
TensorPliugin 代码: horizon_plugin_tensorflow/scripts/classification/configs/resnet50.py
公版代码: https://github.com/tensorflow/models/blob/r1.13.0/official/resnet/imagenet_preprocessing.py
TensorPliugin 代码: horizon_plugin_tensorflow/scripts/classification/configs/resnet50.py
公版代码: https://github.com/tensorflow/models/blob/r1.13.0/official/resnet/imagenet_preprocessing.py
分析:
1.使用GPU训练, CPU消耗主要发生在 DataLoader, 即数据预处理.
HBDK train.py 中函数: get_train_dataset
公版tensorflow 中函数: _decode_crop_and_flip
2. 预处理差异:
HBDK train.py 中的数据增强方式多于 imagenet_preprocessing.py
HBDK 中包含 image.rgb_to_yuv444_int8
classification/train.py 默认为Batch预处理, 而 imagenet_preprocessing.py 为单图预处理.
HBDK数据增强:
1.使用GPU训练, CPU消耗主要发生在 DataLoader, 即数据预处理.
HBDK train.py 中函数: get_train_dataset
公版tensorflow 中函数: _decode_crop_and_flip
2. 预处理差异:
HBDK train.py 中的数据增强方式多于 imagenet_preprocessing.py
HBDK 中包含 image.rgb_to_yuv444_int8
classification/train.py 默认为Batch预处理, 而 imagenet_preprocessing.py 为单图预处理.
HBDK数据增强:

公版数据增强:

解决办法:
1.减少get_train_dataset 中数据增强类型.
2.因为芯片可以直接将yuv数据当作输入数据, 故不建议修改.
3.将get_train_dataset 改为单图预处理. 将数据Batch化 移动到数据增强后.

修改后效果:
能明显将CPU占用率降低到500%.


