Exception: 'dlib.mmod_rectangle' object has no attribute 'right'

I'm using dlib for face detection and getting this error

Exception:  'dlib.mmod_rectangle' object has no attribute 'right'

What is the problem? I'm using cnn version of dlib which should run on gpu and here is the code

detector = dlib.cnn_face_detection_model_v1('mmod_human_face_detector.dat')
img = dlib.load_rgb_image(img_path)
dets = detector(img, 1)

Solution 1

If you use cnn version of dlib, it does not return you simple rectangle. It returns you an instance of a class, which have the rectangle inside of it.

class dlib.mmod_rectangle:
  # Wrapper around a rectangle object and a detection confidence score.
  confidence
  rect

This is the definitation of the class. it has a field rect, where you can find your points. http://dlib.net/python/index.html#dlib.mmod_rectangle

aipool: https://ai-pool.com/d/exception____dlib_mmod_rectangle__object_has_no_attribute__right_