首页 > 解决方案 > 由于没有使用标签,如何重新训练 TFHub 模块?

问题描述

这是 TensorFlow Hub 模块的链接:imagenet/mobilenet_v1_050_160/classification。在微调示例代码中:

module = hub.Module("https://tfhub.dev/google/imagenet/mobilenet_v1_050_160/classification/3",
                    trainable=True, tags={"train"})
logits = module(inputs=dict(images=images, batch_norm_momentum=0.997),
                signature="image_classification_with_bn_hparams")

似乎输入只包含图像,没有标签。我设法获得了输入信息,结果发现输入只有两个元素:输入图像批量规范动量

所以我想知道如何在没有标签输入的情况下重新训练/微调这个模块?

希望有人能告诉我批量规范动量在这个 TensorFlow 集线器模块中是如何工作的

非常感谢。

标签: pythontensorflow

解决方案


logits = module(inputs=dict(images=images, batch_norm_momentum=0.997), signature="image_classification_with_bn_hparams")

上述部分由作为索引的类标签组成。您可以在Usage中阅读有关它信息。

logits 的索引是来自原始训练的分类的 num_classes = 1001 个类


推荐阅读