How to use the esper.widget.qs_to_result function in esper

To help you get started, we’ve selected a few esper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github scanner-research / esper-tv / app / esper / queries / all_faces.py View on Github external
def all_clothing():
    from query.models import Clothing
    from esper.widget import qs_to_result
    return qs_to_result(Clothing.objects.all(), stride=1000)
github scanner-research / esper-tv / app / esper / queries / other_queries.py View on Github external
if (hx2 < 0.5 and x2 < 0.5) or (hx1 > 0.5 and x1 > 0.5):
                return False
            # All other faces should be smaller than the host face
            if (hy2 - hy1) / (y2 - y1) < host_to_other_size_ratio:
                return False

            result |= y2 - y1 >= other_face_height_thresh
        return result

    selected_shots = {
        shot_id for shot_id, bbox_list in shots_to_other_faces.items()
        if shot_filter(bbox_list)
    }
    assert len(selected_shots) > 0, 'No shots selected for display'

    return qs_to_result(
        Face.objects.filter(shot__id__in=list(selected_shots)),
        limit=100000
    )
github scanner-research / esper-tv / app / esper / queries / all_faces.py View on Github external
def all_haircolor():
    from query.models import HairColor
    from esper.widget import qs_to_result
    return qs_to_result(HairColor.objects.all(), stride=1000)
github scanner-research / esper-tv / app / esper / queries / all_videos.py View on Github external
def all_videos():
    from query.models import Video
    from esper.widget import qs_to_result
    return qs_to_result(Video.objects.all())
github scanner-research / esper-tv / app / esper / queries / other_queries.py View on Github external
start = random.randint(0, v.num_frames - dur - 1)
            end = start + dur
            in_commercial = False
            for c in commercials:
                minf, maxf = (c['min_frame'], c['max_frame'])
                if (minf <= start and start <= max) or (minf <= end and end <= maxf) \
                    or (start <= minf and minf <= end and start <= maxf and maxf <= end):
                    in_commercial = True
                    break
            if not in_commercial:
                break
        else:
            continue
        conds.append({'video': v, 'min_frame__gte': start, 'max_frame__lte': end})

    return qs_to_result(
        Speaker.objects.filter(labeler__name='lium').filter(
            reduce(lambda a, b: a | b, [Q(**c) for c in conds])),
        group=True,
        limit=None)
github scanner-research / esper-tv / app / esper / queries / other_queries.py View on Github external
def audio_labels():
    from query.models import Speaker
    from esper.widget import qs_to_result
    return qs_to_result(Speaker.objects.all(), group=True, limit=10000)
github scanner-research / esper-tv / app / esper / queries / other_queries.py View on Github external
def segments_about_donald_trump():
    from query.models import Segment
    from esper.widget import qs_to_result
    return qs_to_result(
        Segment.objects.filter(
            labeler__name='haotian-segments',
            things__type__name='person',
            things__name='donald trump'))
github scanner-research / esper-tv / app / esper / queries / other_queries.py View on Github external
from query.models import FaceIdentity
    from esper.widget import qs_to_result
    from esper.major_canonical_shows import MAJOR_CANONICAL_SHOWS

    name='hillary clinton'

    results = []
    for show in sorted(MAJOR_CANONICAL_SHOWS):
        qs = FaceIdentity.objects.filter(
            identity__name=name,
            face__shot__video__show__canonical_show__name=show,
            probability__gt=0.9
        )
        if qs.count() > 0:
            results.append(
                (show, qs_to_result(qs, shuffle=True, limit=10))
            )
    return group_results(results)
github scanner-research / esper-tv / app / esper / queries / all_faces.py View on Github external
def face_tags():
    from query.models import FaceTag
    from esper.widget import qs_to_result
    return qs_to_result(FaceTag.objects.filter(
        labeler__name='race:black:labeler=james',
        score__gt=0.5))
github scanner-research / esper-tv / app / esper / queries / other_queries.py View on Github external
def commercials():
    from query.models import Commercial
    from esper.widget import qs_to_result
    return qs_to_result(Commercial.objects.filter(labeler__name='haotian-commercials'))