def test_mtcnn_raises_invalid_min_size(): with pytest.raises(DetectorValueError): fdet.MTCNN(min_face_size=-1) with pytest.raises(DetectorValueError): fdet.MTCNN(min_face_size=10) with pytest.raises(DetectorValueError): fdet.MTCNN(min_face_size=1050) fdet.MTCNN(min_face_size=50)
def test_mtcnn_raises_invalid_nms_thresholds(): with pytest.raises(DetectorValueError): fdet.MTCNN(nms_thresholds=0.5) with pytest.raises(DetectorValueError): fdet.MTCNN(nms_thresholds=(0.5, 0.5)) with pytest.raises(DetectorValueError): fdet.MTCNN(nms_thresholds=(0.5, 0.5, 2.0)) with pytest.raises(DetectorValueError): fdet.MTCNN(nms_thresholds=(-1.0, 0.5, 0.5)) fdet.MTCNN(nms_thresholds=(0.5, 0.5, 0.7))
def mtcnn(**kwargs): """mtcnn detector""" input_data = _process_input(kwargs) detector = fdet.MTCNN(min_face_size=kwargs.get('min_size'), thresholds=kwargs.get('thresholds'), nms_thresholds=kwargs.get('nms'), cuda_devices=kwargs.get('gpu'), cuda_enable=kwargs.get('cuda')) _detect(detector, input_data, kwargs)
def mtcnn_detector(): return fdet.MTCNN(cuda_enable=False)