Skip to content
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

Update Filter Schemas + Query Generation #526

Open
1 of 3 tasks
czaloom opened this issue Apr 11, 2024 · 2 comments · May be fixed by #581
Open
1 of 3 tasks

Update Filter Schemas + Query Generation #526

czaloom opened this issue Apr 11, 2024 · 2 comments · May be fixed by #581
Assignees
Labels

Comments

@czaloom
Copy link
Collaborator

czaloom commented Apr 11, 2024

Feature Type

  • Adding new functionality to valor

  • Changing existing functionality in valor

  • Removing existing functionality in valor

Problem Description

Filter schemas still using old format.

Feature Description

Update the filter object to use the JSON schemas introduced in PR #485.

The following python client code should work .

# Q: I want overhead images from specific datasets.
f = Dataset.name.in_(["dataset1", "dataset2"])

# Q: I want to constrain to images of swimmers where a boat is also in the image. 
f &= (
    Datum.where(Label.value.in_(["swimmer", "diver"]))
    & Datum.where(Label.value.in_(["boat", "ship"]))
)

# Q: I only want images between 08:00:00 and 18:00:00.
f &= (
    (Datum.metadata["time_of_day"] > datetime.time(hour=8))
    & (Datum.metadata["time_of_day"] < datetime.time(hour=18))
)

Additional Context

No response

@czaloom czaloom self-assigned this Apr 11, 2024
@czaloom
Copy link
Collaborator Author

czaloom commented Apr 19, 2024

Found edge case that is not handled.

The following query only returns annotations and labels that are present in groundtruths as the first join to groundtruth eliminates all the prediction options.

 counts = db.query(
        Query(
            func.count(distinct(models.Datum.id)),
            func.count(distinct(models.Annotation.id)),
            func.count(distinct(models.Label.id)),
        )
        .filter(groundtruth_filter)
        .any(as_subquery=False)
        .where(  # type: ignore - this will be a select statement
            or_(
                models.Annotation.model_id.is_(None),
                models.Annotation.model_id == model.id,
            )
        )
        .subquery()
    ).all()

@ntlind
Copy link
Collaborator

ntlind commented Apr 22, 2024

Includes "Implement ability to filter on groundtruth labels"

@czaloom czaloom mentioned this issue Apr 23, 2024
3 tasks
@czaloom czaloom linked a pull request May 14, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants