      def load_images(reference_file_paths, nreference_file_paths):
          """ Load the images """
          retval = dict()
          for fpath in reference_file_paths:
              retval[fpath] = {"image": cv2.imread(fpath),  # pylint: disable=no-member
                               "type": "filter"}
          for fpath in nreference_file_paths:
              retval[fpath] = {"image": cv2.imread(fpath),  # pylint: disable=no-member
                               "type": "nfilter"}
          logger.debug("Loaded filter images: %s", {k: v["type"] for k, v in retval.items()})
 
</s> remove             retval[fpath] = {"image": cv2.imread(fpath),  # pylint: disable=no-member
 </s> add             retval[fpath] = {"image": cv2_read_img(fpath, raise_error=True),
 </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(self.images["a"][0])  # pylint: disable=no-member
 </s> add         image = cv2_read_img(self.images["a"][0], 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     img = cv2.imread(filename)  # pylint: disable=no-member
 </s> add     img = cv2_read_img(filename, raise_error=True)
            retval[fpath] = {"image": cv2_read_img(fpath, raise_error=True),

      def load_images(reference_file_paths, nreference_file_paths):
          """ Load the images """
          retval = dict()
          for fpath in reference_file_paths:
            retval[fpath] = {"image": cv2_read_img(fpath, raise_error=True),
                               "type": "filter"}
          for fpath in nreference_file_paths:
              retval[fpath] = {"image": cv2.imread(fpath),  # pylint: disable=no-member
                               "type": "nfilter"}
          logger.debug("Loaded filter images: %s", {k: v["type"] for k, v in retval.items()})
keep keep keep keep replace keep keep keep keep keep
 Centralize cv2 image reading and handle bad filenames 
lib/face_filter.py