Skip to content

TypeError when using align() on certain images in facealignment library #197

@blazerroadg

Description

@blazerroadg

Description
I'm encountering a TypeError when attempting to align certain images using the facealignment library's align() function. While the function works as expected with some images, it throws an error with others, despite both types of images being seemingly similar (e.g., both are 3-channel images).
import facealignment
det2 = facealignment.FaceAlignmentTools()
aligned_img, b, points= det2.align(img) # returning boxes, n_src_points from align function
The function is expected to return the aligned image, bounding box, and facial landmarks without any errors, as it does with other images.


TypeError Traceback (most recent call last)
Cell In[40], line 2
1 bboxes1, pps1, ccs1 = det1.call(img)
----> 2 aligned_img, b, points= det2.align(img)
3 # screen_img = cv2.hconcat([img, aligned_img])
6 pps1

File c:\Users\Mary\Documents\ais-projects-software_ai_features-Cheetah_B0_Receiver-07_Software\ais-projects-software_ai_features-Cheetah_B0_Receiver-07_Software\Cheetah_B0_Receiver\07_Software\facealignment\tools.py:202, in FaceAlignmentTools.align(self, img, dsize, allow_multiface, central_face, alignment)
199 dst_points = self._landmarks[self._alignment_style] # Load saved landmarks
201 if alignment is None:
--> 202 n_src_points, boxes= self.detect_face(img, allow_multiface=allow_multiface or central_face)
203 else:
204 n_src_points = alignment

TypeError: cannot unpack non-iterable NoneType object

Environment
Python version: 3.9.18
Operating System: windows10

Additional Context
Both images that I tested (the one that works and the one that doesn't) are 3-channel RGB images and appear correctly when displayed. This suggests the issue may not be with the image format or structure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions