R3gm/stablepy

Error when loading multiple images to IP-Adapter

imperatrona opened this issue · 0 comments

IP-Adapter-FaceID-Portrait can accept multiple facial images to enhance similarity (https://huggingface.co/h94/IP-Adapter-FaceID#ip-adapter-faceid-portrait). But when I try to append array to ip_adapter_image it throws ValueError on line 1281 of model.py file:

File /opt/conda/lib/python3.10/site-packages/stablepy/diffusers_vanilla/model.py:1281, in Model_Diffusers.get_ip_embeds(self, guidance_scale, ip_images, num_images, ip_masks)
   1278 else:
   1279     ref_images_embeds = []
-> 1281     image = cv2.cvtColor(np.asarray(image), cv2.COLOR_BGR2RGB)
   1282     faces = app.get(image)
   1283     image = torch.from_numpy(faces[0].normed_embedding)

ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (5,) + inhomogeneous part.

It works if I put one image instead of array, but it drastically decrease resemblance with person.

ps. Thanks for your work, stablepy is amazing project!