def load_from_dir(cls, dir_path: str, face_detector: FaceDetector,
                      marks_detector: FaceMarksDetector) -> 'MasksLibrary':
        def get_mask_name_from(file_path: str) -> str:
            name = os.path.basename(file_path)
            name = os.path.splitext(name)[0]
            return name

        new_lib = MasksLibrary()
        image_paths = [os.path.join(dir_path, f) for f in os.listdir(dir_path)]
        for image_path in image_paths:
            try:
                image = Image.from_file(image_path)
                name = get_mask_name_from(image_path)
                mask = Mask.from_image(image, face_detector, marks_detector)
                new_lib[name] = mask
            except Exception as err:
                print(f"Error creating mask for {image_path}\nError: {err}")
                continue

        return new_lib