Add TrustMark Q model files
Browse files- LICENSE +25 -0
- README.md +33 -0
- decoder_Q.ckpt +3 -0
- encoder_Q.ckpt +3 -0
- manifest.json +11 -0
- trustmark_Q.yaml +85 -0
LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright 2023 Adobe
|
| 2 |
+
All Rights Reserved.
|
| 3 |
+
|
| 4 |
+
NOTICE: Adobe permits you to use, modify, and distribute this file in
|
| 5 |
+
accordance with the terms of the license agreement accompanying it.
|
| 6 |
+
|
| 7 |
+
MIT License
|
| 8 |
+
|
| 9 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 10 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 11 |
+
in the Software without restriction, including without limitation the rights
|
| 12 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 13 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 14 |
+
furnished to do so, subject to the following conditions:
|
| 15 |
+
|
| 16 |
+
The above copyright notice and this permission notice shall be included in all
|
| 17 |
+
copies or substantial portions of the Software.
|
| 18 |
+
|
| 19 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 20 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 21 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 22 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 23 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 24 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 25 |
+
SOFTWARE.
|
README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
library_name: trustmark
|
| 4 |
+
tags:
|
| 5 |
+
- watermarking
|
| 6 |
+
- image-watermarking
|
| 7 |
+
- invisible-watermark
|
| 8 |
+
- trustmark
|
| 9 |
+
- provenance
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# TrustMark Q model files for watermark toolkit
|
| 13 |
+
|
| 14 |
+
This repository mirrors the TrustMark `Q` model files used by the local watermark toolkit integration.
|
| 15 |
+
|
| 16 |
+
Files:
|
| 17 |
+
|
| 18 |
+
- `encoder_Q.ckpt`
|
| 19 |
+
- `decoder_Q.ckpt`
|
| 20 |
+
- `trustmark_Q.yaml`
|
| 21 |
+
|
| 22 |
+
The model is used through the Python package `trustmark>=0.9.1` and the toolkit's `TrustMarkEngine`.
|
| 23 |
+
|
| 24 |
+
Original project: https://github.com/adobe/trustmark
|
| 25 |
+
|
| 26 |
+
Industrial pattern used by this toolkit:
|
| 27 |
+
|
| 28 |
+
```text
|
| 29 |
+
payload -> SQLite/backend registry -> 8-character watermark_id -> TrustMark image watermark
|
| 30 |
+
image -> TrustMark decode watermark_id -> registry lookup -> full payload
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
The image carries only the short `watermark_id`; sensitive business payloads should remain in your registry/database.
|
decoder_Q.ckpt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e3d9cea5406a26590735719f8f15cb10802b11852ae69047eaf4cf17214df781
|
| 3 |
+
size 47652460
|
encoder_Q.ckpt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dc382c3f6b4fd568b27d6fbb763d6ffc2d2587126d84afe9d5ee95b4c5d99826
|
| 3 |
+
size 17302074
|
manifest.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"source_package": "trustmark==0.9.1",
|
| 3 |
+
"model_type": "Q",
|
| 4 |
+
"files": [
|
| 5 |
+
"decoder_Q.ckpt",
|
| 6 |
+
"encoder_Q.ckpt",
|
| 7 |
+
"LICENSE",
|
| 8 |
+
"README.md",
|
| 9 |
+
"trustmark_Q.yaml"
|
| 10 |
+
]
|
| 11 |
+
}
|
trustmark_Q.yaml
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
model:
|
| 2 |
+
target: trustmark.model.TrustMark_Arch
|
| 3 |
+
params:
|
| 4 |
+
cover_key: "image"
|
| 5 |
+
secret_key: "secret"
|
| 6 |
+
secret_len: 100
|
| 7 |
+
resolution: 256
|
| 8 |
+
use_ema: False
|
| 9 |
+
lr_scheduler: CosineAnnealingRestartCyclicLR
|
| 10 |
+
|
| 11 |
+
secret_encoder_config:
|
| 12 |
+
target: trustmark.unet.Unet1
|
| 13 |
+
params:
|
| 14 |
+
width: 32
|
| 15 |
+
ndown: 4
|
| 16 |
+
nmiddle: 1
|
| 17 |
+
activ: silu
|
| 18 |
+
|
| 19 |
+
secret_decoder_config:
|
| 20 |
+
target: trustmark.unet.SecretDecoder
|
| 21 |
+
params:
|
| 22 |
+
arch: resnet50
|
| 23 |
+
|
| 24 |
+
discriminator_config:
|
| 25 |
+
target: trustmark.munit.MsDCDisGP
|
| 26 |
+
params:
|
| 27 |
+
gp_weight: 10.0
|
| 28 |
+
num_scales: 1
|
| 29 |
+
norm: none
|
| 30 |
+
|
| 31 |
+
loss_config:
|
| 32 |
+
target: trustmark.loss.ImageSecretLoss
|
| 33 |
+
params:
|
| 34 |
+
recon_type: ffl+yuv
|
| 35 |
+
recon_weight: 1.5
|
| 36 |
+
perceptual_weight: 1.0
|
| 37 |
+
kl_weight: 0.0
|
| 38 |
+
secret_weight: 20.0
|
| 39 |
+
generator_weight: 0.5
|
| 40 |
+
discriminator_weight: 1.0
|
| 41 |
+
generator_update_freq: 2
|
| 42 |
+
max_image_weight_ratio: 27.5
|
| 43 |
+
|
| 44 |
+
noise_config:
|
| 45 |
+
target: trustmark.utils.transformations2.TransformNet
|
| 46 |
+
params:
|
| 47 |
+
ramp: 10000
|
| 48 |
+
severity: high
|
| 49 |
+
crop_mode: resized_crop
|
| 50 |
+
gamma: false # this cause issue
|
| 51 |
+
|
| 52 |
+
data:
|
| 53 |
+
target: trustmark.utils.imgcap_dataset.DataModuleFromConfig
|
| 54 |
+
params:
|
| 55 |
+
batch_size: 32
|
| 56 |
+
num_workers: 4
|
| 57 |
+
wrap: false
|
| 58 |
+
use_worker_init_fn: true
|
| 59 |
+
|
| 60 |
+
lightning:
|
| 61 |
+
callbacks:
|
| 62 |
+
image_logger:
|
| 63 |
+
target: trustmark.logger.ImageLogger
|
| 64 |
+
params:
|
| 65 |
+
batch_frequency: 5000
|
| 66 |
+
max_images: 4
|
| 67 |
+
increase_log_steps: False
|
| 68 |
+
fixed_input: True # log the same image batch
|
| 69 |
+
progress_bar:
|
| 70 |
+
target: lightning.pytorch.callbacks.TQDMProgressBar
|
| 71 |
+
params:
|
| 72 |
+
refresh_rate: 100
|
| 73 |
+
checkpoint:
|
| 74 |
+
target: lightning.pytorch.callbacks.ModelCheckpoint
|
| 75 |
+
params:
|
| 76 |
+
verbose: true
|
| 77 |
+
filename: '{epoch:06}-{step:09}'
|
| 78 |
+
every_n_train_steps: 10000
|
| 79 |
+
|
| 80 |
+
trainer:
|
| 81 |
+
benchmark: True
|
| 82 |
+
base_learning_rate: 4e-6
|
| 83 |
+
lr_mult: true
|
| 84 |
+
accumulate_grad_batches: 1
|
| 85 |
+
max_epochs: 150
|