Ejemplo n.º 1
0
def test_plot_detections():
    test_data_dir = get_test_data_path()
    test_image = join(test_data_dir, "input.jpg")
    detector = Detector()
    image_prediction = detector.detect_image(test_image)
    axes = image_prediction.plot_detections()
    assert axes[1].get_xlim() == (0.0, 1.1)
    plt.close()

    axes = image_prediction.plot_detections(muscle=True)
    assert axes[1].get_xlim() == (0.0, 1.1)
    plt.close()

    image_prediction2 = image_prediction.copy()
    image_prediction2["input"] = "NO_SUCH_FILE_EXISTS"
    axes = image_prediction2.plot_detections()
    assert axes[1].get_xlim() == (0.0, 1.1)
    plt.close()
Ejemplo n.º 2
0
# Here is what our test image looks like.

# In[4]:

from PIL import Image
import matplotlib.pyplot as plt
f, ax = plt.subplots()
im = Image.open(test_image)
ax.imshow(im)

# Now we use our initialized `detector` instance to make predictions with the `detect_image()` method.

# In[5]:

image_prediction = detector.detect_image(test_image)
# Show results
image_prediction

# The output is a `Fex` class instance which allows you to run the built-in methods for `Fex`.
#
# ## Visualizing detection results.
#
# For example, you can easily plot the detection results.

# In[6]:

image_prediction.plot_detections()

# If you are interested in visualizing the head pose, you can do so simply by setting `pose=True`. This setting will overlay the x,y, and z-axis of the head onto the image.
Ejemplo n.º 3
0
from feat.tests.utils import get_test_data_path
import os
test_data_dir = get_test_data_path()
test_image = os.path.join(test_data_dir, "input.jpg")

Here is what our test image looks like.

from PIL import Image
import matplotlib.pyplot as plt
f, ax = plt.subplots()
im = Image.open(test_image)
ax.imshow(im);

Now we use our initialized `detector` instance to make predictions with the `detect_image()` method.

image_prediction = detector.detect_image(test_image)
# Show results
image_prediction

The output is a `Fex` class instance which allows you to run the built-in methods for `Fex`. 

## Visualizing detection results.

For example, you can easily plot the detection results. 

image_prediction.plot_detections();

## Accessing face expression columns of interest.  

You can also access the columns of interests (AUs, emotion) quickly. 
Ejemplo n.º 4
0
#!/usr/bin/env python3
from feat import Detector
face_model = "retinaface"
landmark_model = "mobilenet"
au_model = "rf"
emotion_model = "resmasknet"
detector = Detector(face_model=face_model,
                    landmark_model=landmark_model,
                    au_model=au_model,
                    emotion_model=emotion_model)

from feat.tests.utils import get_test_data_path
import os
test_data_dir = get_test_data_path()
test_image = os.path.join(test_data_dir, "input.jpg")

from PIL import Image
import matplotlib.pyplot as plt
f, ax = plt.subplots()
im = Image.open(test_image)
ax.imshow(im)

image_prediction = detector.detect_image(test_image)
# Show results
image_prediction