AI Logic

Datasets and Benchmarks

ActivityNet

Updated:

How ActivityNet is built and used. The left side shows the flow: activities are chosen from the taxonomy of the American Time Use Survey, videos are collected by searching YouTube, people check whether the activity appears, several people mark the start and end times of the activity, the result is compiled into ActivityNet, and it is split into training, validation, and test sets. The right side shows activity segments and background within one video (an illustrative example), the form of the annotation JSON, and the evaluation protocol that averages mAP over varying temporal IoU thresholds.

Overview

ActivityNet is a dataset of long, untrimmed YouTube videos labeled with when everyday activities occur, "from second X to second Y". It was created by Caba Heilbron, Escorcia, Ghanem, and Niebles (Universidad del Norte in Colombia and KAUST in Saudi Arabia) and presented in a CVPR 2015 paper. The version in wide use today is ActivityNet 1.3 (200 classes, 19,994 videos), released in 2016.

Most earlier action datasets consisted of short clips in which a person had cut out only the action. Real videos are different: even a video about making pasta spends long stretches introducing the cook or showing unrelated scenes. ActivityNet uses such untrimmed videos as they are and marks, as temporal segments, where in each video the activity takes place. The activity classes are drawn from the taxonomy of the American Time Use Survey and cover a wide range of daily situations, such as household chores, personal care, work, and sports.

In current deep learning, it serves mainly as a benchmark for temporal action localization and for the preceding step, temporal action proposal generation. A model takes a video as input and outputs many tuples of "action class, start second, end second, confidence", which are scored by how much they overlap the ground-truth segments.

Kinetics asks "what is shown in this 10-second clip?", whereas ActivityNet asks "what happens, and from where to where, in this several-minute video?". It helps to think of it as the difference between image classification and object detection, transferred to the time axis.

Contents: Construction, Classes, and Splits

Construction follows these steps, according to the original paper.

  1. Decide the list of activities. The taxonomy of the American Time Use Survey (ATUS) contains more than 2,000 example activities, from which people selected 203. The activities fall under 7 top-level categories (personal care; eating and drinking; household activities; caring and helping; working; socializing and leisure; sports and exercise), forming a 4-level hierarchy from top-level category down to activity.
  2. Collect videos by searching YouTube. Searches use the activity names, and the query terms are expanded with WordNet hypernyms, hyponyms, and synonyms to gather diverse videos. To limit storage, videos shorter than 20 minutes are preferred.
  3. Have people check whether the activity appears. Amazon Mechanical Turk workers watch each video and remove those that do not contain the activity. Verification questions with known answers are mixed in so that only high-quality workers are used.
  4. Annotate activity segments. Several workers mark the start and end times of the activity, and their results are merged to decide the segment. A single video can contain segments of multiple classes.

Size: the first version (203 classes) has 849 hours of video in total, of which 68.8 hours are activity segments. There are 137 videos per class on average, with 1.41 segments per video on average. Most videos are 5–10 minutes long, about half are 1280Γ—720 HD, and most are 30 fps.

Versions: according to the official page, two versions are distributed.

VersionReleasedClassesTrainingValidationTest
ActivityNet 1.2October 20151004,819 videos (7,151 segments)2,383 videos (3,582 segments)2,480 videos (labels withheld)
ActivityNet 1.3March 201620010,024 videos (15,410 segments)4,926 videos (7,654 segments)5,044 videos (labels withheld)

Format: the annotations are bundled in a single JSON file. database holds, for each video (keyed by its YouTube ID), the duration, resolution, URL, split (subset), and the list of segments (inside annotations, a label and a segment listing the start and end seconds); taxonomy holds the activity hierarchy (follow parentId to the parent), and version holds the version. The videos themselves are given as YouTube URLs; videos that have disappeared are distributed via a shared folder that becomes accessible for 7 days upon request.

Splits: videos are divided into training, validation, and test at 2:1:1 (in the original paper, randomly into 50%, 25%, and 25%). Because the test labels are not public, most papers report results on the validation set.

Evaluation Protocol

Temporal action localization is evaluated by computing mAP at each temporal IoU (tIoU) threshold and averaging them into an "average mAP".

  1. For a predicted segment and a ground-truth segment, compute the temporal IoU (seconds of overlap Γ· seconds covered by either segment).
  2. For each class, sort the predictions by confidence in descending order. A prediction is a hit if there is a not-yet-matched ground truth with tIoU at or above the threshold, and a miss otherwise.
  3. From the sequence of hits and misses, compute precision and recall, obtain the per-class AP (average precision), and average over all classes to get mAP.
  4. Compute mAP at 10 thresholds from 0.5 to 0.95 in steps of 0.05, and take their mean as the average mAP.

In formulas, the tIoU of segments a=[sa,ea]a = [s_a, e_a] and b=[sb,eb]b = [s_b, e_b], and the average mAP, are as follows.

tIoU(a,b)=max⁑(0,Β min⁑(ea,eb)βˆ’max⁑(sa,sb))(eaβˆ’sa)+(ebβˆ’sb)βˆ’max⁑(0,Β min⁑(ea,eb)βˆ’max⁑(sa,sb))\mathrm{tIoU}(a, b) = \frac{\max(0,\ \min(e_a, e_b) - \max(s_a, s_b))}{(e_a - s_a) + (e_b - s_b) - \max(0,\ \min(e_a, e_b) - \max(s_a, s_b))} AverageΒ mAP=110βˆ‘ΞΈβˆˆ{0.5,Β 0.55, …,Β 0.95}mAPΞΈ\text{Average mAP} = \frac{1}{10} \sum_{\theta \in \{0.5,\ 0.55,\ \dots,\ 0.95\}} \mathrm{mAP}_{\theta}

Papers typically list the mAP at thresholds 0.5, 0.75, and 0.95 alongside the average mAP. For the proposal task, the average recall as the number of proposals per video varies (AR@AN) and the area under that curve (AUC) are used.

The original paper defined three tasks, untrimmed video classification, trimmed segment classification, and activity detection, evaluating classification with mAP and detection with mAP at tIoU thresholds varied from 0.1 to 0.5. Today's average mAP over 0.5–0.95 is the default of the official evaluation code.

Reported detection results on ActivityNet 1.3 are as follows (Table 6 of the BMN paper; BSN and BMN are combined with video-level classification results from another paper).

ModelmAP@0.5mAP@0.75mAP@0.95Average mAP (validation)Average mAP (test)
CDC43.8325.880.2122.7722.90
SSN39.1223.485.4923.9828.28
BSN46.4529.968.0230.0332.87
BMN50.0734.788.2933.8536.42

When the threshold is raised to 0.95, every model's mAP falls below 10%. The start and end of an activity are judged differently even by different people, so matching them exactly is very hard.

Most ActivityNet detection numbers combine "segment proposals" with "a separate classifier that predicts the class of the whole video". The values change depending on which classifier was used, which features (Two-Stream, I3D, etc.) were used, and whether the validation or test set was used, so check that these match before comparing.

Usage and Historical Significance

ActivityNet is the dataset that greatly broadened research on "what happens where in a long video".

  • A large-scale benchmark of untrimmed videos (2015): earlier datasets such as UCF-101 and HMDB-51 focused on classifying trimmed clips. ActivityNet made it possible to compare long-video classification and activity detection on the same data.
  • An annual challenge (from 2016): the ActivityNet Challenge was held as a CVPR workshop, with competitions on tasks such as activity detection and temporal proposals. The Kinetics classification task was also run as part of this challenge.
  • A venue for comparing proposal and detection methods: many proposal methods, such as BSN and BMN, report their performance with AR@AN, AUC, and average mAP on ActivityNet 1.3.
  • Research linking video and language: ActivityNet Captions (20k videos, 849 hours, 100k sentences), which adds a sentence description to each segment of the same videos, was built and became the benchmark for finding events in a video and describing them in text (dense captioning).

Because the classes come with a hierarchy, the dataset is also used in research that exploits upper levels such as "household activities" or "sports" to aid learning.

Caveats

License: the official page does not clearly state a license or terms of use for the dataset (the evaluation code on GitHub is under the MIT License, but that applies to the code). The videos were uploaded to YouTube, and the copyright belongs to the uploaders.

Since the terms of use are not stated, contact the authors and confirm permission before using it for anything other than research (such as training commercial products or redistributing the videos). The videos are works of their YouTube uploaders, so the dataset side alone cannot decide whether use is permitted.

Disappearing videos: videos that have been deleted from YouTube or made private cannot be fetched from their URLs. If the number of videos obtained differs from the paper, numbers cannot be compared correctly. The official site distributes the full set through a request-based shared folder, so use that if needed.

Test labels: since the test labels are not public, results are usually reported on the validation set. Choosing model settings on the validation set and then reporting validation numbers can make results look too good.

Version differences: ActivityNet 1.2 (100 classes) and 1.3 (200 classes) differ in both classes and number of videos. When comparing with numbers in papers, check which version was used.

Ambiguous segment boundaries: people disagree on where an activity starts and ends. The original paper also explains that it evaluates at multiple tIoU thresholds because of this ambiguity. The mAP at a high threshold (0.95) varies especially widely.

Abundant background: in the first version, only 68.8 of the 849 hours of video are activity segments. Most of each video is unrelated to the target activity, so if a model cannot narrow down the segments well, false predictions increase and mAP drops.

Comparison with Similar Datasets

Representative video datasets of human actions, compared from the same perspectives, are as follows (values for ActivityNet are 1.3 from the official page, Kinetics from the Kinetics-400 paper, THUMOS-14 from the BMN paper, and Breakfast from the MS-TCN paper).

DatasetMain taskVideosClassesCountLabel formEvaluation
ActivityNet 1.3Temporal action localizationUntrimmed YouTube videos (several minutes)20019,994 videosSegments (start and end seconds) and classesAverage mAP over tIoU 0.5–0.95
Kinetics-400Action classification~10-second clips cut from YouTube400306,245 videosOne class per clipTop-1 and top-5 accuracy
THUMOS-14Temporal action localizationUntrimmed videos20413 videos with segmentsSegments and classesmAP at tIoU 0.3–0.7
BreakfastAction segmentationFixed cameras in kitchens481,712 videosPer-frame classesF1@k, Edit, frame accuracy

Rough guidelines for choosing are as follows.

  • To compare models that find action segments in long videos on large data, use ActivityNet 1.3. It is the detection benchmark with the most reported results.
  • To see whether results hold on other data, the standard practice is to also use THUMOS-14. Papers such as BMN report results on both ActivityNet 1.3 and THUMOS-14.
  • For models that assign a whole video to one class, and for pretraining, use Kinetics.
  • For the task of labeling every frame of a video with an action without gaps, use Breakfast, 50Salads, or GTEA, and evaluate with F1@k and Edit score.

PyTorch example

Show code
python
import json

import numpy as np

"""
Read the ActivityNet 1.3 annotations (activity_net.v1-3.min.json) and compute the average mAP for temporal detection
  database[<YouTube ID>] = {
    'subset': 'training' | 'validation' | 'testing',
    'duration': video length (seconds), 'resolution': ..., 'url': ...,
    'annotations': [{'label': class name, 'segment': [start second, end second]}, ...],
  }
A compact version of the same procedure as the official evaluation code (Evaluation/eval_detection.py in github.com/activitynet/ActivityNet)
"""

with open('activity_net.v1-3.min.json') as f:
  anno = json.load(f)

gt = {}  # class name -> [(video ID, start, end), ...]
for vid, v in anno['database'].items():
  if v['subset'] != 'validation':  # test labels are not public, so evaluate on the validation set
    continue
  for a in v['annotations']:
    gt.setdefault(a['label'], []).append((vid, a['segment'][0], a['segment'][1]))
print(len(gt))  # 200


def t_iou(seg, segs):
  # temporal IoU between one segment and multiple segments
  inter = np.clip(np.minimum(seg[1], segs[:, 1]) - np.maximum(seg[0], segs[:, 0]), 0, None)
  union = (seg[1] - seg[0]) + (segs[:, 1] - segs[:, 0]) - inter
  return inter / union


def average_precision(gts, preds, thr):
  # gts: [(video, start, end)], preds: [(video, start, end, confidence)] (same class)
  preds = sorted(preds, key=lambda p: -p[3])
  by_vid = {}
  for i, (vid, s, e) in enumerate(gts):
    by_vid.setdefault(vid, []).append((i, s, e))
  used = set()
  tp = np.zeros(len(preds))
  for k, (vid, s, e, _) in enumerate(preds):
    cands = by_vid.get(vid, [])
    if not cands:
      continue
    ious = t_iou((s, e), np.array([[c[1], c[2]] for c in cands]))
    for j in np.argsort(-ious):  # match to the not-yet-used ground truth with the largest overlap first
      if ious[j] < thr:
        break
      if cands[j][0] not in used:
        used.add(cands[j][0])
        tp[k] = 1
        break
  tp_cum = np.cumsum(tp)
  rec = tp_cum / max(len(gts), 1)
  prec = tp_cum / np.arange(1, len(preds) + 1)
  # as in VOC, make precision monotonic from the right, then take the area
  mprec = np.concatenate([[0], prec, [0]])
  mrec = np.concatenate([[0], rec, [1]])
  for i in range(len(mprec) - 2, -1, -1):
    mprec[i] = max(mprec[i], mprec[i + 1])
  idx = np.where(mrec[1:] != mrec[:-1])[0] + 1
  return float(np.sum((mrec[idx] - mrec[idx - 1]) * mprec[idx]))


def average_map(predictions, thresholds=np.linspace(0.5, 0.95, 10)):
  # predictions: class name -> [(video, start, end, confidence)]
  maps = [np.mean([average_precision(g, predictions.get(c, []), t) for c, g in gt.items()]) for t in thresholds]
  return float(np.mean(maps)), dict(zip(np.round(thresholds, 2), maps))

FAQ

Q. How do ActivityNet and Kinetics differ?
A.

They target different tasks. Kinetics is a classification dataset that assigns one class to clips trimmed to about 10 seconds. ActivityNet is a detection dataset that annotates segments (start and end seconds) of activities in untrimmed videos several minutes long. Features pretrained on Kinetics are often used for detection on ActivityNet.

Q. How is the "average mAP" computed?
A.

Vary the temporal IoU threshold over 10 values, 0.5, 0.55, …, 0.95, compute the mAP over all classes at each, and average them. The higher the threshold, the more exactly the segment boundaries must be hit, so the mAP at 0.95 is much lower than the mAP at 0.5.

Q. Can ActivityNet be used to develop commercial products?
A.

The official page does not state terms of use, and the videos are works of their YouTube uploaders, so this cannot be decided as is. For uses other than research, contact the authors and confirm permission.

References

  1. Caba Heilbron, F., Escorcia, V., Ghanem, B., & Niebles, J. C. (2015). ActivityNet: A Large-Scale Video Benchmark for Human Activity Understanding. CVPR 2015, pp. 961–970.
  2. ActivityNet (official page: counts per version, the annotation JSON format, and video requests).
  3. activitynet/ActivityNet (official evaluation code: Evaluation/eval_detection.py).
  4. Lin, T., Liu, X., Li, X., Ding, E., & Wen, S. (2019). BMN: Boundary-Matching Network for Temporal Action Proposal Generation. ICCV 2019, pp. 3888–3897. arXiv:1907.09702.
  5. Krishna, R., Hata, K., Ren, F., Fei-Fei, L., & Niebles, J. C. (2017). Dense-Captioning Events in Videos. arXiv:1705.00754.