x-lai commited on
Commit
1950394
·
1 Parent(s): f5d6e02

Update cocostuff processing

Browse files

Former-commit-id: 28bae6d46e54331a42544fe5239ad3cee2653117

Files changed (2) hide show
  1. README.md +4 -3
  2. utils/sem_seg_dataset.py +7 -7
README.md CHANGED
@@ -109,9 +109,9 @@ pip install -r requirements.txt
109
  ### Training Data Preparation
110
  The training data consists of 4 types of data:
111
 
112
- 1. Semantic segmentation datasets: [ADE20K](http://data.csail.mit.edu/places/ADEchallenge/ADEChallengeData2016.zip), COCO-Stuff [\[images\]](http://images.cocodataset.org/zips/train2017.zip) [\[labels\]](http://calvin.inf.ed.ac.uk/wp-content/uploads/data/cocostuffdataset/stuffthingmaps_trainval2017.zip), [Mapillary](https://www.mapillary.com/dataset/vistas), [PACO-LVIS](https://github.com/facebookresearch/paco/tree/main#dataset-setup), [PASCAL-Part](https://github.com/facebookresearch/VLPart/tree/main/datasets#pascal-part)
113
 
114
- Note: For COCO-Stuff, we use the annotation file stuffthingmaps_trainval2017.zip. We only use the PACO-LVIS part in PACO.
115
 
116
  3. Referring segmentation datasets: [refCOCO](https://web.archive.org/web/20220413011718/https://bvisionweb1.cs.unc.edu/licheng/referit/data/refcoco.zip), [refCOCO+](https://web.archive.org/web/20220413011656/https://bvisionweb1.cs.unc.edu/licheng/referit/data/refcoco+.zip), [refCOCOg](https://web.archive.org/web/20220413012904/https://bvisionweb1.cs.unc.edu/licheng/referit/data/refcocog.zip), [refCLEF](https://web.archive.org/web/20220413011817/https://bvisionweb1.cs.unc.edu/licheng/referit/data/refclef.zip) ([saiapr_tc-12](https://web.archive.org/web/20220515000000/http://bvisionweb1.cs.unc.edu/licheng/referit/data/images/saiapr_tc-12.zip))
117
 
@@ -130,9 +130,10 @@ Download them from the above links, and organize them as follows.
130
  │   │   └── images
131
  │   ├── coco
132
  │   │   └── train2017
 
 
133
  │   ├── cocostuff
134
  │   │   └── train2017
135
- │   │   ├── 000000000009.jpg
136
  │   │   ├── 000000000009.png
137
  │   │   └── ...
138
  │   ├── llava_dataset
 
109
  ### Training Data Preparation
110
  The training data consists of 4 types of data:
111
 
112
+ 1. Semantic segmentation datasets: [ADE20K](http://data.csail.mit.edu/places/ADEchallenge/ADEChallengeData2016.zip), [COCO-Stuff](http://calvin.inf.ed.ac.uk/wp-content/uploads/data/cocostuffdataset/stuffthingmaps_trainval2017.zip), [Mapillary](https://www.mapillary.com/dataset/vistas), [PACO-LVIS](https://github.com/facebookresearch/paco/tree/main#dataset-setup), [PASCAL-Part](https://github.com/facebookresearch/VLPart/tree/main/datasets#pascal-part), [COCO Images](http://images.cocodataset.org/zips/train2017.zip)
113
 
114
+ Note: For COCO-Stuff, we use the annotation file stuffthingmaps_trainval2017.zip. We only use the PACO-LVIS part in PACO. COCO Images should be put into the `coco` directory.
115
 
116
  3. Referring segmentation datasets: [refCOCO](https://web.archive.org/web/20220413011718/https://bvisionweb1.cs.unc.edu/licheng/referit/data/refcoco.zip), [refCOCO+](https://web.archive.org/web/20220413011656/https://bvisionweb1.cs.unc.edu/licheng/referit/data/refcoco+.zip), [refCOCOg](https://web.archive.org/web/20220413012904/https://bvisionweb1.cs.unc.edu/licheng/referit/data/refcocog.zip), [refCLEF](https://web.archive.org/web/20220413011817/https://bvisionweb1.cs.unc.edu/licheng/referit/data/refclef.zip) ([saiapr_tc-12](https://web.archive.org/web/20220515000000/http://bvisionweb1.cs.unc.edu/licheng/referit/data/images/saiapr_tc-12.zip))
117
 
 
130
  │   │   └── images
131
  │   ├── coco
132
  │   │   └── train2017
133
+ │   │   ├── 000000000009.jpg
134
+ │   │   └── ...
135
  │   ├── cocostuff
136
  │   │   └── train2017
 
137
  │   │   ├── 000000000009.png
138
  │   │   └── ...
139
  │   ├── llava_dataset
utils/sem_seg_dataset.py CHANGED
@@ -80,15 +80,15 @@ def init_cocostuff(base_image_dir):
80
  cocostuff_classes.append(line.strip().split(": ")[-1])
81
  cocostuff_classes = np.array(cocostuff_classes)
82
  cocostuff_images = []
83
- cocostuff_image_dir = glob.glob(
84
- os.path.join(base_image_dir, "cocostuff", "train2017", "*.jpg")
 
85
  )
86
- for image_id in cocostuff_image_dir:
87
- cocostuff_images.append(image_id)
88
- cocostuff_labels = [
89
- x.replace(".jpg", ".png").replace("images", "annotations")
90
- for x in cocostuff_images
91
  ]
 
92
  print("cocostuff: ", len(cocostuff_images))
93
  return cocostuff_classes, cocostuff_images, cocostuff_labels
94
 
 
80
  cocostuff_classes.append(line.strip().split(": ")[-1])
81
  cocostuff_classes = np.array(cocostuff_classes)
82
  cocostuff_images = []
83
+
84
+ cocostuff_labels = glob.glob(
85
+ os.path.join(base_image_dir, "cocostuff", "train2017", "*.png")
86
  )
87
+ cocostuff_images = [
88
+ x.replace(".png", ".jpg").replace("cocostuff", "coco")
89
+ for x in cocostuff_labels
 
 
90
  ]
91
+
92
  print("cocostuff: ", len(cocostuff_images))
93
  return cocostuff_classes, cocostuff_images, cocostuff_labels
94