Skip to content

Commit

Permalink
更新说明文档,优化依赖安装
Browse files Browse the repository at this point in the history
  • Loading branch information
chn-lee-yumi committed Jun 17, 2023
1 parent 21d2c5c commit 6548bdf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@

注意,首次运行会自动下载模型。下载速度可能比较慢,请耐心等待。如果网络不好,模型可能会下载失败,这个时候重新执行程序即可。

1. 首次使用前需要安装依赖:`pip install -r requirements.txt`,Windows系统可以双击`install.bat`纯CPU)或`install_gpu.bat`GPU加速)。
1. 首次使用前需要安装依赖:`pip install -U -r requirements.txt`,Windows系统可以双击`install.bat`NVIDIA GPU加速)或`install_cpu.bat`纯CPU)。
2. 如果你打算使用GPU加速,则执行基准测试判断是CPU快还是GPU快:`python benchmark.py`,Windows系统可以双击`benchmark.bat`。GPU不一定比CPU快,在我的Mac上CPU更快。
3. 如果不是CPU最快,则修改`config.py`中的`DEVICE``DEVICE_TEXT`,改为对应设备,如`DEVICE = "cuda"`
4. 启动程序:`python main.py`,Windows系统可以双击`run.bat`

如遇到`requirements.txt`版本依赖问题(比如某个库版本过新会导致运行报错),请提issue反馈,我会添加版本范围限制。

如果想使用"下载视频片段"的功能,需要安装ffmpeg。
如遇到硬件支持但无法使用GPU加速的情况,请根据[PyTorch文档](https://pytorch.org/get-started/locally/)更新torch版本。

如果想使用"下载视频片段"的功能,需要安装`ffmpeg`。如果是Windows系统,记得把`ffmpeg.exe`所在目录加入环境变量`PATH`,可以参考:[Bing搜索](https://cn.bing.com/search?q=windows+%E5%A6%82%E4%BD%95%E6%B7%BB%E5%8A%A0+path+%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F)

### 通过Docker部署

Expand Down Expand Up @@ -57,6 +59,22 @@

小图片没被扫描到的话,可以调低`IMAGE_MIN_WIDTH``IMAGE_MIN_HEIGHT`重试。

## 问题解答

如遇问题,请先仔细阅读本文档。如果找不到答案,请在issue中搜索是否有类似问题。如果没有,可以新开一个issue,**详细说明你遇到的问题,加上你做过的尝试和思考,附上报错内容和截图,并说明你使用的系统(Windows/Linux/MacOS)和`config.py`的配置**

本人只负责本项目的功能、代码和文档等相关问题(例如功能不正常、代码报错、文档内容有误等)。**运行环境问题请自行解决(例如:如何配置Python环境,无法使用GPU加速,如何安装ffmpeg等)。**

本人做此项目纯属“为爱发电”(也就是说,其实本人并没有义务解答你的问题)。为了提高问题解决效率,请尽量在开issue时一次性提供尽可能多的信息。如问题已解决,请记得关闭issue。一个星期无人回复的issue会被关闭。如果在被回复前已自行解决问题,推荐留下解决步骤,赠人玫瑰,手有余香。

## 硬件要求

推荐使用`amd64``arm64`架构的CPU。内存最低2G,但推荐最少4G内存。如果照片数量很多,推荐增加更多内存。

测试环境:J3455,8G内存。全志H6,2G内存。

如果使用AMD的GPU,仅支持在Linux下使用GPU加速。请参考:[PyTorch文档](https://pytorch.org/get-started/locally/)

## 搜索速度

在 J3455 CPU 上,1秒钟可以进行大约17000次图片匹配(视频匹配可能会稍慢一些)。
Expand Down
2 changes: 1 addition & 1 deletion install.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pip install -r requirements.txt --index-url=https://pypi.douban.com/simple/
pip install -U -r requirements.txt --index-url=https://download.pytorch.org/whl/cu118 --extra-index-url=https://pypi.douban.com/simple/
pause
2 changes: 2 additions & 0 deletions install_cpu.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pip install -U -r requirements.txt --index-url=https://pypi.douban.com/simple/
pause

0 comments on commit 6548bdf

Please sign in to comment.