Giter Club home page Giter Club logo

watermarkdm's People

Contributors

tropiclurker avatar yunqing-me avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

watermarkdm's Issues

FileNotFoundError: [Errno 2] No such file or directory: '*.pkl'

Thank you for this excellent work.I got an error when I trying to compute the FID using the following command.

torchrun --standalone --nproc_per_node=1 generate.py --outdir=cifar10_tmp --seeds=0-49999 --subdirs \
    --network=*.pkl

I have placed the. pkl file generated by training and generate.py file in the same path, which seems to recognize *.pkl as specific file names. How can I solve this problem?

The implementation of Eq.(5)

Hi there! I am very interested in this brilliant work, and I am curious about the implementation of this equation in watermarking stable diffusion:
image

I would be appreciate it if there could be any explanation or guidance. Thanks in advance!

Data_root for watermarking stable diffusion

Thank you for this excellent work. I am trying to watermark stable diffusion using the following command:
CUDA_VISIBLE_DEVICES=0,1,2,3 python main.py --base configs/stable-diffusion/v1-finetune_unfrozen_watermark.yaml
--train --gpus 0,1,2,3
--actual_resume ../_model_pool/sd-v1-4-full-ema.ckpt
--data_root ../_target_samples/watermark//.png
--w_reg_weight 1e-7
--name watermark_toy_V_ft_w_reg_l1_1.0e-7
But I'm wondering that "data_root" should contain what kind of dataset/images? Looking foward to your reply.

about https://github.com/yunqing-me/WatermarkDM#watermarking-stable-diffusion

Hello, I am very glad to hear your reply to my question last time. There was a problem when I was replicating stable-diffusion, which confused me.

When I run sd_watermark/main.py, it only takes a minute or two to run and show finish with code 0.

And there are some bar graphs on the wandb visualization site, I don't know if this.py file is a training file? If so, which of my actions went wrong?

Looking forward to your reply.

Gaussian noise attacks

Hello, I want to run a robustness test, but I don't know how to add Gaussian noise attacks to the model weights? In which file should the code be added? What code statement to add?

error&dataset

hello,I met some mistakes, you know how to solve?
if trainer.global_rank == 0:
NameError: name 'trainer' is not defined.

And I have some questions about the data set, what is the data set used when running the sd_watermark.py code?

how to solve this

def extract_fingerprints():
all_fingerprinted_images = []
all_fingerprints = []
bitwise_accuracy = 0

BATCH_SIZE = args.batch_size

# transform gt_fingerprints to 
gt_fingerprints  = "0100"
fingerprint_size = len(gt_fingerprints)
'''z = torch.zeros((args.batch_size, fingerprint_size), dtype=torch.float)
for (i, fp) in enumerate(gt_fingerprints):
    z[:, i] = int(fp)
z = z.cuda()'''
# xiu
fingerprint_batch = torch.tensor([[int(c) for c in gt_fingerprints]] * BATCH_SIZE, dtype=torch.float32)
z = fingerprint_batch.cuda()
# xiu

dataloader = DataLoader(dataset, batch_size=BATCH_SIZE, shuffle=False, num_workers=0)
#dataloader = DataLoader(dataset, batch_size=BATCH_SIZE, shuffle=False, num_workers=0)

for images, _ in tqdm(dataloader):
    images = images.to(device)
    #xiu
    batch_size = images.shape[0]
    if batch_size != BATCH_SIZE:
        fingerprint_batch = torch.tensor([[int(c) for c in gt_fingerprints]] * batch_size, dtype=torch.float32)
        z = fingerprint_batch.cuda()
    #xiu
    fingerprints = RevealNet(images)
    fingerprints = (fingerprints > 0).long()

    #bitwise_accuracy += (fingerprints[: images.size(0)].detach() == z[: images.size(0)]).float().mean(dim=1).sum().item()
    #xiu
    bitwise_accuracy += (fingerprints.detach() == z[: batch_size]).float().mean(dim=1).sum().item()

    all_fingerprinted_images.append(images.detach().cpu())
    all_fingerprints.append(fingerprints.detach().cpu())

dirname = args.output_dir
# if not os.path.exists(dirname):
#     os.makedirs(dirname)

all_fingerprints = torch.cat(all_fingerprints, dim=0).cpu()
bitwise_accuracy = bitwise_accuracy / len(all_fingerprints)
print(f"Bitwise accuracy on fingerprinted images: {bitwise_accuracy}") # non-corrected

error
Traceback (most recent call last):
File "detect_watermark_cifar10.py", line 195, in
main()
File "detect_watermark_cifar10.py", line 191, in main
extract_fingerprints()
File "detect_watermark_cifar10.py", line 136, in extract_fingerprints
bitwise_accuracy += (fingerprints.detach() == z[: batch_size]).float().mean(dim=1).sum().item()
RuntimeError: The size of tensor a (64) must match the size of tensor b (4) at non-singleton dimension 1

psnr&ssim

hi sorry to boter you i want ro know if i want to cacluate psnr and ssim,what should i do?

FileNotFoundError: [Errno 2] No such file or directory: 'noise_2.pt'

Hi Zhao,

I am interested in this work for DM watermarking, and this project does provide a good benchmark for implementation. Thank you for your great work! However, I am curious about SD model watermarking in this project. I got an error when I load the model noise_{self.num_vis_samples}.pt, as follows:

self.noise = torch.load(f'noise_{self.num_vis_samples}.pt') # use fixed noise and fixed prompt for training-time visualization

Do you have the pretrained weight of this model or could you tell me how to train this noise model?

Best regards,
Donny

sorry i want to know why the all_fingerprints is empty

(string2img) root@autodl-container-b8cd119e52-5036b25b:~/autodl-tmp/WatermarkDM-main/string2img# python detect_watermark_cifar10.py
0%| | 0/50 [00:00<?, ?it/s]Loading image folder ../edm/datasets/embedded/cifar10/images/000000 ...
Finished. Loading took 0.00s
0it [00:00, ?it/s]
0%| | 0/50 [00:01<?, ?it/s]
Traceback (most recent call last):
File "detect_watermark_cifar10.py", line 182, in
main()
File "detect_watermark_cifar10.py", line 178, in main
extract_fingerprints()
File "detect_watermark_cifar10.py", line 133, in extract_fingerprints
all_fingerprints = torch.cat(all_fingerprints, dim=0).cpu()
RuntimeError: torch.cat(): expected a non-empty list of Tensors

CUDA error: invalid device ordinal in train.py

torchrun --standalone --nproc_per_node=8 train.py
--outdir=training-runs
--data=datasets/cifar10-32x32.zip
--cond=1
--arch=ddpmpp

while running this script it gives me CUDA error: invalid device ordinal. 
I have checked the compatibality of versions too.

NotADirectoryError

Sorry to bother you again.I met a strange error when I run the main.py using the following command:
CUDA_VISIBLE_DEVICES=0 python main.py --base configs/stable-diffusion/v1-finetune_unfrozen_watermark.yaml \ --train --gpus 0, \ --actual_resume ../_model_pool/sd-v1-4-full-ema.ckpt \ --data_root ../_target_samples/watermark/*/*.png \ --w_reg_weight 1e-7 \ --name watermark_toy_V_ft_w_reg_l1_1.0e-7 \
NotADirectoryError: [Errno 20] Not a directory: '../_target_samples/watermark/v/V.png'
Then I tried the following command:
CUDA_VISIBLE_DEVICES=0 python main.py --base configs/stable-diffusion/v1-finetune_unfrozen_watermark.yaml \ --train --gpus 0,\ --actual_resume ../_model_pool/sd-v1-4-full-ema.ckpt \ --data_root ../_target_samples/watermark/*/ \ --w_reg_weight 1e-7 \ --name watermark_toy_V_ft_w_reg_l1_1.0e-7 \
IsADirectoryError: [Errno 21] Is a directory: '../_target_samples/watermark/V/.ipynb_checkpoints'`
I wonder how to solve this problem.Looking forward to your reply!

I got the error when I tried to run the sd-watermarking experiment

I tried to run this command:
'CUDA_VISIBLE_DEVICES=1 python main.py --base ./configs/stable-diffusion/v1-finetune_unfrozen_watermark.yaml
--train --gpus 0
--actual_resume ../checkpoints/sd-v1-4-full-ema.ckpt
--data_root ../watermarking/
--w_reg_weight 1e-7
--name temp
--wandb_project_name temp-proj
--wandb_run_name temp-run '

And I met a mistake as follows:
AttributeError: 'CLIPTextEmbeddings' object has no attribute 'embedding_forward'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.