YuxinWenRick / tree-ring-watermark

MIT License
264 stars 32 forks source link

runtime error #42

Open chen-w-w opened 3 weeks ago

chen-w-w commented 3 weeks ago

When I run python run_tree_ring_watermark.py --run_name jpeg --w_channel 3 --w_pattern ring --jpeg_ratio 25 --start 0 --end 1000 --with_tracking,I encounter the following issue at 315/1000,What should I do? Traceback (most recent call last): File "run_tree_ring_watermark.py", line 221, in main(args) File "run_tree_ring_watermark.py", line 107, in main img_no_w = transform_img(orig_image_no_w_auged).unsqueeze(0).to(text_embeddings.dtype).to(device) File "/root/autodl-tmp/tree-ring-watermark-main/optim_utils.py", line 37, in transform_img image = tform(image) File "/root/miniconda3/envs/tree-ring/lib/python3.8/site-packages/torchvision/transforms/transforms.py", line 95, in call img = t(img) File "/root/miniconda3/envs/tree-ring/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl return forward_call(*args, **kwargs) File "/root/miniconda3/envs/tree-ring/lib/python3.8/site-packages/torchvision/transforms/transforms.py", line 361, in forward return F.resize(img, self.size, self.interpolation, self.max_size, self.antialias) File "/root/miniconda3/envs/tree-ring/lib/python3.8/site-packages/torchvision/transforms/functional.py", line 490, in resize return F_pil.resize(img, size=output_size, interpolation=pil_interpolation) File "/root/miniconda3/envs/tree-ring/lib/python3.8/site-packages/torchvision/transforms/_functional_pil.py", line 250, in resize return img.resize(tuple(size[::-1]), interpolation) File "/root/miniconda3/envs/tree-ring/lib/python3.8/site-packages/PIL/Image.py", line 2293, in resize self.load() File "/root/miniconda3/envs/tree-ring/lib/python3.8/site-packages/PIL/ImageFile.py", line 312, in load raise _get_oserror(err_code, encoder=False) OSError: broken data stream when reading image file

YuxinWenRick commented 3 weeks ago

Hi @chen-w-w, not sure what causes this, but can you check or save the image before this line to see if the image is corrupted.