zuruoke / watermark-removal

a machine learning image inpainting task that instinctively removes watermarks from image indistinguishable from the ground truth image
1.86k stars 291 forks source link

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all() #3

Open mobilelifeful opened 2 years ago

mobilelifeful commented 2 years ago

Traceback (most recent call last): File "main.py", line 32, in input_image = preprocess_image(image, args.watermark_type) File "/content/watermark-removal/preprocess_image.py", line 42, in preprocess_image assert image.shape == preprocessed_mask_image ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Bellman281 commented 2 years ago

I have got the same problem on Colab: num_gpus_per_job: 1 num_cpus_per_job: 4 num_hosts_per_job: 1 memory_per_job: 32 gpu_type: nvidia-tesla-p100 name: places2_gated_conv_v100 model_restore: dataset: celebahq random_crop: False val: False log_dir: logs/full_model_celeba_hq_256 gan: sngan gan_loss_alpha: 1 gan_with_mask: True discounted_mask: True random_seed: False padding: SAME train_spe: 4000 max_iters: 100000000 viz_max_out: 10 val_psteps: 2000 data_flist: celebahq: ['data/celeba_hq/train_shuffled.flist', 'data/celeba_hq/validation_static_view.flist'] celeba: ['data/celeba/train_shuffled.flist', 'data/celeba/validation_static_view.flist'] places2: ['data/places2/train_shuffled.flist', 'data/places2/validation_static_view.flist'] imagenet: ['data/imagenet/train_shuffled.flist', 'data/imagenet/validation_static_view.flist'] static_view_size: 30 img_shapes: [256, 256, 3] height: 128 width: 128 max_delta_height: 32 max_delta_width: 32 batch_size: 16 vertical_margin: 0 horizontal_margin: 0 ae_loss: True l1_loss: True l1_loss_alpha: 1.0 guided: False edge_threshold: 0.6

image size: (682, 1024, 3) mask image size: (683, 1024, 3) (682, 1024, 3)

askie commented 2 years ago

Traceback (most recent call last): File "main.py", line 32, in input_image = preprocess_image(image, args.watermark_type) File "/Users/askie/wwwroot/watermark-removal/preprocess_image.py", line 42, in preprocess_image assert image.shape == preprocessed_mask_image ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

VIkill33 commented 2 years ago

You can just comment line 42 out

hallejuyahaha commented 2 years ago

i meet this question too

beybin commented 2 years ago

preprocess_image.py line 42 -> assert image.shape == preprocessed_mask_image.shape

sovrinbloc commented 1 year ago

As @VIkill33 said, you can just comment it out. That worked for me. the assert image.shape == preprocessed_mask_image.shape is a check that apparently doesn't need to be there because it works fine without it.

shahmustafa commented 1 year ago

Can anybody comment, on why I am getting this kind of response from model

rm