Git Product home page Git Product logo

animeback's Introduction

AnimeBack

以图搜番。这是一个动漫场景搜索引擎服务端。可以通过番剧某一刻的截图,反向搜索它出自哪部番,以及出现的确切时间。网站前端

trace.moe相比,由于使用的是深度学习模型提取图像特征,此项目或许能够提供鲁棒性更高,更准确的搜索服务。也因此性能开销更大,收录比较慢。目前仍处于测试阶段

示例

测试图片

测试图片

搜索结果

部署

环境要求

需要安装python3;需要安装ffmpeg

安装依赖项:

pip install bilibili_api imagehash tensorflow keras flask pymilvus opencv-python sklearn bilili
# Linux
pip install plyvel
# Windows
pip install plyvel-win32

运行

  • 初始化配置文件
python run.py
python run.py download-bilibili
  • 运行视频处理/录入程序
# 将会处理已下载的视频
python run.py process
  • 运行网站后端
python app.py

此方法仅供测试。生产环境请参考Flask部署方式

下面 的例子使用gunicorn, 4 worker 进程( -w 4 )来运行 Flask 应用,绑定到 localhost 的 4000 端口( -b 127.0.0.1:4000 ):

gunicorn -w 4 -b 127.0.0.1:4000 app:flask_app

技术实现

  • 通过bilibili(或其他网站)的API,自动下载番剧,并初步保存番剧信息

  • 使用ffmpeg压缩视频并转为mp4,放到网站静态目录下

  • 使用ffmpeg,将视频以一定采样率转为图片,放到临时目录

  • 逐帧读取图片,通过phash算法过滤掉相邻的相似图片,其余的图片用模型提取特征向量,插入到milvus。添加的每帧的idtime、所属epid等对应信息存到leveldb数据库

  • 搜索时同样提取图像特征向量,用milvus搜索,返回相似帧的id,再通过数据库查询其他信息

To-do

  • 支持Xception预训练模型与PCA降维
  • 训练更符合需求的模型
  • 实现对op/ed的优化
  • 自动从樱花动漫下载
  • 开放搜索API

Thanks · 鸣谢

  • 部分过程参考以图搜番。部分思路来自tuxiaobei
  • 从B站下载的部分使用了bilili
  • 自动裁剪图像黑边的实现,来源于trace.moecrop.py
  • 使用了Milvus索引和搜索向量
  • 使用了各深度学习模型提取图像特征

animeback's People

Contributors

nitrorcr avatar

Stargazers

neet姬辉夜大人 avatar  avatar  avatar 占子怡 avatar DeathLine avatar c2awsl avatar  avatar Jeremy Chen avatar  avatar TonyYu avatar  avatar Zack Young avatar 源文雨 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.