hukkelas/deep_privacy2

RuntimeError due to size mismatch between image and mask tensors

emnab opened this issue · 0 comments

00453
I'm encountering a runtime error when trying to anonymize this image from Celeba_hQ using the DeepPrivacy2 anonymizer. Specifically, the error message states: RuntimeError: The size of tensor a (256) must match the size of tensor b (282) at non-singleton dimension 3. It appears that there is a size mismatch between the mask and the image tensors.
command:
!python3 anonymize.py configs/anonymizers/face.py -i "/content/00453.jpg" --output_path "/content/453out.jpg"

Error:

File "/content/drive/MyDrive/Colab Notebooks/deep_privacy2/anonymize.py", line 367, in
anonymize_path()
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1157, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 783, in invoke
return _callback(*args, **kwargs)
File "/content/drive/MyDrive/Colab Notebooks/deep_privacy2/anonymize.py", line 363, in anonymize_path
anonymize_file(input_path, output_path, **kwargs)
File "/content/drive/MyDrive/Colab Notebooks/deep_privacy2/anonymize.py", line 144, in anonymize_file
anonymize_image(input_path, output_path, **kwargs)
File "/content/drive/MyDrive/Colab Notebooks/deep_privacy2/anonymize.py", line 123, in anonymize_image
im
= anonymizer(im, **synthesis_kwargs)
File "/content/drive/MyDrive/Colab Notebooks/deep_privacy2/dp2/anonymizer/anonymizer.py", line 240, in call
return self.forward(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/content/drive/MyDrive/Colab Notebooks/deep_privacy2/dp2/anonymizer/anonymizer.py", line 235, in forward
im = self.anonymize_detections(im, detection, z_idx=zs, **synthesis_kwargs)
File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/content/drive/MyDrive/Colab Notebooks/deep_privacy2/dp2/anonymizer/anonymizer.py", line 150, in anonymize_detections
anonymized_im = self.forward_G(
File "/content/drive/MyDrive/Colab Notebooks/deep_privacy2/dp2/anonymizer/anonymizer.py", line 93, in forward_G
batch["condition"] = batch["mask"].float() * batch["img"]
RuntimeError: The size of tensor a (256) must match the size of tensor b (282) at non-singleton dimension 3