ArtCoder
ArtCoder copied to clipboard
IndexError: too many indices for array: array is 2-dimensional, but 3 were indexed
As explained in tutorial, but I aim to combine a QR code with an existing artwork called eyejpg, so the command :
python main.py --style_img_path eye.jpg --content_img_path eye.jpg --code_img_path eyeqr.jpg --output_dir output
Got an error related to tensor dimensions
/usr/local/lib/python3.10/dist-packages/torchvision/models/_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead.
warnings.warn(
/usr/local/lib/python3.10/dist-packages/torchvision/models/_utils.py:223: UserWarning: Arguments other than a weight enum or `None` for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing `weights=VGG16_Weights.IMAGENET1K_V1`. You can also use `weights=VGG16_Weights.DEFAULT` to get the most up-to-date weights.
warnings.warn(msg)
Downloading: "https://download.pytorch.org/models/vgg16-397923af.pth" to /root/.cache/torch/hub/checkpoints/vgg16-397923af.pth
100% 528M/528M [00:07<00:00, 78.5MB/s]
Traceback (most recent call last):
File "/content/drive/MyDrive/ai-qrcode/ArtCoder/main.py", line 54, in <module>
artcoder(STYLE_IMG_PATH=args.style_img_path, CONTENT_IMG_PATH=args.content_img_path, CODE_PATH=args.code_img_path,
File "/content/drive/MyDrive/ai-qrcode/ArtCoder/Artcoder.py", line 32, in artcoder
init_img = utils.add_pattern(content_img, code_img)
File "/content/drive/MyDrive/ai-qrcode/ArtCoder/utils.py", line 30, in add_pattern
output[0 * ms:(8 * ms) - 1, 0 * ms:(8 * ms) - 1, :] = code_img[0 * ms:(8 * ms) - 1, 0 * ms:(8 * ms) - 1, :]
IndexError: too many indices for array: array is 2-dimensional, but 3 were indexed