In [1]:
from work.dataset.activitynet import ActivityNetDataset

dataset = ActivityNetDataset(
    videos_path='../dataset/videos.json',
    labels_path='../dataset/labels.txt'
)

print('Initial dataset instances:', dataset.instances)
dataset.generate_instances()


Initial dataset instances: []
19757/19757 [==============================] - 149s   

In [2]:
print('Length of the dataset instances:', len(dataset.instances))
print('Length of the training dataset instances:',  len(dataset.instances_training))


Length of the dataset instances: 4077203
Length of the training dataset instances: 2053437

In [4]:
print(dataset.class_weights)
dataset.compute_class_weights()
print(dataset.class_weights)


None
{0: 0.6378077340575825, 1: 0.998543417694334, 2: 0.9964893006213486, 3: 0.9960773084345904, 4: 0.9946421536185429, 5: 0.996634910153075, 6: 0.9942710684574204, 7: 0.9964688471085307, 8: 0.9969675232305641, 9: 0.9971131327622907, 10: 0.9971457609851191, 11: 0.9972611772360194, 12: 0.9954695469108621, 13: 0.9975041844478306, 14: 0.995654602503023, 15: 0.998215674500849, 16: 0.997508080355034, 17: 0.995302509889517, 18: 0.9933389726590103, 19: 0.9976337233623432, 20: 0.9967040625059351, 21: 0.997536812670659, 22: 0.9966660774107021, 23: 0.9980676300271204, 24: 0.9977048236688051, 25: 0.9971856940339539, 26: 0.9973288686236782, 27: 0.9949304507515936, 28: 0.9986763655276495, 29: 0.9990104395703399, 30: 0.9956726210738387, 31: 0.9969933336157866, 32: 0.9972655601316233, 33: 0.9968701255504795, 34: 0.9984874140282852, 35: 0.9930234041755359, 36: 0.9989549228926916, 37: 0.9967366907287636, 38: 0.9971944598251614, 39: 0.9965000143661578, 40: 0.9974671733293985, 41: 0.9979906858598535, 42: 0.995831866280777, 43: 0.9969631403349604, 44: 0.997101932029081, 45: 0.9978484852469299, 46: 0.9975051584246315, 47: 0.9969105455877146, 48: 0.9980569162823111, 49: 0.9975689539050869, 50: 0.9915770486262788, 51: 0.994600759604507, 52: 0.9951198892393582, 53: 0.9977671581840593, 54: 0.9976585597707648, 55: 0.9972470545724071, 56: 0.9983495963109654, 57: 0.9987245773792914, 58: 0.997336660438085, 59: 0.9978679647829468, 60: 0.9969831068593777, 61: 0.9967741888355961, 62: 0.9929401291590636, 63: 0.9934840952023364, 64: 0.9964620292709248, 65: 0.9951189152625574, 66: 0.9973712366145151, 67: 0.9974296752225659, 68: 0.9978314406529151, 69: 0.9979376041242074, 70: 0.9932367050949213, 71: 0.9987372390777024, 72: 0.995575223393754, 73: 0.9951291420189663, 74: 0.9959161152740503, 75: 0.9988039564885604, 76: 0.9945208935068376, 77: 0.9975197680766442, 78: 0.9945954027321023, 79: 0.9966899398423229, 80: 0.9952669597362861, 81: 0.9963310293912109, 82: 0.9976283664899386, 83: 0.9927950066157374, 84: 0.9950405101300892, 85: 0.995102357656943, 86: 0.993076485911182, 87: 0.9987216554488889, 88: 0.9975962252555106, 89: 0.9927341330656845, 90: 0.9966490328166874, 91: 0.9979848419990485, 92: 0.9971520918343246, 93: 0.99800967840747, 94: 0.9971106978202886, 95: 0.9959200111812537, 96: 0.9986081871515903, 97: 0.9978728346669511, 98: 0.9952284876526526, 99: 0.9950677814805129, 100: 0.9971774152311466, 101: 0.9972387757696, 102: 0.9992266624201278, 103: 0.9941756187309374, 104: 0.9970176830358077, 105: 0.9981211987511669, 106: 0.994778997359062, 107: 0.9970089172446002, 108: 0.997444771862979, 109: 0.9969714191377675, 110: 0.9942335703505878, 111: 0.9955260375653112, 112: 0.9973765934869198, 113: 0.997511489273837, 114: 0.9954900004236799, 115: 0.9977988124300867, 116: 0.997765697218858, 117: 0.9963519698924291, 118: 0.9973950990461358, 119: 0.9957797585219318, 120: 0.9968272705712423, 121: 0.9962024644534991, 122: 0.9976814482255847, 123: 0.9987250643676918, 124: 0.9982882357725121, 125: 0.9979449089502137, 126: 0.9975446044850658, 127: 0.997190563917958, 128: 0.996403590662874, 129: 0.9971837460803521, 130: 0.9945749492192846, 131: 0.9951359598565722, 132: 0.9988979452498421, 133: 0.9975426565314641, 134: 0.9962686948759567, 135: 0.9959063755060418, 136: 0.9977569314276503, 137: 0.9970279097922167, 138: 0.99843530626944, 139: 0.9967707799167932, 140: 0.9987250643676918, 141: 0.9982551205612834, 142: 0.9971764412543458, 143: 0.9962467803979377, 144: 0.9976303144435402, 145: 0.9982244402920567, 146: 0.9976059650235191, 147: 0.9963665795444419, 148: 0.9976570988055635, 149: 0.9964459586537108, 150: 0.9984294624086348, 151: 0.9977165113904152, 152: 0.9947346814146234, 153: 0.9970245008734137, 154: 0.9964966054473549, 155: 0.9971871549991551, 156: 0.9972519244564114, 157: 0.9972387757696, 158: 0.9984810831790798, 159: 0.9974618164569938, 160: 0.9970137871286043, 161: 0.9987328561820986, 162: 0.9977432957524385, 163: 0.997416039547354, 164: 0.9971579356951297, 165: 0.9981187638091649, 166: 0.9965998469882446, 167: 0.9961868808246856, 168: 0.997035214618223, 169: 0.995918063227652, 170: 0.9954067254072075, 171: 0.9953935767203961, 172: 0.997660020735966, 173: 0.997437954025373, 174: 0.9970907312958712, 175: 0.9982229793268554, 176: 0.9956916136214552, 177: 0.9978387454789215, 178: 0.9955985988369743, 179: 0.9979975036974594, 180: 0.9975991471859131, 181: 0.9952046252210318, 182: 0.9958002120347496, 183: 0.9969714191377675, 184: 0.9984309233738362, 185: 0.9956818738534466, 186: 0.9964162523612851, 187: 0.9977160244020148, 188: 0.9939808233707681, 189: 0.9983310907517494, 190: 0.9976171657567289, 191: 0.9964970924357552, 192: 0.9973546790089007, 193: 0.9968068170584244, 194: 0.9978168310009023, 195: 0.9990011867907318, 196: 0.9983934252670036, 197: 0.9973639317885087, 198: 0.9970746606786572, 199: 0.99714673496192, 200: 0.9974710692366019}

In [1]:
from work.dataset.activitynet import ActivityNetDataset

dataset = ActivityNetDataset(
    videos_path='../dataset/videos.json',
    labels_path='../dataset/labels.txt'
)

video = dataset.videos[0]

In [3]:
intances = video.get_video_instances(length=16, overlap=0)

In [ ]:
[print(ins.output for ins in instances)]