Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mobilelifeful opened this issue Mar 9, 2022 · 7 comments

Comments

@mobilelifeful
Copy link

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
Copy link

Bellman281 commented Jun 4, 2022

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
Copy link

askie commented Jun 22, 2022

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
Copy link

You can just comment line 42 out

@hallejuyahaha
Copy link

i meet this question too

@beybin
Copy link

beybin commented Jul 4, 2022

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

@sovrinbloc
Copy link

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
Copy link

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

rm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants