Exception: 'dlib.mmod_rectangle' object has no attribute 'right' - 例外:'dlib.mmod_rectangle'对象没有属性'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_


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM