  
      @staticmethod
      def get_landmarks(filename):
          """ Extract the face from a frame (If not alignments file found) """
          image = cv2.imread(filename)
          queue_manager.get_queue("in").put(Sort.alignment_dict(image))
          face = queue_manager.get_queue("out").get()
          landmarks = face["landmarks"][0]
          return landmarks
  
 
</s> remove             retval = cv2.imread(filename)  # pylint: disable=no-member
 </s> add             retval = cv2_read_img(filename, raise_error=True) </s> remove             image = cv2.imread(src)  # pylint: disable=no-member
 </s> add             image = cv2_read_img(src, raise_error=True) </s> remove         preds = np.array([self.vgg_face.predict(cv2.imread(img))
 </s> add         preds = np.array([self.vgg_face.predict(cv2_read_img(img, raise_error=True)) </s> remove             logger.trace("Loading image: '%s'", filename)
            try:
                image = cv2.imread(filename)  # pylint: disable=no-member
            except Exception as err:  # pylint: disable=broad-except
                logger.error("Failed to load image '%s'. Original Error: %s", filename, err)
 </s> add             image = cv2_read_img(filename, raise_error=False)
            if image is None: </s> remove         Estimate the amount of blur an image has
        with the variance of the Laplacian.
        Normalize by pixel number to offset the effect
        of image size on pixel gradients & variance
 </s> add         Estimate the amount of blur an image has with the variance of the Laplacian.
        Normalize by pixel number to offset the effect of image size on pixel gradients & variance
        image = cv2_read_img(filename, raise_error=True)
  
      @staticmethod
      def get_landmarks(filename):
          """ Extract the face from a frame (If not alignments file found) """
        image = cv2_read_img(filename, raise_error=True)
          queue_manager.get_queue("in").put(Sort.alignment_dict(image))
          face = queue_manager.get_queue("out").get()
          landmarks = face["landmarks"][0]
          return landmarks
  
keep keep keep keep replace keep keep keep keep keep
 Centralize cv2 image reading and handle bad filenames 
tools/sort.py