0

I upload images and labels(csv) successfully.

for name, labels in df.values:
  print(name)
  imgs = read_given_images("./",name)
  labels = df['labels']
  points = np.array(labels)

I want to resize images (labels will be update too). and then I want to change it into tfrecord. on single image this code below run correctly but when I run it on group it gives error

for img, img_points in zip(imgs,points):
  img_points = img_points.reshape(-1,2)
  visualize_points(img[...,::-1],img_points,radius=3,thickness=3)
  new_img, new_points = resize_with_aspect_ratio(img,224,img_points.flatten())
  new_points = new_points.reshape(-1,2)
  visualize_points(new_img[...,::-1].astype(np.uint8),new_points,radius=2,thickness=2)

error;

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

where do i have to insert a.any() or a.all() to resolve this error?

Gavin Wong
  • 1,254
  • 1
  • 6
  • 15
  • Please don't add Python code as js snippets –  Jul 14 '20 at 09:08
  • 1
    Does this answer your question? [ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()](https://stackoverflow.com/questions/10062954/valueerror-the-truth-value-of-an-array-with-more-than-one-element-is-ambiguous) – Trenton McKinney Aug 11 '20 at 18:05

1 Answers1

0

imgs = read_given_images("/content/images2",df.names.values)
points = df['labels'].values
points = np.array(points)

The error was in a zip, i imported zipfile. which i shouldn't have. python was this function built-in. Thanks.