imdex
v0.2.0
IMDEX是一个库,允许在图像集上进行语义搜索
要安装库,只需在您的
pip install imdex
安装库后,您只需要导入要使用的模块,可用的模块就在下面列出。
Imdex
|-Loader
|-Captioner
-Indexer
加载程序模块是导入和格式化所有要索引的图像的简单方法,它允许您导入单个图像或文件夹,它可以正确返回图像,并准备使用大小
from imdex.loader import load_image, load_foder
images = [load_image("./sample_img/surf.jpg")]#importing single image
images, references = load_foder("sample_img")#importing all images in a folder with their names to be used as references to the image
该模块负责为图像字幕,由索引模块调用,但可以独立导入和使用
from imdex.Captioner import Captioner
cap = Captioner()
images = []#list of images
cap.captionize(images)# returns a list of captions
索引器是负责检索图像的类,一旦图像包含在索引器中,字幕模块将提供英语描述,该描述可以保存为文件并稍后加载,所有图像都需要一个字符串引用来识别它们,例如它们的名称。为了查询图像,它们的描述和查询句子被转换为嵌入的向量,以测量这些距离之间的距离,当计算距离时,将创建排序的向量并返回作为函数的输出。
from imdex.Indexer import Indexer
idr = Indexer()
images, references = load_foder("sample_img")
idr.add_images(images, references)
idr.query("a cat is laying")
idr.save_to_csv("images.imdex")
要加载描述,您必须创建索引类类的新实例,并将文件的名称用作构造函数中的参数
idr = Indexer(captions_csv_path="images.imdex")
作为一个新库,它有很多改进要做的改进,这是主要库的列表:
想帮忙吗?将合并请求或电子邮件发送到[email protected]