title: Vision Framework (iOS): How are VNDetectFaceLandmarksRequest and VNDetectFaceRectanglesRequest different?
body: <p>There are two different requests that you can use for face detection tasks with the iOS Vision Framework: <code>VNDetectFaceLandmarksRequest</code> and <code>VNDetectFaceRectanglesRequest</code>. Both of them return an array of <code>VNFaceObservation</code>, one for each detected face. <code>VNFaceObservation</code> has a variety of optional properties, including <code>boundingBox</code> and <code>landmarks</code>. The landmarks object then also includes optional properties like <code>nose</code>, <code>innerLips</code>, <code>leftEye</code>, etc.</p>
  <p>Do the two different Vision requests differ in how they perform face detection?</p>
  <p>It seems that <code>VNDetectFaceRectanglesRequest</code> only finds a bounding box (and maybe some other properties), but does not find any landmarks. On the other hand, <code>VNDetectFaceLandmarksRequest</code> seems to find both, bounding box and landmarks.
  Are there cases where one request type will find a face and the other one will not? Is <code>VNDetectFaceLandmarksRequest</code> <strong>superior</strong> to <code>VNDetectFaceRectanglesRequest</code>, or does the latter maybe have advantages in <strong>performance</strong> or <strong>reliability</strong>?</p>
  <p>Here is an example code of how these two Vision requests can be used:</p>
  <pre><code>let faceLandmarkRequest = VNDetectFaceLandmarksRequest()
  let faceRectangleRequest = VNDetectFaceRectanglesRequest()
  let requestHandler = VNImageRequestHandler(ciImage: image, options: [:])
  try requestHandler.perform([faceRectangleRequest, faceLandmarkRequest])
  if let rectangleResults = faceRectangleRequest.results as? [VNFaceObservation] {
      let boundingBox1 = rectangleResults.first?.boundingBox   //this is an optional type
  }
  if let landmarkResults = faceLandmarkRequest.results as? [VNFaceObservation] {
      let boundingBox2 = landmarkResults.first?.boundingBox   //this is an optional type
      let landmarks = landmarkResults.first?.landmarks   //this is an optional type
  }
  </code></pre>