<jupyter_start><jupyter_text>Table of Contents0.1&nbsp;&nbsp;ScratchPad From This Point On<jupyter_code>from esper.prelude import *
import esper.stdlib as stdlib
from esper.rekall import intrvllists_to_result_with_objects
from esper.shot_scale import ShotScale, get_all_frames_with_shot_scale
def to_simple_display(frames):
    """values need to have frame_number, video_id fields"""
    return stdlib.simple_result([{'video': row.video_id,
                                'min_frame': row.frame_number,
                                 'objects':[]} for row in frames], 'Video')

def pose_payload_to_object(pose, video):
    return {
        "id": video,
        'type': 'pose',
        'keypoints': pose
    }

def payload_to_objects(payload, video_id):
    result = []
    result += [esper.rekall.bbox_to_result_object(x, video_id) for x in payload.get('face', [])]
    result += [pose_payload_to_object(x, video_id) for x in payload.get('pose', [])]
    return result

esper_widget(
    intrvllists_to_result_with_objects(
        get_all_frames_with_shot_scale(123, ShotScale.XCU).get_allintervals(), payload_to_objects,
        limit=1000, stride=1))<jupyter_output><empty_output><jupyter_text>ScratchPad From This Point On<jupyter_code>#list(Video.objects.filter(name="the godfather"))
#POSE_ID=5010
#print(Pose.objects.filter(pk=POSE_ID)[0].pose_keypoints())
#esper_widget(stdlib.qs_to_result(Pose.objects.filter(pk=POSE_ID)))
for f in Pose.objects.annotate(video_id=F("frame__video__id")).distinct('video_id'):
    print(f.frame.video.name, f.frame.video.id)
for p in Pose.objects.filter(frame__video__id=380, frame__number=1296):
    print(p.pose_keypoints())
    print(pose_keypoints_to_shot_scale(p.pose_keypoints()))
print(np.arange(17))<jupyter_output>[[ 0.15743743  0.78026277  0.2903161 ]
 [ 0.18593645  0.80215818  0.19284515]
 [ 0.16313151  0.88419163  0.09851257]
 [ 0.0788471   0.80221856  0.2018948 ]
 [ 0.          0.          0.        ]
 [ 0.20185547  0.73096406  0.17957135]
 [ 0.          0.          0.        ]
 [ 0.          0.          0.        ]
 [ 0.          0.          0.        ]
 [ 0.          0.          0.        ]
 [ 0.          0.          0.        ]
 [ 0.          0.          0.        ]
 [ 0.          0.          0.        ]
 [ 0.          0.          0.        ]
 [ 0.14152636  0.79114497  0.36683878]
 [ 0.14943704  0.75013936  0.343256  ]
 [ 0.14035848  0.82679307  0.10837572]
 [ 0.15287919  0.72545677  0.1496032 ]]
ShotScale.M
[[ 0.60619158  0.27137747  0.58040065]
 [ 0.65288359  0.32067925  0.62806898]
 [ 0.67680913  0.31524536  0.54608732]
 [ 0.69502735  0.45474115  0.15907429]
 [ 0.          0.          0.        ]
 [ 0.6358009   0.32890078  0.50826317]
 [ 0.60959941  0.45198584  0.14767033]
 [ 0.       [...]
{'fraction_non_alphanumeric': 0.12883435582822086, 'fraction_numerical': 0.1634788884879105, 'mean_word_length': 2.413793103448276, 'pattern_counts': {'":': 1, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '321923', 'license': 'Apache-2.0', 'n_tokens_mistral': 1322, 'n_tokens_neox': 1069, 'n_words': 178, 'path': 'app/notebooks/shot_scale.ipynb', 'repo_name': 'DanFu09/esper', 'size': '2771'}