## TFSecured
Small library for tensorflow proto models (*.pb) encryption/decryption.
## AES
You may use random string with random length like a key, then library calculates sha256 hash of it and uses as internal key with size 256 bits.
## Usage
Copy sources from [TFSecured](https://github.com/dneprDroid/TFSecured/tree/master/TFSecured) dir into your project.
C++ Usage (see [TFPredictor.mm](https://github.com/dneprDroid/TFSecured/blob/master/iosDemo/TFSecured-iOS/tf/predict/TFPredictor.mm)):
```cpp
#include <GraphDefDecryptor.hpp>
........
tensorflow::GraphDef graph;
// Decryption:
const std::string key = "JHEW8F7FE6F8E76W8F687WE6F8W8EF5";
auto status = tfsecured::GraphDefDecryptAES(path, // path to *.pb file (frozen graph)
&graph,
key); // your key
if (!status.ok()) {
std::cout << status.error_message() << std::endl;
return;
}
// Create session :
std::unique_ptr<Session> session(NewSession(options));
status = session->Create(graph);
// Run session ....
```
Encrypt model via python script (see [encrypt_model.py](https://github.com/dneprDroid/TFSecured/blob/master/python/encrypt_model.py)):
```bash
$ python encrypt_model.py <INPUT_PB_MODEL> \
<OUTPUT_PB_MODEL> \
<KEY> # optional, generated randomly by script
```
## iOS Demo (Digit recognizer)
Prepare repository (install Tensorflow via pods)
```bash
$ cd iosDemo
$ pod install
```
And open it in Xcode.
深度学习模型加密解密并附图
版权申诉
116 浏览量
2023-11-21
17:24:04
上传
评论
收藏 21.91MB ZIP 举报
元气少女缘结神
- 粉丝: 6065
- 资源: 65
最新资源
- 2022NOC软件创意编程赛项真题python小学高年级-决赛(有解析)
- mathml转换latex需要的xsl文件
- 2022NOC软件创意编程赛项真题图形化小学高年级-决赛赛(有解析)
- gbase驱动下载gbase-connector-java-8.3.81.53驱动下载
- 2022NOC软件创意编程赛项真题图形化小学低年级-决赛赛(有解析)
- InsightFace从青铜到王者,超大规模人脸识别的优雅解法
- python后端开发spider框架详解
- 基于 STM32 与 ESP8266 的智能家居系统源码.zip
- 毕业设计:基于SSM的mysql-个性化点餐配送系统(源码 + 数据库 + 说明文档)
- 基于matlab的鱼苗计数识别(GUI界面).zip代码57
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈