fittar/visually_grounded_embeddings
收藏Visually Grounded embeddings for Fast-text and GloVe
该仓库包含多个基于视觉的词嵌入模型。这些嵌入模型有效地融入了来自图像的视觉信息,已被证明在各种词相似性和相关性基准测试中,与文本嵌入相比,能显示出更强的人类判断相关性。
使用方法
所有模型均采用 gensim 格式编码。加载模型的示例如下:
python import gensim
model_g = gensim.models.KeyedVectors.load_word2vec_format(path_to_embeddings, binary=True)
检索最相似的词
print(model_g.most_similar(together, topn=10))
[(togther, 0.6425853967666626), (togehter, 0.6374243497848511), (togeather, 0.6196791529655457), (togather, 0.5998020172119141), (togheter, 0.5819681882858276), (toghether, 0.5738174319267273), (2gether, 0.5187329053878784), (togethor, 0.501663088798523), (gether, 0.49128714203834534), (toegther, 0.48457157611846924)]
print(model_g.most_similar(sad, topn=10))
[(saddening, 0.6763913631439209), (depressing, 0.6676110029220581), (saddened, 0.6352651715278625), (sorrowful, 0.6336953043937683), (heartbreaking, 0.6180269122123718), (heartbroken, 0.6099187135696411), (tragic, 0.6039361953735352), (pathetic, 0.5848405361175537), (Sad, 0.5826965570449829), (mournful, 0.5742306709289551)]
查找异常词
print(model_g.doesnt_match([fire, water, land, sea, air, car]))
car
可用的嵌入模型
在 Files and Versions 标签下,您可以看到以下4个可用的嵌入模型:
-
来自论文 Learning Zero-Shot Multifaceted Visually Grounded Word Embeddings via Multi-Task Training 的嵌入模型:
- v_glove_1024d_1.0
- v_fasttext_1024d_1.0
-
来自论文 Language with Vision: a Study on Grounded Word and Sentence Embeddings 的嵌入模型:
- v_glove_1024d_2.0
- v_glove_300_d_2.0
所有模型均包含1024维的词向量,除了 v_glove_300_d_2.0 包含300维的词向量。



