phiyodr commited on
Commit
57caa61
1 Parent(s): d1e8248

Init README

Browse files
Files changed (1) hide show
  1. README.md +70 -0
README.md ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - en
4
+ pretty_name: COCO2017
5
+ size_categories:
6
+ - 100K<n<1M
7
+ task_categories:
8
+ - image-to-text
9
+ task_ids:
10
+ - image-captioning
11
+ tags:
12
+ - coco
13
+ - image-captioning
14
+ ---
15
+ # coco2017
16
+
17
+ Image-text pairs from [COCO2017](https://cocodataset.org/#download).
18
+
19
+ ## Data origin
20
+
21
+ * Data originates from [cocodataset.org](http://images.cocodataset.org/annotations/annotations_trainval2017.zip)
22
+ * While `coco-karpathy` uses a dense format (with several sentences and sendids per row), `coco-karpathy-long` uses a long format with one `sentence` (aka caption) and `sendid` per row. `coco-karpathy-long` uses the first five sentences and therefore is five times as long as `coco-karpathy`.
23
+ * `phiyodr/coco2017`: One row corresponds one image with several sentences.
24
+ * `phiyodr/coco2017-long`: One row correspond one sentence (aka caption). There are 5 rows (sometimes more) with the same image details.
25
+
26
+ ## Format
27
+
28
+ ```python
29
+ DatasetDict({
30
+ train: Dataset({
31
+ features: ['license', 'file_name', 'coco_url', 'height', 'width', 'date_captured', 'flickr_url', 'image_id', 'ids', 'captions'],
32
+ num_rows: 118287
33
+ })
34
+ validation: Dataset({
35
+ features: ['license', 'file_name', 'coco_url', 'height', 'width', 'date_captured', 'flickr_url', 'image_id', 'ids', 'captions'],
36
+ num_rows: 5000
37
+ })
38
+ })
39
+ ```
40
+
41
+ ## Usage
42
+
43
+ * Download image data and unzip
44
+
45
+ ```bash
46
+ cd PATH_TO_FOLDER
47
+
48
+ wget http://images.cocodataset.org/zips/train2017.zip
49
+ wget http://images.cocodataset.org/zips/val2017.zip
50
+ #wget http://images.cocodataset.org/annotations/annotations_trainval2017.zip # zip not needed: everything you need is in load_dataset("phiyodr/coco2017")
51
+
52
+ unzip train2017.zip
53
+ unzip val2017.zip
54
+ ```
55
+
56
+ * Load dataset in Python
57
+
58
+ ```python
59
+ import os
60
+ from datasets import load_dataset
61
+ PATH_TO_IMAGE_FOLDER = "COCO2017"
62
+
63
+ def create_full_path(example):
64
+ """Create full path to image using `base_path` to COCO2017 folder."""
65
+ example["image_path"] = os.path.join(PATH_TO_IMAGE_FOLDER, example["filepath"], example["filename"])
66
+ return example
67
+
68
+ dataset = load_dataset("phiyodr/coco2017")
69
+ dataset = dataset.map(create_full_path)
70
+ ```