我无法使用OpenCV 3.4.2和OpenCV 4.0.0重现您的问题。
这是我得到的:
附:我从下载res10_300x300_ssd_iter_140000.caffemodel
https://raw.githubusercontent.com/opencv/opencv_3rdparty/dnn_samples_face_detector_20170830/res10_300x300_ssd_iter_140000.caffemodel
和来自的deploy.prototxt
https://github.com/opencv/opencv/raw/3.4.0/samples/dnn/face_detector/deploy.prototxt
。