flask渲染图像_用于图像推荐的Flask应用

flask渲染图像

After creating a Python-based machine learning application you might want to get it running on a website.

创建基于Python的机器学习应用程序后,您可能希望使其在网站上运行。

In this article it is explained how this can be realized with the microframework Flask for an image-based recommender system.

在本文中,说明了如何使用基于图像的推荐系统的微框架Flask来实现这一点。

We implement an image gallery on a website, the images can be selected, and similar images are displayed. Such a solution could be employed for example in online shops.

我们在网站上建立了图片库,可以选择图片,并显示类似的图片。 例如,可以在在线商店中采用这种解决方案。

The similarities are obtained by comparing feature vectors derived with a pretrained Resnet18 network as explained in a previous article. The results from this work are Pandas dataframes (essentially tables) with the names of most similar images and similarity values between zero (not similar) and one (most similar) for each image. These are stored and used here.

如上一篇文章所述,通过比较使用预训练的Resnet18网络导出的特征向量来获得相似性。 这项工作的结果是熊猫数据帧(基本上是表格),具有最相似图像的名称,并且每个图像的相似度值在零(不相似)和一个(最相似)之间。 这些在这里存储和使用。

In the next figure, in (a) the steps from the theory and implementation are sketched. This article focuses on part (b), where the dataframes have already been calculated offline to be used on a website.

在下图中,在(a)中概述了理论和实现的步骤。 本文重点介绍(b)部分,其中数据帧已离线计算以用于网站。

Image for post
Similarity matrix calculation (a) and sorted top-k list for recommendations (b). In this article Flask is used to use the results for a website (source: M. D. Korzec, 相似度矩阵计算(a )和推荐的排在前k位的列表(b)。 本文将Flask用于网站的搜索结果(来源:MD Korzec, Flask logo by Armin Ronacher, Copyrighted Armin Ronacher的Flask徽标 ,版权所有,可 free use) 免费使用 )

We will see how to

我们将看到如何

  • install Flask and run the app locally on a debug server

    安装Flask并在调试服务器上本地运行应用程序
  • define needed routes — the URLs that are used for the gallery and the recommendations

    定义所需的路线-用于画廊和推荐的URL
  • transfer the needed information from the user input to the backend and the recommendations back to the user

    将所需的信息从用户输入传递到后端,并将建议返回给用户
  • implement a html/JavaScript gallery that suggests similar images

    实现建议类似图像的html / JavaScript库
  • create pickle files based on my first two articles (theory, implementation with Jupyter notebook). Use them for top-k lists that define the recommended images.

    根据我的前两篇文章( 理论 ,使用Jupyter notebook 实现 )创建pickle文件。 将它们用于定义推荐图像的前k个列表。

1.烧瓶 (1. Flask)

Image for post
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值