Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dneprdroid/tfsecured
Small library for TensorFlow proto model's (*.pb) encryption/decryption
https://github.com/dneprdroid/tfsecured
aes cpp decryption encryption golang ios machine-learning tensorflow tensorflow-proto-models
Last synced: 6 days ago
JSON representation
Small library for TensorFlow proto model's (*.pb) encryption/decryption
- Host: GitHub
- URL: https://github.com/dneprdroid/tfsecured
- Owner: dneprDroid
- License: mit
- Created: 2018-05-03T19:35:13.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-06-30T11:01:08.000Z (over 2 years ago)
- Last Synced: 2024-11-06T10:03:54.215Z (6 days ago)
- Topics: aes, cpp, decryption, encryption, golang, ios, machine-learning, tensorflow, tensorflow-proto-models
- Language: Objective-C++
- Homepage:
- Size: 33 MB
- Stars: 82
- Watchers: 5
- Forks: 21
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## 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](/TFSecured) dir into your project.
C++ usage (see [TFPredictor.mm](/iosDemo/TFSecured-iOS/tf/predict/TFPredictor.mm)):```cpp
#include
........
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(NewSession(options));
status = session->Create(graph);
// Run session ....
```Encrypt model via python script (see [encrypt_model.py](/python/encrypt_model.py)):
```bash
$ python encrypt_model.py \
\
# optional, generated randomly by script```
## Dependencies
* TensorFlow
* OpenSSL
## iOS Demo (Digit recognizer)
Prepare repository (install Tensorflow via pods)
```bash
$ cd iosDemo
$ pod install```
And open it in Xcode.