尝试使用Tensorflow用Imagenet数据集训练AlexNet模型

时间:2018-07-13 02:34:25

标签: python tensorflow imagenet

我正在使用Tensorflow用Imagenet数据集训练AlexNet模型。我正在Ubuntu上工作,我克隆了一个现有的github存储库

https://github.com/dontfollowmeimcrazy/imagenet

我已经下载了train_label.txt和validation_label.txt。当我运行train.py时,我收到一个TypeError提示:

def load_imagenet_meta(meta_path):
    """ It reads ImageNet metadata from ILSVRC 2012 dev tool file

        Args:
            meta_path: path to ImageNet metadata file

        Returns:
            wnids: list of ImageNet wnids labels (as strings)
            words: list of words (as strings) referring to wnids labels and describing the classes 

    """
    metadata = loadmat(meta_path, struct_as_record=False)

    # ['ILSVRC2012_ID', 'WNID', 'words', 'gloss', 'num_children', 'children', 'wordnet_height', 'num_train_images']
    synsets = np.squeeze(metadata['synsets'])
    ids = np.squeeze(np.array([s.ILSVRC2012_ID for s in synsets]))
    wnids = np.squeeze(np.array([s.WNID for s in synsets]))
    words = np.squeeze(np.array([s.words for s in synsets]))
    return wnids, words

train_util.py文件中的相关代码如下:

.container{
  width: 300px;
  height: 300px;
  position: relative;
}

img{
  position: absolute;
  top: 0;
  left: 0;
}

.img-top{
  z-index: 999999;
  transition: 0.3s linear all;
}

.img-top:hover{
  opacity: 0;
}

有人知道如何获取Imagenet metadata.mat文件吗?我只是在官方网站上找到了train_label.txt和validation_label.txt。

0 个答案:

没有答案