> # ♻️ 资源
> **大小:** 12.2MB
> **文档链接:**[**https://www.yuque.com/sxbn/ks/100013183**](https://www.yuque.com/sxbn/ks/100013183)
**➡️ 资源下载:**[**https://download.csdn.net/download/s1t16/88217565**](https://download.csdn.net/download/s1t16/88217565)
**注:如当前文章或代码侵犯了您的权益,请私信作者删除!**
# 1 Project Overview
## 1.1 Project Description
Based on tensorflow and Flask, a web-based image search engine is realized, which can realize simple image search function based on server images database.
## 1.2 Project function requirements
●It contains an input box to upload an image (Formulation);
●Users can preview the query image in the searching window (Formulation);
●It has a search button (Initiation);
●Provide an overview of the results (e.g. the total number of results) (Review);
●Allow changing search parameters (e.g. select certain category/tag) when reviewing results (Refinement);
●Users can take some actions, e.g. add selected images to a favorite list (Use);
# 2 Design and implementation
## 2.1 Design
### 2.1.1 Code design
The program code is divided into two parts: front end and back end. The front and back end realize data transmission through Flask. The back end is python program, and the front end is web application.
The file directory structure is as follows:
├── database
│ ├── dataset
│ └── tags
├── imagenet
├── static
│ ├── favorite
│ ├── images
│ └── result
├── uploads
├── templates
│ └── HTML
└── .py
#### Main function design:
front end:
```javascript
//Show favorite function, bind with favorite button
function favorite_fun()
//Add a favorite function, bound to the Add to favorites button
function addFavorite_fun()
//Confirm the collection function, bind to the Confirm collection button
function confirm_fun()
//Delete favorite image function, bind with Delete button
function delete_fun()
//Confirm delete function, bind with Confirm delete button
function confirmdelete_fun()
//Tag selection function, binding to each tag button except favorite, passing arguments by str
function tag_fun(str)
//Search function, bound to the Search button
function fun()
```
back end:
```python
# This function is used to do the image search/image retrieval
@app.route('/imgUpload', methods=['GET', 'POST']) # /imgUpload matches the url in ajax
def upload_img():
# This function is tag
@app.route('/tag', methods=['GET', 'POST'])
def tag():
# This function is addFavorite
@app.route('/addFavorite', methods=['GET', 'POST'])
def addFavorite():
# This function is displaying favorites
@app.route('/favorite', methods=['GET', 'POST'])
def favorite():
# This function is deleting favorites
@app.route('/deleteFavorite', methods=['GET', 'POST'])
def deleteFavorite():
```
### 2.1.2 interface design
#### Start interface:
Include theme、upload file button、search button、preview image、tag bar and my favorites.
![image.png](https://cdn.nlark.com/yuque/0/2023/png/2469055/1692065879609-2ea7d782-5bf8-44d0-aaa5-aab9fdb2105a.png#averageHue=%23f7f7f6&clientId=u341880a2-b95d-4&from=paste&height=382&id=ue0eb8434&originHeight=478&originWidth=1462&originalType=binary&ratio=1.25&rotation=0&showTitle=false&size=102712&status=done&style=none&taskId=u83deb5bc-bbad-4ac9-affb-60a439bc3d8&title=&width=1169.6)
#### Search results interface:
Show search results and description of search results:
![image.png](https://cdn.nlark.com/yuque/0/2023/png/2469055/1692065907627-e7ec8113-225d-4eec-81f8-e9b55662d4fc.png#averageHue=%23ede6de&clientId=u341880a2-b95d-4&from=paste&height=613&id=u5eff9585&originHeight=766&originWidth=1419&originalType=binary&ratio=1.25&rotation=0&showTitle=false&size=351150&status=done&style=none&taskId=u82076e99-0d8a-4b64-a595-2aab58991ee&title=&width=1135.2)
#### My favorites interface:
Show a collection of pictures, a description of the number of pictures.
![image.png](https://cdn.nlark.com/yuque/0/2023/png/2469055/1692065932181-83a0b4fa-6157-4c79-987f-5844d9da20a1.png#averageHue=%23f0ece8&clientId=u341880a2-b95d-4&from=paste&height=652&id=u6b714085&originHeight=815&originWidth=1423&originalType=binary&ratio=1.25&rotation=0&showTitle=false&size=329798&status=done&style=none&taskId=u7a0c1879-6dd0-4ddd-9fa0-b08f9d6933b&title=&width=1138.4)
## 2.2 Implementation
### 2.2.1 Main function implementation
#### Show search results
#### front end:
```javascript
function fun(){
$('#div2').hide();//Hide favorites content
$('#load').show();//Display loading animation
$("#confirm").hide();//Hide Confirm Favorites button
$("#addFavorite").show();//Show Add to favorites button
$("form").submit(function(evt){
evt.preventDefault();
var formData = new FormData($(this)[0]);
$.ajax({
url: 'imgUpload',
type: 'POST',
data: formData,
//async: false,
cache: false,
contentType: false,
enctype: 'multipart/form-data',
processData: false,
success: function (response) {//Response returns the searched image path
$('#load').hide();//Hidden loading animation
$('#clearrow').show();//Show Clear button
//Show searched images
$("#img0").show();
$("#img1").show();
$("#img2").show();
$("#img3").show();
$("#img4").show();
$("#img5").show();
$("#img6").show();
$("#img7").show();
$("#img8").show();
//Assign values to each image path
document.getElementById("img0").src = response.image0;
console.log(response.image0);
console.log(document.getElementById("img0").src);
document.getElementById("img1").src = response.image1;
document.getElementById("img2").src = response.image2;
document.getElementById("img3").src = response.image3;
document.getElementById("img4").src = response.image4;
document.getElementById("img5").src = response.image5;
document.getElementById("img6").src = response.image6;
document.getElementById("img7").src = response.image7;
document.getElementById("img8").src = response.image8;
$('#table').show();//Display picture table
$('#resultStats').show();//Display result statement
$('#clear').show();//Show Clear button
}
});
return false;
})
}
```
#### back end:
```python
@app.route('/imgUpload', methods=['GET', 'POST']) # /imgUpload matches the url in ajax
def upload_img():
print("image upload")
result = 'static/result'
if not gfile.Exists(result): # If there is no result folder, create it
os.mkdir(result)
shutil.rmtree(result) # Empty the result folder
if request.method == 'POST' or request.method == 'GET':
print(request.method)
# check if the post request has the file part
if 'file' not in request.files:
print('No file part')
return redirect(request.url)
file = request.files['file']
print(file.filename)
# if user does not select file, browser also
# submit a empty part without filename
if file.filename == '':
print('No selected file')
return redirect(request.url)
if file: # and allowed_file(file.filename):
filename = secure_filename(file.filename)
没有合适的资源?快使用搜索试试~ 我知道了~
基于tensorflow和flask的本地图片库web图片搜索引擎【100013183】
共29个文件
png:12个
xml:3个
py:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 105 浏览量
2023-08-15
11:09:46
上传
评论
收藏 12.25MB ZIP 举报
温馨提示
基于tensorflow和Flask,实现了一个基于web的图像搜索引擎,可以实现基于服务器图像数据库的简单图像搜索功能。 它包含一个上传图像的输入框(公式) 用户可以在搜索窗口预览查询图像(公式) 它有一个搜索按钮(初始化) 提供结果的概述(例如结果的总数)(审阅) 允许在检查结果时更改搜索参数(例如选择某些类别/标签)(改进) 用户可以采取一些行动,例如,将选定的图像添加到收藏列表(使用)
资源推荐
资源详情
资源评论
收起资源包目录
100013183-基于tensorflow和flask的本地图片库web图片搜索引擎.zip (29个子文件)
local_gallery_search
src
assets
Delete.png 490KB
favorites interface.png 492KB
Delete successfully.png 490KB
Show favorites.png 488KB
Upload image and display search results.png 505KB
search results.png 572KB
Tag.png 351KB
Delete result.png 322KB
Add to favorites.png 870KB
Start interface.png 88KB
Start.png 79KB
add successfully.png 868KB
readme.md 25KB
readme.pdf 6.92MB
server
rest-server.py 13KB
templates
.vscode
settings.json 40B
main.html 29KB
.idea
workspace.xml 9KB
misc.xml 315B
server.iml 398B
modules.xml 264B
image_vectorizer.py 3KB
__pycache__
search.cpython-37.pyc 3KB
static
images
ajax-loader.gif 32KB
logo6.jpg 12KB
preimg8.jpg 13KB
search.py 4KB
LICENSE 1KB
README.md 29KB
共 29 条
- 1
资源评论
神仙别闹
- 粉丝: 3774
- 资源: 7469
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- (源码)基于Spring MVC和Hibernate框架的学校管理系统.zip
- (源码)基于TensorFlow 2.3的高光谱水果糖度分析系统.zip
- (源码)基于Python框架库的知识库管理系统.zip
- (源码)基于C++的日志管理系统.zip
- (源码)基于Arduino和OpenFrameworks的植物音乐感应系统.zip
- (源码)基于Spring Boot和Spring Security的博客管理系统.zip
- (源码)基于ODBC和C语言的数据库管理系统.zip
- (源码)基于Spring Boot和Vue的Jshop商城系统.zip
- (源码)基于C++的学生信息管理系统.zip
- (源码)基于Arduino的实时心电图监测系统.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功