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 with new numpy version for MTCNN #206

Closed
preetham-tn opened this issue Mar 9, 2023 · 5 comments
Closed

ValueError with new numpy version for MTCNN #206

preetham-tn opened this issue Mar 9, 2023 · 5 comments

Comments

@preetham-tn
Copy link

When batch of images are passed to mtcnn.detect() , it gives out ValueError for new versions of numpy

When the list is assigned to the numpy array in the following code , for batch of images , list will have inhomogeneous shape after the first dimension which gives out ValueError

batch_boxes, batch_points = np.array(batch_boxes), np.array(batch_points)

@eli-clarity
Copy link

eli-clarity commented Apr 2, 2023

I'm Having the same issue, to add a few details: the issue is no face detection in one of the frames in the batch which is than has an empty vector being concatenated to non empty vector (Not sure if it's a numpy version issue, but doesn't fill like numpy should allow it anyway). There is also another issue where you have multiple detections.
Testing with previous versions this issue seems to be persistent down to 2.3.* and you get another issue with the 2.2.* versions.
An ugly workaround I found is to ignore the problematic frame with the following snippet (and force to pick the first frame for each) Note: this will impact anything you are doing with your data down the line

        b_i_inds = np.where(image_inds == b_i)[0][0: 1]
        if len(b_i_inds) == 0:
            continue

I guess duplicating another frame is also an option you can consider.

@timesler
Copy link
Owner

timesler commented Apr 3, 2023

@preetham-tn @eli-clarity would it be possible for you to provide a reproducible example of this problem?

@timesler
Copy link
Owner

timesler commented Apr 6, 2023

This issue should now be fixed with #207 and version 2.5.3 on PyPI. Running pip install --upgrade facenet-pytorch should get things up and running properly

@timesler timesler closed this as completed Apr 6, 2023
@preetham-tn
Copy link
Author

Thanks @timesler

@eli-clarity
Copy link

Also can confirm the issue is gone, thanks for handling it

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

3 participants