【问题标题】:Where to find english labels for tensorflow hub classify modules在哪里可以找到 tensorflow hub 分类模块的英文标签
【发布时间】:2018-07-15 06:05:33
【问题描述】:

我想按原样使用 https://tfhub.dev/google/imagenet/inception_v3/classification/1 模块而不进行修改,以使用原始标签集进行推断(如果没有其他原因,只是在修改之前验证它是否正常工作)。

我需要一种将输出 logits 映射回英语的方法。此示例https://github.com/tensorflow/models/blob/master/tutorials/image/imagenet/classify_image.py 显示了与检查点文件一起打包的英文映射。 docker hub 上版本的检查点文件没有类似的映射(我可以找到)http://download.tensorflow.org/models/inception_v3_2016_08_28.tar.gz

如何将 tensorflow hub 模型的输出 logits 映射回英文?

【问题讨论】:

    标签: tensorflow


    【解决方案1】:

    在深入研究 tfslim 模型源后,我找到了一些实用程序。

    这里总结:https://github.com/tensorflow/models/blob/461fc09474d8f532b9c0250dd54b885c537df99f/research/slim/slim_walkthrough.ipynb

    但是,本质上:

    from datasets import imagenet
    # ^ this module does not exist in a package repo as far as I can tell.
    # I just manually downloaded it and its dependencies from the above repo.
    
    ...
    names = imagenet.create_readable_names_for_imagenet_labels()
    print('Probability %0.2f%% => [%s]' % (probabilities[index] * 100, names[index]))
    

    【讨论】:

      猜你喜欢
      • 2021-08-11
      • 1970-01-01
      • 2021-12-31
      • 2021-07-05
      • 2016-06-18
      • 1970-01-01
      • 2019-08-30
      • 2021-11-22
      • 1970-01-01
      相关资源
      最近更新 更多