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

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

Open
blazerroadg opened this issue Mar 19, 2024 · 0 comments
Open

Comments

@blazerroadg
Copy link

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.

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

1 participant