Browse Source

!12749 amend_resnet18

From: @jiangzg001
Reviewed-by: @liangchenghui,@c_34
Signed-off-by: @c_34
tags/v1.2.0-rc1
mindspore-ci-bot Gitee 5 years ago
parent
commit
e89b70ffc8
4 changed files with 21 additions and 20 deletions
  1. +4
    -4
      model_zoo/official/cv/resnet/README.md
  2. +4
    -4
      model_zoo/official/cv/resnet/README_CN.md
  3. +12
    -9
      model_zoo/official/cv/resnet/src/resnet.py
  4. +1
    -3
      model_zoo/official/cv/resnet/train.py

+ 4
- 4
model_zoo/official/cv/resnet/README.md View File

@@ -492,8 +492,8 @@ result: {'top_5_accuracy': 0.9342589628681178, 'top_1_accuracy': 0.7680657810499
| Loss Function | Softmax Cross Entropy |
| outputs | probability |
| Loss | 0.0002519517 |
| Speed | 10 ms/step(8pcs) |
| Total time | 3 mins |
| Speed | 13 ms/step(8pcs) |
| Total time | 4 mins |
| Parameters (M) | 11.2 |
| Checkpoint for Fine tuning | 86M (.ckpt file) |
| Scripts | [Link](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/cv/resnet) |
@@ -512,8 +512,8 @@ result: {'top_5_accuracy': 0.9342589628681178, 'top_1_accuracy': 0.7680657810499
| Loss Function | Softmax Cross Entropy |
| outputs | probability |
| Loss | 2.15702 |
| Speed | 140ms/step(8pcs) |
| Total time | 131 mins |
| Speed | 110ms/step(8pcs) (may need to set_numa_enbale in dataset.py) |
| Total time | 110 mins |
| Parameters (M) | 11.7 |
| Checkpoint for Fine tuning | 90M (.ckpt file) |
| Scripts | [Link](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/cv/resnet) |


+ 4
- 4
model_zoo/official/cv/resnet/README_CN.md View File

@@ -459,8 +459,8 @@ result:{'top_5_accuracy':0.9342589628681178, 'top_1_accuracy':0.768065781049936}
| 损失函数 | Softmax交叉熵 |
| 输出 | 概率 |
| 损失 | 0.0002519517 |
| 速度 | 10毫秒/步(8卡) |
| 总时长 | 3分钟 |
| 速度 | 13毫秒/步(8卡) |
| 总时长 | 4分钟 |
| 参数(M) | 11.2 |
| 微调检查点 | 86(.ckpt文件) |
| 脚本 | [链接](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/cv/resnet) |
@@ -479,8 +479,8 @@ result:{'top_5_accuracy':0.9342589628681178, 'top_1_accuracy':0.768065781049936}
| 损失函数 | Softmax交叉熵 |
| 输出 | 概率 |
| 损失 | 2.15702 |
| 速度 | 140毫秒/步(8卡) |
| 总时长 | 131分钟 |
| 速度 | 110毫秒/步(8卡) (可能需要在datasetpy中增加set_numa_enbale绑核操作) |
| 总时长 | 110分钟 |
| 参数(M) | 11.7 |
| 微调检查点| 90M(.ckpt文件) |
| 脚本 | [链接](https://gitee.com/mindspore/mindspore/tree/master/model_zoo/official/cv/resnet) |


+ 12
- 9
model_zoo/official/cv/resnet/src/resnet.py View File

@@ -176,8 +176,8 @@ class ResidualBlock(nn.Cell):
in_channel (int): Input channel.
out_channel (int): Output channel.
stride (int): Stride size for the first convolutional layer. Default: 1.
use_se (bool): enable SE-ResNet50 net. Default: False.
se_block(bool): use se block in SE-ResNet50 net. Default: False.
use_se (bool): Enable SE-ResNet50 net. Default: False.
se_block(bool): Use se block in SE-ResNet50 net. Default: False.

Returns:
Tensor, output tensor.
@@ -276,8 +276,9 @@ class ResidualBlockBase(nn.Cell):
in_channel (int): Input channel.
out_channel (int): Output channel.
stride (int): Stride size for the first convolutional layer. Default: 1.
use_se (bool): enable SE-ResNet50 net. Default: False.
se_block(bool): use se block in SE-ResNet50 net. Default: False.
use_se (bool): Enable SE-ResNet50 net. Default: False.
se_block(bool): Use se block in SE-ResNet50 net. Default: False.
res_base (bool): Enable parameter setting of resnet18. Default: True.

Returns:
Tensor, output tensor.
@@ -290,9 +291,9 @@ class ResidualBlockBase(nn.Cell):
in_channel,
out_channel,
stride=1,
res_base=True,
use_se=False,
se_block=False):
se_block=False,
res_base=True):
super(ResidualBlockBase, self).__init__()
self.res_base = res_base
self.conv1 = _conv3x3(in_channel, out_channel, stride=stride, res_base=self.res_base)
@@ -341,8 +342,10 @@ class ResNet(nn.Cell):
out_channels (list): Output channel in each layer.
strides (list): Stride size in each layer.
num_classes (int): The number of classes that the training images are belonging to.
use_se (bool): enable SE-ResNet50 net. Default: False.
se_block(bool): use se block in SE-ResNet50 net in layer 3 and layer 4. Default: False.
use_se (bool): Enable SE-ResNet50 net. Default: False.
se_block(bool): Use se block in SE-ResNet50 net in layer 3 and layer 4. Default: False.
res_base (bool): Enable parameter setting of resnet18. Default: True.

Returns:
Tensor, output tensor.

@@ -432,7 +435,7 @@ class ResNet(nn.Cell):
in_channel (int): Input channel.
out_channel (int): Output channel.
stride (int): Stride size for the first convolutional layer.
se_block(bool): use se block in SE-ResNet50 net. Default: False.
se_block(bool): Use se block in SE-ResNet50 net. Default: False.
Returns:
SequentialCell, the output layer.



+ 1
- 3
model_zoo/official/cv/resnet/train.py View File

@@ -110,9 +110,7 @@ if __name__ == '__main__':
set_algo_parameters(elementwise_op_strategy_follow=True)
if args_opt.net == "resnet50" or args_opt.net == "se-resnet50":
context.set_auto_parallel_context(all_reduce_fusion_config=[85, 160])
elif args_opt.net == "resnet18":
context.set_auto_parallel_context(all_reduce_fusion_config=[40, 61])
else:
elif args_opt.net == "resnet101":
context.set_auto_parallel_context(all_reduce_fusion_config=[180, 313])
init()
# GPU target


Loading…
Cancel
Save