# 以图搜图服务 **Repository Path**: itwyp/image-search-service ## Basic Information - **Project Name**: 以图搜图服务 - **Description**: 使用resnet50计算图片向量值存储在elasticsearch中,以便查询 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-12-25 - **Last Updated**: 2024-08-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 以图搜图 towhee+elasticsearch实现本地以图搜图 elasticsearch版本为 7.4.2 github地址:[https://github.com/xjhqre/towhee-img-search](https://github.com/xjhqre/towhee-img-search) elasticsearch安装方法参考我的这篇文章:[全文检索-ElasticSearch](https://blog.csdn.net/xjhqre/article/details/124553312) ## 使用方法 一、使用说明 1、下载依赖:pip3 install -r requirements.txt 2、config.py中配置相关配置 3、extractFeatures.py 用来抽取图片向量,保存到es,即为图片数据上载;linux启动方式:nohup python3 extractFeatures.py & 此程序为读取完落地目录下的图片即停止,有新的图片需要上载,重新启动此程序即可! 4、启动searchServer.py 此为后端服务,端口可在config.py配置 启动方式: nohup python3 searchServer.py & 二、使用 static/img地址存储图片。 三、创建 elasticsearch 索引。 PUT imgsearch ```json { "mappings": { "properties": { "feature": { "type": "dense_vector", "dims": 1024 }, "url": { "type": "keyword" }, "name": { "type": "keyword" } } } } ``` 三、修改 config.py 中的配置。 四、运行 extractFeatures.py,提取图片特征向量并存储到elasticsearch。 五、运行 searchServer.py,启动 web 服务。 六、访问地址,测试是否启动