Leyo commited on
Commit
13dfd26
·
1 Parent(s): d95880c

Delete tgif.py

Browse files
Files changed (1) hide show
  1. tgif.py +0 -101
tgif.py DELETED
@@ -1,101 +0,0 @@
1
- # Lint as: python3
2
- """TGIF: A New Dataset and Benchmark on Animated GIF Description"""
3
-
4
-
5
- import os
6
- import csv
7
- import datasets
8
-
9
-
10
- _CITATION = """
11
- @InProceedings{tgif-cvpr2016,
12
- author = {Li, Yuncheng and Song, Yale and Cao, Liangliang and Tetreault, Joel and Goldberg, Larry and Jaimes, Alejandro and Luo, Jiebo},
13
- title = "{TGIF: A New Dataset and Benchmark on Animated GIF Description}",
14
- booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
15
- month = {June},
16
- year = {2016}
17
- }
18
- """
19
-
20
- _DESCRIPTION = """\
21
- The Tumblr GIF (TGIF) dataset contains 100K animated GIFs and 120K sentences describing visual content of the animated GIFs.
22
- The animated GIFs have been collected from Tumblr, from randomly selected posts published between May and June of 2015.
23
- We provide the URLs of animated GIFs in this release. The sentences are collected via crowdsourcing, with a carefully designed
24
- annotationinterface that ensures high quality dataset. We provide one sentence per animated GIF for the training and validation splits,
25
- and three sentences per GIF for the test split. The dataset shall be used to evaluate animated GIF/video description techniques.
26
- """
27
-
28
- _URL_BASE = "http://raingo.github.io/TGIF-Release/"
29
-
30
- _DL_URL = "https://github.com/raingo/TGIF-Release/archive/master.zip"
31
-
32
- class TGIFConfig(datasets.BuilderConfig):
33
- """BuilderConfig for TGIF."""
34
-
35
- def __init__(self, **kwargs):
36
- super(TGIFConfig, self).__init__(version=datasets.Version("2.1.0", ""), **kwargs)
37
-
38
- class TGIF(datasets.GeneratorBasedBuilder):
39
-
40
- DEFAULT_CONFIG_NAME = "all"
41
- BUILDER_CONFIGS = [
42
- TGIFConfig(name="all", description="All the TGIF dataset"),
43
- ]
44
-
45
- def _info(self):
46
- return datasets.DatasetInfo(
47
- description=_DESCRIPTION,
48
- features=datasets.Features(
49
- {
50
- "video_id": datasets.Value("string"),
51
- "caption": datasets.features.Sequence(datasets.Value("string"))
52
- }
53
- ),
54
- supervised_keys=None,
55
- homepage=_URL_BASE,
56
- citation=_CITATION,
57
- )
58
-
59
- def _split_generators(self, dl_manager):
60
- archive_path = dl_manager.download(_DL_URL) + "data/"
61
- # (Optional) In non-streaming mode, we can extract the archive locally to have actual local audio files:
62
- local_extracted_archive = dl_manager.extract(archive_path) if not dl_manager.is_streaming else {}
63
- train_splits = [
64
- datasets.SplitGenerator(
65
- name="train",
66
- gen_kwargs={
67
- "local_extracted_archive": local_extracted_archive.get("train"),
68
- "files": dl_manager.iter_archive(archive_path["train"]),
69
- },
70
- )
71
- ]
72
- dev_splits = [
73
- datasets.SplitGenerator(
74
- name=datasets.Split.VALIDATION,
75
- gen_kwargs={
76
- "local_extracted_archive": local_extracted_archive.get("dev"),
77
- "files": dl_manager.iter_archive(archive_path["dev"]),
78
- },
79
- )
80
- ]
81
- test_splits = [
82
- datasets.SplitGenerator(
83
- name=datasets.Split.TEST,
84
- gen_kwargs={
85
- "local_extracted_archive": local_extracted_archive.get("test"),
86
- "files": dl_manager.iter_archive(archive_path["test"]),
87
- },
88
- )
89
- ]
90
- return train_splits + dev_splits + test_splits
91
-
92
- def _generate_examples(self, files, local_extracted_archive):
93
- """This function returns the examples."""
94
-
95
- with open(os.path.join(files, "tgif-v1.0.tsv"), encoding="utf-8") as tsv_file:
96
- tsv_reader = csv.reader(tsv_file, delimiter="\t", quotechar='"' )
97
- for idx, (video_link, text) in enumerate(tsv_reader):
98
- yield idx, {
99
- "video_id": video_link,
100
- "caption": text,
101
- }