Skip to content
intermediateimage

How to annotate RefCOCO

Visual grounding task where annotators bind each referring expression to a region of the image. Based on RefCOCO (Yu et al., ECCV 2016), reproduced with Potato's grounding_eval schema, which scores grounding by IoU at four thresholds and counts ungroundedness separately.

About this dataset

Referring expression comprehension, a form of visual grounding, is the task of taking an image plus a natural-language phrase that names one specific object and locating that object in the image. The RefCOCO and RefCOCO+ datasets were introduced by Licheng Yu, Patrick Poirson, Shan Yang, Alexander C. Berg, and Tamara L. Berg in "Modeling Context in Referring Expressions" at ECCV 2016. The paper studies how visual context, meaning comparison to the other objects in an image, helps both generate and understand these expressions.

The images come from MS COCO. The referring expressions were collected with the ReferItGame two-player interface (Kazemzadeh et al., EMNLP 2014): one player writes an expression for a marked object, and a second player has to click the region it describes, which keeps the expressions unambiguous. RefCOCO+ uses the same setup but forbids absolute spatial words like "left" or "right," so its expressions rely on appearance and attributes and are harder to ground.

RefCOCO contains 142,209 referring expressions for 50,000 objects across 19,994 images. RefCOCO+ contains 141,564 expressions for 49,856 objects across 19,992 images. Because the collection ran as a game where a second player had to identify the target, expressions that did not point clearly to the intended object were filtered out during play.

Potato reproduces the grounding side of this task with the grounding_eval schema, which owns the binding between each phrase and the region that answers it. An image_annotation schema sits alongside it to own the canvas, since grounding_eval does not draw. Each item carries all of its image's expressions, matching RefCOCO's structure of several expressions per object, and the annotator works through them one at a time.

Each image is grounded by two annotators, so grounding agreement has something to compare. Potato scores grounding by IoU at four thresholds and counts ungroundedness as a separate answer rather than a miss: an expression the annotator never answered is excluded from scoring, because counting it as a failure makes a model look worse the more phrases were skipped, which is a statement about the annotator rather than the model. Setting region_type to point instead of box collects Molmo-style pointing, which is scored as a point-in-region hit rate, because a point has no area and every IoU against one is zero.

RefCOCO expressions
142,209
RefCOCO objects / images
50,000 objects in 19,994 images
RefCOCO+ expressions
141,564
RefCOCO+ objects / images
49,856 objects in 19,992 images
Image source
MS COCO
Venue / Year
ECCV 2016
Labels:outdoornatureurbanpeopleanimal+

Configuration Fileconfig.yaml

This Potato config reproduces the annotation task. Save it as config.yaml and run potato start config.yaml to try it.

yaml
# yaml-language-server: $schema=https://potatoannotator.readthedocs.io/en/latest/schemas/potato-config.schema.json
#
# RefCOCO — Referring Expression Grounding
#
# Paper:   Yu, Poirson, Yang, Berg & Berg, "Modeling Context in Referring
#          Expressions", ECCV 2016 — https://arxiv.org/abs/1608.00272
# Dataset: https://github.com/lichengunc/refer
#
# Referring expression comprehension: given an image and a phrase naming one
# specific object, locate that object. RefCOCO's expressions were collected
# with the ReferItGame two-player interface (Kazemzadeh et al., EMNLP 2014),
# where a second player had to click the region the phrase described, so
# expressions that did not identify their target unambiguously were filtered
# out during play.
#
# RefCOCO:  142,209 expressions for 50,000 objects across 19,994 images.
# RefCOCO+: 141,564 expressions for 49,856 objects across 19,992 images.
#           Same setup, but absolute spatial words ("left", "right") are
#           forbidden, so expressions rely on appearance and are harder.
# Images come from MS COCO.
#
# Reproduction notes
# ------------------
# `grounding_eval` owns the phrase-to-region binding; it does not draw, so an
# `image_annotation` schema sits beside it to own the canvas. Each item carries
# every expression for its image in `expressions`, which matches RefCOCO's
# structure (several expressions per object) and means the annotator works
# through them one at a time against a single image.
#
# `region_type: box` is the RefCOCO convention. Set `point` instead to collect
# Molmo-style pointing, which Potato scores as a point-in-region hit rate
# rather than IoU — a point has no area, so IoU against one is always zero.
#
# Two annotators per item, so grounding agreement is defined. Potato scores
# grounding by IoU at four thresholds and counts ungroundedness separately.

port: 8000
annotation_task_name: "RefCOCO - Referring Expression Grounding"
task_dir: "."
output_annotation_dir: "annotation_output/"
output_annotation_format: "json"

data_files:
  - sample-data.json

item_properties:
  id_key: "id"
  text_key: "image_url"

instance_display:
  fields:
    - key: image_url
      type: image
      label: "Image"

user_config:
  allow_all_users: true
  users: []

# Grounding agreement needs at least two independent annotations per image.
num_annotators_per_item:
  default: 2

annotation_schemes:
  # The canvas. grounding_eval binds phrases to regions but does not draw them,
  # so it needs an image schema alongside it.
  - annotation_type: image_annotation
    name: region
    description: "Draw a tight box around the object the selected phrase names."
    source_field: image_url
    tools:
      - bbox
    labels:
      - name: referent
        color: "#6e56cf"

  - annotation_type: grounding_eval
    name: grounding
    description: "What does each referring expression refer to?"
    region_type: box
    expressions_field: expressions
    # Warn once before advancing with phrases still unanswered. An expression
    # the annotator never answered is excluded from scoring rather than counted
    # as a miss, so leaving one blank is not the same as saying "not present".
    require_all: false

  - annotation_type: text
    name: clarification
    description: "If an expression is ambiguous, write a clearer one. (optional)"
    placeholder: "Optional: a more precise referring expression"

annotation_instructions: |
  Each image comes with one or more referring expressions. Every expression
  names exactly one object.

  For each expression:
  1. Select it from the list.
  2. Find the object it names.
  3. Draw a tight bounding box around that object.

  Draw the box as tight as the object allows — include the whole object and as
  little else as possible.

  Expressions often disambiguate by comparison to other objects in the image
  ("the dog on the left", "the taller man"), so read the whole scene before
  deciding. RefCOCO+ expressions avoid absolute spatial words, so they lean on
  colour, size and other attributes instead.

  If an expression genuinely does not pick out anything in the image, mark it
  as not present rather than boxing your best guess.

Sample Datasample-data.json

json
[
  {
    "id": "refcoco_001",
    "image_url": "https://example.com/refcoco/park_scene_001.jpg",
    "expressions": [
      {
        "id": "refcoco_001_e1",
        "text": "the woman in the red dress standing near the fountain"
      },
      {
        "id": "refcoco_001_e2",
        "text": "the woman on the far left"
      },
      {
        "id": "refcoco_001_e3",
        "text": "the man feeding the pigeons"
      }
    ]
  },
  {
    "id": "refcoco_002",
    "image_url": "https://example.com/refcoco/bench_dogs_002.jpg",
    "expressions": [
      {
        "id": "refcoco_002_e1",
        "text": "the small brown dog on the left side of the bench"
      },
      {
        "id": "refcoco_002_e2",
        "text": "the larger dog lying down"
      },
      {
        "id": "refcoco_002_e3",
        "text": "the wooden bench"
      }
    ]
  }
]

// ... and 8 more items

Get This Design

View on GitHub

Clone or download from the repository

Quick start:

git clone https://github.com/davidjurgens/potato-showcase.git
cd potato-showcase/image/visual-grounding/refcoco-expression
potato start config.yaml

Dataset & paper

Yu et al., ECCV 2016

Citation (BibTeX)

bibtex
@inproceedings{yu2016modeling,
    title = {Modeling Context in Referring Expressions},
    author = {Yu, Licheng and Poirson, Patrick and Yang, Shan and Berg, Alexander C. and Berg, Tamara L.},
    booktitle = {European Conference on Computer Vision (ECCV)},
    year = {2016}
}

Details

Annotation Types

grounding_evalimage_annotationtext

Domain

Computer VisionNLP

Use Cases

Visual GroundingReferring Expression ComprehensionObject LocalizationVLM Evaluation

Tags

refcocovisual-groundingreferring-expressionbounding-boxeccv2016multimodalgrounding-evalpointing

Found an issue or want to improve this design?

Open an Issue