def test_retinaface_raises_invalid_backbone(): with pytest.raises(DetectorValueError): fdet.RetinaFace(backbone=20) with pytest.raises(DetectorValueError): fdet.RetinaFace(backbone='xxxxx') fdet.RetinaFace(backbone='RESNET50') fdet.RetinaFace(backbone='MOBILENET')
def test_retinaface_raises_invalid_max_size(): with pytest.raises(DetectorValueError): fdet.RetinaFace(backbone='MOBILENET', max_face_size=-1) with pytest.raises(DetectorValueError): fdet.RetinaFace(backbone='MOBILENET', max_face_size=10) with pytest.raises(DetectorValueError): fdet.RetinaFace(backbone='MOBILENET', max_face_size=1050) fdet.RetinaFace(backbone='MOBILENET', max_face_size=200)
def retinaface(**kwargs): """retinaface detector""" input_data = _process_input(kwargs) detector = fdet.RetinaFace(backbone=kwargs.get('backbone'), max_face_size=kwargs.get('max_size'), threshold=kwargs.get('threshold'), nms_threshold=kwargs.get('nms'), cuda_devices=kwargs.get('gpu'), cuda_enable=kwargs.get('cuda')) _detect(detector, input_data, kwargs)
def test_retinaface_raises_invalid_nms_threshold(): with pytest.raises(DetectorValueError): fdet.RetinaFace(backbone='MOBILENET', nms_threshold=2.0) with pytest.raises(DetectorValueError): fdet.RetinaFace(backbone='MOBILENET', nms_threshold=-1.0) fdet.RetinaFace(backbone='MOBILENET', nms_threshold=0.4)
def mobilenet_detector(): return fdet.RetinaFace(backbone='MOBILENET', cuda_enable=False)
def resnet_detector(): return fdet.RetinaFace(backbone='RESNET50', cuda_enable=False)