py-feat icon indicating copy to clipboard operation
py-feat copied to clipboard

Error returned when testing detect_image()

Open IMPACTlab-Columbia opened this issue 2 years ago • 1 comments

When running detection for the test image, with a bit different model choices for the detector,

from feat import Detector
detector =  Detector(face_model='img2pose-c',  
                     landmark_model="mobilefacenet", 
                     au_model='xgb', 
                     emotion_model='resmasknet', 
                     facepose_model='img2pose-c',
                     identity_model='facenet')

from feat.utils.io import get_test_data_path
from feat.plotting import imshow
import os

# Helper to point to the test data folder
test_data_dir = get_test_data_path()

# Get the full path
single_face_img_path = os.path.join(test_data_dir, "single_face.jpg")

# Plot it
imshow(single_face_img_path)

single_face_prediction = detector.detect_image(single_face_img_path)

# Show results
single_face_prediction

Errors occured, saying that RuntimeError: Can't call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead.

IMPACTlab-Columbia avatar Nov 06 '23 16:11 IMPACTlab-Columbia

hi @IMPACTlab-UCSD , thanks for sharing this issue. Can you tell us a little bit more about your setup? What version of py-feat, python, os, etc. I can't replicate this issue on my M1 running latest version of py-feat and Python 3.11.

ljchang avatar Jan 06 '24 19:01 ljchang