<jupyter_start><jupyter_text>JHMDBhttp://jhmdb.is.tue.mpg.de/datasetDownload the dataset and extract it so that your folder structure is as follows:* /path/to/your/JHMDB    * /images        * /brush_hair        * /catch        * /...    * /person_poses<jupyter_code>%matplotlib inline
import json; from pprint import pprint
Settings = json.load(open('settings.txt'))
import matplotlib.pyplot as plt
import numpy as np
import sys
from time import time
sys.path.insert(0,'../')

from pak.datasets.JHMDB import JHMDB

jhmdb_root = Settings['jhmdb_root']
fmmap = Settings['jhmdb_memmap']  # file with *.npy 

_start = time()
jhmdb = JHMDB(jhmdb_root, fmmap, verbose=False)
_end = time()
print('elapsed', _end - _start)
Actions = jhmdb.get_all_actions()
action = Actions[np.random.randint(0, len(Actions))]
Videos = jhmdb.get_all_videos_for_action(action)
video = Videos[np.random.randint(0, len(Videos))]

print('Action', action)
print('Video', video)

V, gt = jhmdb.load(action, video)

print(gt.shape)

gt = gt.reshape(-1, 14, 3)
print(gt.shape)


fig = plt.figure(figsize=(16,8))

ax = fig.add_subplot(131); ax.axis('off')
ax.imshow(V[0])
for x, y, w in gt[0]:
    print(w)
    ax.scatter(x, y)


ax = fig.add_subplot(132); ax.axis('off')
ax.imshow(V[int(len(V)/2)])
for x, y, _ in gt[int(len(V)/2)]:
    ax.scatter(x, y)

ax = fig.add_subplot(133); ax.axis('off')
ax.imshow(V[-1])
for x, y, w in gt[-1]:
    ax.scatter(x, y)<jupyter_output>Action sit
Video likebeckam_sit_f_nm_np1_le_bad_29
(24, 42)
(24, 14, 3)
0.266792
0.765405
0.476194
0.44417
0.470235
0.587099
0.542204
0.396079
0.366866
0.300711
0.261867
0.384542
0.371837
0.220669
{'fraction_non_alphanumeric': 0.16014669926650366, 'fraction_numerical': 0.08190709046454768, 'mean_word_length': 4.367213114754098, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '587027', 'license': 'MIT', 'n_tokens_mistral': 799, 'n_tokens_neox': 713, 'n_words': 149, 'path': 'samples/JHMDB.ipynb', 'repo_name': 'jutanke/pak', 'size': '1636'}