项目地址:https://github.com/haltakov/natural-language-image-search#two-dogs-playing-in-the-snow 在具体实现上,项目作者在 Colab Notebook 上将所有图片处理成了预计算特征向量,然后找到与自然语言搜索查询(即输入的文本)最匹配的图片。项目作者提供了一些效果展示图,如输入搜索词条「"Two dogs playing in the snow"」,就会出现以下几幅图片:
摄自:Richard Burlton、Karl Anderson 和 Xuecheng Chen。
输入搜索词条「"The word love written on the wall"」,就会出现以下包含「love」的文本:
3. 单击单元格中的某个位置(三角形除外),该行显示「search_query = "Two dogs playing in the snow"」;
4. 单击菜单「Runtime→Run before」,等待执行结束;
5. 找到读取(或最初读取)「search_query = "Two dogs playing in the snow"」这一行,将「 "Two dogs playing in the snow"」改变成你想要的查询。例如:「search_query = "A clock with gold-colored numbers on a black background"」;