Skip to content

Commit

Permalink
docs: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
aoguai committed Feb 6, 2025
1 parent 11be456 commit 9137130
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 46 deletions.
89 changes: 65 additions & 24 deletions docs/README-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,27 @@ LiYing can run completely offline. All image processing operations are performed

### Bundled Package

If you are a Windows user and do not need to review the code, you can [download the bundled package](https://github.com/aoguai/LiYing/releases/latest) (tested on Windows 7 SP1 & Windows 10). Extract it and drag your images or directory into `run_en.bat` to start LiYing.
If you are a Windows user and do not need to review the code, you can [download the bundled package](https://github.com/aoguai/LiYing/releases/latest) (tested on Windows 7 SP1 & Windows 10).

The bundled package does not include any models. You can refer to the [Downloading the Required Models](https://github.com/aoguai/LiYing/blob/master/docs/README-EN.md#downloading-the-required-models) section for instructions on downloading the models and placing them in the correct directory.

If you encounter issues while running the program, please first check the [Prerequisites](https://github.com/aoguai/LiYing/blob/master/docs/README-EN.md#prerequisites) section to ensure your environment is properly set up. If everything is fine, you can ignore this step.

#### Running the bundled package

Run the BAT script:
```shell
cd LiYing
run.bat ./images/test1.jpg
```

Run the WebUI interface:
```shell
# Run WebUI
cd LiYing
run_webui.bat
# Open your browser and visit 127.0.0.1:7860
```

### Setup and Installation

Expand Down Expand Up @@ -63,7 +83,7 @@ cd LiYing ## Enter the LiYing directory
pip install -r requirements.txt # Install Python helpers' dependencies
```

**Note: If you are using Windows 7, ensure you have at least Windows 7 SP1 and `onnxruntime==1.14.0`.**
**Note: If you are using Windows 7, ensure you have at least Windows 7 SP1 and `onnxruntime==1.14.0, orjson==3.10.7, gradio==4.44.1`.**

#### Downloading the Required Models

Expand All @@ -77,18 +97,34 @@ Download the models used by the project and place them in `LiYing/src/model`, or

**Note: For the yolov8n-pose model, you need to export it to an ONNX model. Refer to the [official documentation](https://docs.ultralytics.com/integrations/onnx/) for instructions.**

We also provide pre-converted ONNX models that you can download and use directly:

| Download Method | Link |
|-----------------|--------------------------------------------------------------------------------|
| Google Drive | [Download Link](https://drive.google.com/file/d/1F8EQfwkeq4s-P2W4xQjD28c4rxPuX1R3/view) |
| Baidu Netdisk | [Download Link (Extraction Code: ahr9)](https://pan.baidu.com/s/1QhzW53vCbhkIzvrncRqJow?pwd=ahr9) |
| GitHub Releases | [Download Link](https://github.com/aoguai/LiYing/releases/latest) |

#### Running

```shell
# View CIL help
cd LiYing/src
python main.py --help
```

For Windows users, the project provides a batch script for convenience:

```shell
# Run BAT script
cd LiYing
run_en.bat ./images/test1.jpg
run.bat ./images/test1.jpg
```

```shell
# Run WebUI
cd LiYing/src/webui
python app.py
```

#### CLI Parameters and Help
Expand All @@ -101,55 +137,60 @@ Options:
-y, --yolov8-model-path PATH Path to YOLOv8 model
-u, --yunet-model-path PATH Path to YuNet model
-r, --rmbg-model-path PATH Path to RMBG model
-sz, --size-config PATH Path to size configuration file
-cl, --color-config PATH Path to color configuration file
-b, --rgb-list RGB_LIST RGB channel values list (comma-separated)
for image composition
-s, --save-path PATH Path to save the output image
-p, --photo-type TEXT Photo types(supporting formats of XXpx x
XXpx or those specified in the data.ini)
--photo-sheet-size TEXT Size of the photo sheet(supporting formats
of XXpx x XXpx or those specified in the
data.ini)
-p, --photo-type TEXT Photo types
-ps, --photo-sheet-size TEXT Size of the photo sheet
-c, --compress / --no-compress Whether to compress the image
-sc, --save-corrected / --no-save-corrected
-sv, --save-corrected / --no-save-corrected
Whether to save the corrected image
-bg, --change-background / --no-change-background
Whether to change the background
-sb, --save-background / --no-save-background
Whether to save the image with changed
background
-lo, --layout-only Only layout the photo without changing
background
-sr, --sheet-rows INTEGER Number of rows in the photo sheet
-sc, --sheet-cols INTEGER Number of columns in the photo sheet
--rotate / --no-rotate Whether to rotate the photo by 90 degrees
-rt, --rotate / --no-rotate Whether to rotate the photo by 90 degrees
-rs, --resize / --no-resize Whether to resize the image
-srz, --save-resized / --no-save-resized
-sz, --save-resized / --no-save-resized
Whether to save the resized image
-al, --add-crop-lines / --no-add-crop-lines
Add crop lines to the photo sheet
--help Show this message and exit.

```

### Other Configuration
#### Configuration Files

In this version, the standard ID photo settings are configured in `data/data_en.ini`. You can use the `photo-type` and `photo-sheet-size` parameters.
In this version, the `data` directory contains standard ID photo configuration files (`size_XX.csv`) and commonly used color configurations (`color_XX.csv`). You can modify, add, or remove configurations based on the provided CSV template format.

Additionally, you can modify this configuration file to customize the ID photo types. For the Chinese environment, the format is as follows:
```text
[XXX]
print_size = XXXcm x XXXcm
electronic_size = XXXpx x XXXpx
resolution = XXXdpi
```
The section name `[XXX]` and the line `electronic_size = XXXpx x XXXpx` are mandatory.
## Changelog

The section name represents the values for the `photo-type` and `photo-sheet-size` parameters.
**Note: This version includes changes to CIL parameters. Please carefully read the latest CIL help documentation to avoid issues.**

Furthermore, `photo-type` and `photo-sheet-size` also support direct input of strings in the format `XXXpx x XXXpx`, representing width and height.
- **2025/02/07 Update**
- **Added WebUI**
- Optimized configuration method by replacing INI files with CSV
- Added CI/CD for automated builds and testing
- Added options for layout-only photos and whether to add crop lines on the photo grid
- Improved fallback handling for non-face images
- Fixed known bugs
- Added and refined more photo sizes

## Changelog
<details>
<summary>Previous Changelog</summary>

- **2024/08/06 Update**
- Added support for entering width and height in pixels directly for `photo-type` and `photo-sheet-size`, and support for configuration via `data.ini`.
- Fixed issues related to some i18n configurations; now compatible with both English and Chinese settings.
- Fixed other known bugs.
</details>


## Acknowledgments
Expand Down
85 changes: 63 additions & 22 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,27 @@ LiYing 可以完全离线运行。所有图像处理操作都在本地运行。

### 整合包

如果你是 Windows 用户且没有代码阅览需求,可以[下载整合包](https://github.com/aoguai/LiYing/releases/latest)(已在 Windows 7 SP1 & Windows 10 测试),解压将图片或目录拖入 run_zh.bat 即可启动 LiYing。
如果你是 Windows 用户且没有代码阅览需求,可以[下载整合包](https://github.com/aoguai/LiYing/releases/latest)(已在 Windows 7 SP1 & Windows 10 测试)

整合包从未包含模型,您可以参考 [下载对应模型](https://github.com/aoguai/LiYing?tab=readme-ov-file#%E4%B8%8B%E8%BD%BD%E5%AF%B9%E5%BA%94%E6%A8%A1%E5%9E%8B) 章节说明来下载模型并放入正确的位置

同时如果运行存在问题,请先尝试按照 [先决条件](https://github.com/aoguai/LiYing?tab=readme-ov-file#%E5%85%88%E5%86%B3%E6%9D%A1%E4%BB%B6) 章节完善环境,如果没问题可以忽略

#### 运行整合包

运行 BAT 脚本
```shell
cd LiYing
run.bat ./images/test1.jpg
```

运行 WebUI 界面
```shell
# 运行 WebUI
cd LiYing
run_webui.bat
# 浏览器访问 127.0.0.1:7860
```

### 设置和安装

Expand Down Expand Up @@ -64,7 +84,7 @@ cd LiYing ## 进入 LiYing 目录
pip install -r requirements.txt # install Python helpers' dependencies
```

注: 如果您使用的是 Windows 7 系统请您至少需要是 Windows 7 SP1 以上版本,且要求 `onnxruntime==1.14.0`
**注: 如果您使用的是 Windows 7 系统请您至少需要是 Windows 7 SP1 以上版本,且要求 `onnxruntime==1.14.0, orjson==3.10.7, gradio==4.44.1`**

#### 下载对应模型

Expand All @@ -78,20 +98,36 @@ pip install -r requirements.txt # install Python helpers' dependencies

**注: 对于 yolov8n-pose 模型,您需要将其导出为 ONNX 模型,您可以参考[官方文档](https://docs.ultralytics.com/integrations/onnx/)实现**

同时,我们提供了转换好的 ONNX 模型,您可以直接下载使用:

| 下载方式 | 链接 |
|--------------|--------------------------------------------------------------------------------|
| Google Drive | [下载链接](https://drive.google.com/file/d/1F8EQfwkeq4s-P2W4xQjD28c4rxPuX1R3/view) |
| 百度网盘 | [下载链接(提取码:ahr9)](https://pan.baidu.com/s/1QhzW53vCbhkIzvrncRqJow?pwd=ahr9) |
| Github releases | [下载链接](https://github.com/aoguai/LiYing/releases/latest) |

#### 运行

```shell
# 查看 CIL 帮助
cd LiYing/src
python main.py --help
```

对于 Window 用户,项目提供了 bat 运行脚本方便您使用:

```shell
# 运行 BAT 脚本
cd LiYing
run.bat ./images/test1.jpg
```

```shell
# 运行 WebUI
cd LiYing/src/webui
python app.py
```

#### CIL 参数信息与帮助
```shell
python main.py --help
Expand All @@ -101,51 +137,56 @@ Options:
-y, --yolov8-model-path PATH YOLOv8 模型路径
-u, --yunet-model-path PATH YuNet 模型路径
-r, --rmbg-model-path PATH RMBG 模型路径
-sz, --size-config PATH 尺寸配置文件路径
-cl, --color-config PATH 颜色配置文件路径
-b, --rgb-list RGB_LIST RGB 通道值列表(英文逗号分隔),用于图像合成
-s, --save-path PATH 保存路径
-p, --photo-type TEXT 照片类型(支持 XXpx x XXpx 格式或 data.ini 中指定的格式)
--photo-sheet-size TEXT 选择照片表格的尺寸(支持 XXpx x XXpx 格式或 data.ini
中指定的格式)
-p, --photo-type TEXT 照片类型
-ps, --photo-sheet-size TEXT 选择照片表格的尺寸
-c, --compress / --no-compress 是否压缩图像(使用 AGPicCompress 压缩)
-sc, --save-corrected / --no-save-corrected
-sv, --save-corrected / --no-save-corrected
是否保存修正图像后的图片
-bg, --change-background / --no-change-background
是否替换背景
-sb, --save-background / --no-save-background
是否保存替换背景后的图像
-lo, --layout-only 仅排版照片,不更换背景
-sr, --sheet-rows INTEGER 照片表格的行数
-sc, --sheet-cols INTEGER 照片表格的列数
--rotate / --no-rotate 是否旋转照片90度
-rt, --rotate / --no-rotate 是否旋转照片90度
-rs, --resize / --no-resize 是否调整图像尺寸
-srz, --save-resized / --no-save-resized
-sz, --save-resized / --no-save-resized
是否保存调整尺寸后的图像
-al, --add-crop-lines / --no-add-crop-lines
在照片表格上添加裁剪线
--help Show this message and exit.

```

#### 其他配置

在该版本中,在`data/data-zh.ini`中设置了常规的证件照配置,您可以在`photo-type``photo-sheet-size`参数中使用。
#### 配置文件

同时你可以修改该配置文件,自定义证件照类型。针对中文环境,其格式为
```text
[XXX]
打印尺寸 = XXXcm x XXXcm
电子版尺寸 = XXXpx x XXXpx
分辨率 = XXXdpi
```
其中节名称及`[XXX]``电子版尺寸 = XXXpx x XXXpx`是必须的。
在该版本中,在`data`目录中设置了常规的证件照配置`size_XX.csv`与常用颜色配置`color_XX.csv`,您可以自行按照给出的 CSV 模板格式修改或增删配置。

其中节名称代表了其`photo-type``photo-sheet-size`参数输入值。
## 更新日志

同时`photo-type``photo-sheet-size`还支持直接输入形如`XXXpx x XXXpx`的字符串,代表宽高。
**注意该版本对 CIL 参数进行了更改,为了避免问题请你仔细阅读最新 CIL 帮助文档**

## 更新日志
- **2025/02/07 更新**
- **添加 WebUI**
- 优化 配置方式,用 CSV 替换 INI 配置
- 添加 CI/CD 方便自动构建与测试
- 添加 仅排版照片, 是否在照片表格上添加裁剪线 选项
- 完善 对非脸部图像的兜底处理
- 修复 已知BUG
- 添加修正补充了更多尺寸
<details>
<summary>往期更新日志</summary>

- **2024/08/06 更新**
- 新增 photo-type 和 photo-sheet-size 支持直接输入宽高像素,支持使用 data.ini 配置
- 修复 部分 i18n 导致的已知问题,现在可以兼容中英文配置
- 修复 其他已知BUG
</details>

## 致谢

Expand Down

0 comments on commit 9137130

Please sign in to comment.