# 密码标签获取,数据集嵌入黑盒水印源码及打包项目 ## 功能列表 - [x] 密码标签生成 - [x] 密码标签自检(测试) - [x] 密码标签验证 - [x] 图像嵌入密码标签 - [x] 图像提取密码标签 - [x] 图像处理功能自检 - [x] 日志模板 - [x] 日志记录 ## 分支说明 - `master`分支只包含项目打包配置和密码标签获取,数据集嵌入黑盒水印源码 ## 安装依赖 ```shell pip install -r requirements.txt ``` ## 文件组成 ```text . ├── MANIFEST.in # 打包过滤文件 ├── README.md # 描述文件 ├── setup.py # 打包配置文件 ├── tests # 测试目录 │ └── test_dataset_process.py # 测试数据集处理 └── watermark_generate # 水印生成源码 ├── __init__.py ├── blind_watermark # 图片嵌入盲水印源码 │ ├── __init__.py │ ├── att.py │ ├── blind_watermark.py │ ├── bwm_core.py │ ├── cli_tools.py │ ├── pool.py │ └── recover.py ├── controller # 对外提供的http接口 │ ├── __init__.py │ ├── dataset_controller.py # 数据集处理接口,包括图片嵌入水印处理、图片提取水印、水印功能自检 │ ├── log_controller.py # 日志控制接口,支持控制日志级别,控制日志输出大小 │ └── secret_controller.py # 密码标签生成接口,包括密码标签生成、密码标签验证、密码标签功能自检 ├── domain # 对外提供http接口的参数与响应 │ ├── __init__.py │ ├── dataset_domain.py │ └── secret_domain.py ├── requirements.txt # 项目依赖文件,安装依赖使用 ├── resource # 静态资源文件夹 │ └── test.jpg # 用于图片水印功能自检的测试图片,可根据需求更改 ├── run.py # 服务运行脚本 └── tools #工具脚本目录 ├── __init__.py ├── dataset_process.py # 数据集处理脚本 ├── logger_tool.py # 日志工具脚本 ├── picture_watermark.py # 图片水印嵌入提取工具 └── secret_func.py # 密码标签生成与验证工具,需要根据密码机实际提供接口进行修改,目前只有模拟实现 ``` ## AI水印黑盒水印HTTP接口 Base URLs: * 开发环境: http://127.0.0.1:5000 # Authentication ## POST 日志调整接口 POST /znwr/jit/ai/v1/log_setting > Body 请求参数 ```json { "level": "string", "size": 0 } ``` ### 请求参数 |名称|位置|类型|必选|中文名|说明| |---|---|---|---|---|---| |body|body|object| 否 ||none| |» level|body|string| 是 | 输出日志级别|debug、info、warning、error| |» size|body|number| 是 | 日志最大大小限制|单位KB| > 返回示例 > 200 Response ```json { "code": 0, "msg": "string" } ``` ### 返回结果 |状态码|状态码含义|说明|数据模型| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|[VerifyLabelResp](#schemaverifylabelresp)| # 模型密码标签生成模块 ## POST 密码标签生成 POST /znwr/jit/ai/v1/crypto-label > Body 请求参数 ```json { "info": { "owner": { "name": "string", "id": "string" }, "model": { "name": "string", "id": "string", "version": "string", "date": "2019-08-24T14:15:22Z" } } } ``` ### 请求参数 |名称|位置|类型|必选|中文名|说明| |---|---|---|---|---|---| |body|body|[GenLabelForm](#schemagenlabelform)| 否 ||none| > 返回示例 > 200 Response ```json { "code": 0, "msg": "string", "label": "string", "cert": "string" } ``` ### 返回结果 |状态码|状态码含义|说明|数据模型| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|[GenLabelResp](#schemagenlabelresp)| ## POST 密码标签功能自检 POST /znwr/jit/ai/v1/crypto-check > 返回示例 > 200 Response ```json { "code": 0, "msg": "string" } ``` ### 返回结果 |状态码|状态码含义|说明|数据模型| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|[VerifyLabelResp](#schemaverifylabelresp)| ## POST 密码标签嵌入图像 POST /znwr/jit/ai/v1/picture_embed > Body 请求参数 ```yaml file: string label: string ``` ### 请求参数 |名称|位置|类型|必选|中文名|说明| |---|---|---|---|---|---| |body|body|object| 否 ||none| |» file|body|string(binary)| 否 ||待嵌入的图像信息| |» label|body|string| 否 ||密码标签| > 返回示例 > 200 Response ```json { "code": 0, "msg": "string" } ``` ### 返回结果 |状态码|状态码含义|说明|数据模型| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|[VerifyLabelResp](#schemaverifylabelresp)| ## POST 图像处理功能自检 POST /znwr/jit/ai/v1/picture_check > 返回示例 > 200 Response ```json { "code": 0, "msg": "string" } ``` ### 返回结果 |状态码|状态码含义|说明|数据模型| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|[VerifyLabelResp](#schemaverifylabelresp)| # 模型密码标签验证模块 ## POST 密码标签验证 POST /znwr/jit/ai/v1/verify-label > Body 请求参数 ```json { "label": "string", "info": "string", "cert": "string" } ``` ### 请求参数 |名称|位置|类型|必选|中文名|说明| |---|---|---|---|---|---| |body|body|[VerifyLabelForm](#schemaverifylabelform)| 否 ||none| > 返回示例 > 200 Response ```json { "code": 0, "msg": "string" } ``` ### 返回结果 |状态码|状态码含义|说明|数据模型| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|[VerifyLabelResp](#schemaverifylabelresp)| ## POST 图片提取密码标签 POST /znwr/jit/ai/v1/picture_extract > Body 请求参数 ```yaml file: file://C:\Users\hikari\Desktop\test_embed.jpg ``` ### 请求参数 |名称|位置|类型|必选|中文名|说明| |---|---|---|---|---|---| |body|body|object| 否 ||none| |» file|body|string(binary)| 否 ||none| > 返回示例 > 200 Response ```json { "code": 0, "msg": "string", "label": "string" } ``` ### 返回结果 |状态码|状态码含义|说明|数据模型| |---|---|---|---| |200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|[ExtractLabelResp](#schemaextractlabelresp)| # 数据模型