python3 下 tensorflow slim inceptionV4 问题修正与测试 - Go语言中文社区

python3 下 tensorflow slim inceptionV4 问题修正与测试


自从残差网络出来之后,好多人就想着能不能对模型进行结合测试一下。Google ResearchInception模型和Microsoft ResearchResidualNet模型两大图像识别杀器结合效果如何?在这篇223日公布在arxiv上的文章“Inception-v4, Inception-ResNet and the Impactof Residual Connections on Learning”给出了实验上的结论。

发现tensorflowslim 模型中包含有inception_v4的预训练模型,于是进行测试了下,发现效果相当不错,下面就将测试结果罗列如下:

 

1)由于环境用的是python3,发现tensorflow公开的slim模型中的inception存在一些BUG,主要问题在于xrange问题。

  # 35 x 35 x 384

      # 4 x Inception-A blocks

      for idx in range(4):

        block_scope ='Mixed_5' + chr(ord('b') + idx)

        net =block_inception_a(net, block_scope)

        ifadd_and_check_final(block_scope, net): return net, end_points

 

      # 35 x 35 x 384

      # Reduction-A block

      net = block_reduction_a(net,'Mixed_6a')

      ifadd_and_check_final('Mixed_6a', net): return net, end_points

 

      # 17 x 17 x 1024

      # 7 x Inception-B blocks

      for idxin range(7):

        block_scope ='Mixed_6' + chr(ord('b') + idx)

        net = block_inception_b(net,block_scope)

        ifadd_and_check_final(block_scope, net): return net, end_points

 

      # 17 x 17 x 1024

      # Reduction-B block

      net =block_reduction_b(net, 'Mixed_7a')

      ifadd_and_check_final('Mixed_7a', net): return net, end_points

 

      # 8 x 8 x 1536

      # 3 x Inception-C blocks

      for idxin range(3):

        block_scope ='Mixed_7' + chr(ord('b') + idx)

        net =block_inception_c(net, block_scope)

        ifadd_and_check_final(block_scope, net): return net, end_points

  raise ValueError('Unknownfinal endpoint %s' % final_endpoint)

 

需要把原来代码中的xrange修改为range,这是由于python3与python2环境不兼容问题所导致的。


(2)图像识别测试



识别精度结果:

使用预训练模型:InceptionV4 进行训练后的效果比较:

Probability 85.64% => [tiger, Panthera tigris]

Probability 5.51% => [tiger cat]

Probability 0.19% => [jaguar, panther, Panthera onca, Felis onca]

Probability 0.19% => [lynx, catamount]

Probability 0.08% => [leopard, Panthera pardus]


比vgg直接提高了13个百分点




测试结果如下,也是精度提高了好多。


版权声明:本文来源CSDN,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/sparkexpert/article/details/70229608
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。
  • 发表于 2020-06-28 00:08:16
  • 阅读 ( 706 )
  • 分类:

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢