Skip to content

Bug: LandmarkDataset raises image_loader attribute error when using store_imgs=False with in-memory images #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jejon opened this issue May 7, 2025 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@jejon
Copy link
Collaborator

jejon commented May 7, 2025

Description:

When using the LandmarkDataset class from the landmarker package with store_imgs=False and providing in-memory images (not file paths) via imgs = [image], an unexpected AttributeError is raised:

AttributeError: 'LandmarkDataset' object has no attribute 'image_loader'

This is a bug — the dataset is expected to support store_imgs=False regardless of whether the input images are in-memory objects or file paths. The attribute image_loader is not defined anywhere in the code, making the source of this error unclear and unexpected.


Steps to Reproduce:

  1. Set imgs = [image] where image is a loaded image (e.g., a PIL or NumPy object), not a file path

  2. Initialize the dataset:

    ds = LandmarkDataset(imgs=imgs, store_imgs=False)
  3. Use the dataset (e.g., iterate through it or index an item)

  4. Observe the error:

    AttributeError: 'LandmarkDataset' object has no attribute 'image_loader'
    

Expected Behavior:

The dataset should support in-memory images with store_imgs=False and operate without errors.


Actual Behavior:

An AttributeError is thrown due to a missing image_loader attribute that is never explicitly defined or initialized.


Suggested Fix:

Ensure that LandmarkDataset handles in-memory images properly when store_imgs=False, and avoid referencing or relying on an undefined image_loader attribute. If image_loader is intended to be used internally, it should be properly initialized or the logic should be revised to avoid such dependency in this configuration.

@jejon jejon self-assigned this May 7, 2025
@jejon jejon added the bug Something isn't working label May 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant