Skip to content

RuntimeError: Unsupported image type, must be 8bit gray or RGB image on cnn face detector #1134

@GuimExc

Description

@GuimExc

Expected Behavior

Hello! It seems that Dlib 19.9.0 introduced a bug on the cnn_face_detection. Ideally, one would pass to cnn_face_detection a list of images, and then get the rectangle objects in return.

Current Behavior

However, what it actually happens is that it gives the following error:
RuntimeError: Unsupported image type, must be 8bit gray or RGB image

This only happens if the input of the detector is a list of numpy arrays. If it's an image alone, it works. Also, if I use an older version than 19.9, this works alright.

Steps to Reproduce

import dlib
import numpy as np

face_detector_path = 'mmod_human_face_detector.dat'
face_detector = dlib.cnn_face_detection_model_v1(face_detector_path)
one_image = np.zeros((128, 128, 3))
two_images = [np.zeros((128, 128, 3)), np.zeros((128, 128, 3))]
face_detector(one_image) # This works well
face_detector(two_images) # This fails, only in Dlib 19.9
RuntimeError: Unsupported image type, must be 8bit gray or RGB image
  • Version: 19.9
  • Where did you get dlib: pip install dlib==19.9
  • Platform: Ubuntu 16.04.3 LTS, 64-bit with CUDA 8.0 and CuDNN v7
  • Compiler: Python 3.6.4

Suggestions

I've been taking a look at the code and the part where the error is triggered seems unchanged after 19.9. Maybe the function is_rgb_python_image was changed on 19.9.0 release?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions