jzyustc / mbrs Goto Github PK
View Code? Open in Web Editor NEWThis is the source code of paper MBRS : Enhancing Robustness of DNN-based Watermarking by Mini-Batch of Real and Simulated JPEG Compression, which is received by ACM MM' 21.
This is the source code of paper MBRS : Enhancing Robustness of DNN-based Watermarking by Mini-Batch of Real and Simulated JPEG Compression, which is received by ACM MM' 21.
在BasicBlock中,第二个“nn.Conv2d(in_channels=out_channels, out_channels=out_channels // r, kernel_size=1, bias=False)”里面in_channels应该为out_channels // r, out_channels = out_channels,这个chennel数量好像有误
你好,读了你的论文,受益匪浅,非常感谢!
我用你本仓库的代码训练模型时遇到一些疑惑,想咨询一下作者
(2) 为保证模型泛化和迁移性,作者在图像输入网络前做了数据增强,to_tensor()归一化后,采用Normalize([0.5, 0.5, 0.5], [0.5, 0.5, 0.5])进行正则化,此处我修改为Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225],不知为何,用后者Normalize,生成的水印图像除了包含不规则的改动,还会包含规则的网格状的亮点(如下图),而前者Normalize只有一些不规则的改动。想问作者是否遇到这个问题。
(3) 代码中计算PSNR和SSIM,是在模型输出的图像和数据增强后的图像之间计算的,这样说不上错,但是个人认为直接计算 原始图像和水印图像的PSNR和SSIM更好,毕竟模型输出的图张量 还需要 reverse normalize 才能转换为 水印图像。
感谢!:)
Hello,Do datasets take long to load when you train models? What is the general training time?
I use the COCO2014 as the training datasets,it takes a long time to load.
Thanks for your code.
The message length of the diffusion model is 30 bits, and 256 bits when fully connected. When I change the length to another value for testing, I get an error. If I want to increase the message length, e.g. to 128 or 256 bits, what should I do, do I need to retrain.
sir,sorry to bother you ,if i want to know the message the model embed,what should i do
Why is the value of mav_val
not 255 but 2.
psnr = kornia.losses.psnr_loss(encoded_images.detach(), images, 2)
Acctually, since the channel obtained using DataLoader is RGB, with a value range of 0-1, the calculation formula of PSNR should be
psnr = kornia.losses.psnr_loss(encoded_images.detach()*255, images*255, 255)
This error causes the calculation result of PSNR to be larger than the correct one.
save_images_number = 4
H = 128
W = 128
message_length = 30
lr = 0.001
noise_layers = ['Combined([JpegMask(50),Jpeg(50),Identity()])']
0.001
Start training :
Traceback (most recent call last):
File "train.py", line 55, in <module>
result = network.train(image, message) if not only_decoder else network.train_only_decoder(image, message)
File "/home/admin/code/Watermarking/MBRS/network/Network.py", line 53, in train
encoded_images, noised_images, decoded_messages = self.encoder_decoder(images, messages)
File "/home/admin/miniconda3/envs/torch15_py37_ljz/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in __call__
result = self.forward(*input, **kwargs)
File "/home/admin/miniconda3/envs/torch15_py37_ljz/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 153, in forward
return self.module(*inputs[0], **kwargs[0])
File "/home/admin/miniconda3/envs/torch15_py37_ljz/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in __call__
result = self.forward(*input, **kwargs)
File "/home/admin/code/Watermarking/MBRS/network/Encoder_MP_Decoder.py", line 19, in forward
encoded_image = self.encoder(image, message)
File "/home/admin/miniconda3/envs/torch15_py37_ljz/lib/python3.7/site-packages/torch/nn/modules/module.py", line 550, in __call__
result = self.forward(*input, **kwargs)
File "/home/admin/code/Watermarking/MBRS/network/Encoder_MP.py", line 39, in forward
message_image = message.view(-1, 1, size, size)
RuntimeError: shape '[-1, 1, 5, 5]' is invalid for input of size 480
my train_settings.json
{
"project_name": "MBRS",
"with_diffusion": false,
"only_decoder": false,
"epoch_number": 101,
"batch_size": 16,
"train_continue": false,
"train_continue_path": "/",
"train_continue_epoch": 0,
"dataset_path": "/home/admin/code/Watermarking/data/",
"save_images_number": 4,
"H": 128,
"W": 128,
"message_length": 30,
"lr": 1e-3,
"noise_layers": [
"Combined([JpegMask(50),Jpeg(50),Identity()])"
]
}
my conda
torch==1.5.0
torchvision==0.6.0
kornia 0.3.0
cuda10.1
python3.7
There might be an error in train.py:
"TypeError: ssim() got an unexpected keyword argument 'reduction', (line 98, in train.py), ssim = 1 - 2 * kornia.losses.ssim(encoded_images.detach(), images, window_size=5, reduction="mean"). "
It seems that "ssim" should be "ssim_loss". Is it right?
Hello, thanks for the code, but I'm having a problem.
For a photo that has been watermarked with your model, I save the watermark in advance, and then put the image into the decoder to extract, I tested a hundred photos, but the error rate of each is 0.4~0.5,and I also set only_decoder=True,is it a problem with my code?
作者你好,请问下论文结尾处message经过diffusion和没有经过diffusion的两张图片是如何获得的?
save_images(saved_all, epoch, result_folder + "images/", resize_to=(W, H)) in train.py may occur error! since the param "saved_all" can be NONE !
Hi, I am wondering to know how you chose the training data and val data from Imagenet?
Can this use a two-stage training strategy?
hi sorry to bother you i meet the problem ,can yo help me?
original_images, watermarked_images, noised_images = saved_all
TypeError: cannot unpack non-iterable NoneType object
I hope this message finds you well. I am writing to seek your assistance with an issue we encountered while attempting to replicate your project [Project Name]. We appreciate the work you've done and were eager to explore it further.
However, during the replication process, we faced a runtime error that halted our progress. The error message we received was as follows:
project_name = MBRS
with_diffusion = False
only_decoder = False
epoch_number = 101
batch_size = 4
train_continue = False
train_continue_path = /
train_continue_epoch = 0
dataset_path = datasets/
save_images_number = 4
H = 128
W = 128
message_length = 64
lr = 0.001
noise_layers = ['Combined([JpegMask(50),Jpeg(50),Identity()])']
0.001
Start training :
terminate called after throwing an instance of 'std::runtime_error'
what(): NCCL Error 1: unhandled cuda error
Aborted (core dumped)
We are currently using:
torch==1.5.0
torchvision==0.6.0
kornia==0.3.0
numpy==1.16.4
Pillow==6.0.0
scipy==1.3.0
, but unfortunately, we haven't been able to resolve the issue. We were wondering if you might have any insights or suggestions that could help us move forward.
hello
For the crop attack, I trained the model by setting the parameter(0.0225) according to the paper and test (0.035). But the effect was not as good as the result in the paper, it was even worse. Could u tell me the reason? thx
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.