Skip to content

Click-to-Reveal Images for Click-Contingent Attention

Show a blurred image that sharpens in a circle around each click, and store where and when each annotator clicked, as in CapMIT1003 captioning.

New in v2.15.0

The click_reveal scheme shows the item's image blurred, and each click shows a sharp circle of the image around the point clicked. Potato stores every click with the click's position and time, up to a limit set in the config. The clicks record where an annotator looked for the information the annotator needed. Pair the scheme with a text scheme for a caption, or with any other question about the image.

A click-contingent display keeps a stimulus degraded and reveals only the area around each click. The order and timing of the clicks then trace where the viewer searched. Zanca et al. (2023) collected the CapMIT1003 dataset with a click-contingent display, recording each person's clicks on an image while the person wrote a caption for the image.

Configuration

The config below allows up to ten clicks on each image, then asks for a one-sentence caption. min_clicks: 1 with required: true keeps an annotator from moving on before revealing at least one area:

yaml
annotation_task_name: "Look, then describe"
task_dir: .
data_files:
  - data/scenes.jsonl
item_properties:
  id_key: id
  text_key: text
output_annotation_dir: annotation_output
user_config:
  allow_all_users: true
 
annotation_schemes:
  - annotation_type: click_reveal
    name: attention
    description: "Click the places you want to see clearly (up to 10)"
    source_field: image_url
    blur: 24
    radius: 0.05
    max_clicks: 10
    min_clicks: 1
    label_requirement:
      required: true
 
  - annotation_type: text
    name: caption
    description: "Describe the image in one sentence"
    label_requirement:
      required: true

Each line of data/scenes.jsonl names one image in the field that source_field points to:

json
{"id": "scene_1", "text": "Scene 1", "image_url": "https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=800"}

Options

click_reveal optionDefaultMeaning
namerequiredScheme name, also the key the answer is stored under
descriptionrequiredThe instruction shown above the image
source_fieldimageItem field holding the image. The value may be an http(s) URL, a path rooted at /, a file name under media_directory, or a data:image/ URL
blur24Blur of the hidden image, in CSS pixels at the displayed size, from 0 to 200
radius0.05Radius of each revealed circle, as a fraction of the image width, from 0.005 to 0.5
max_clicks10Clicks allowed per item, a whole number from 1 to 200. Clicks past the limit do nothing
min_clicks0Clicks needed before the scheme counts as answered, a whole number no larger than max_clicks
label_requirementnonerequired: true keeps the annotator on the item until the scheme counts as answered

Potato refuses to start when a setting falls outside the range given in the table.

Setting the radius from visual angle

A lab study often sets the revealed window in degrees of visual angle. The matching radius depends on how wide the image appears and how far the viewer sits. For an image shown W cm wide and viewed from D cm, a window a degrees across has a radius of D * tan(a / 2) / W. A 2-degree window on an image 30 cm wide, viewed from 60 cm, gives 60 * tan(1°) / 30, about 0.035. Because a crowdsourcing study does not control the viewing distance, report the radius of a crowdsourced study as a fraction of the image width.

Clicking

Each click on the blurred image shows a sharp circle around the point clicked, and the circle stays sharp. A line under the image counts the clicks used against max_clicks. Clicks cannot be taken back, because the annotator has already seen the revealed area. When the annotator returns to an item, the circles revealed earlier come back.

The page loads the original image and blurs the image on screen with a CSS filter. An annotator who opens the image's URL in another tab sees the whole image in focus, and the clicks then no longer show where that annotator searched.

Stored answer

The answer is a JSON string stored under the label clicks:

json
{"attention": {"clicks": "{\"clicks\": [{\"x\": 0.4125, \"y\": 0.3267, \"t\": 1840}, {\"x\": 0.6, \"y\": 0.52, \"t\": 3105}], \"width\": 800, \"height\": 533}"}}

x and y are fractions of the image, with 0 at the left or top edge. t is the time in milliseconds since the image loaded on the page view of the click. width and height give the image's natural size in pixels, and multiplying x by width gives the click's position in image pixels. When the annotator comes back to an item and adds clicks, t for the new clicks counts from the new page load.

Until the annotator reaches min_clicks, the page saves no answer for the item. On save, the server refuses an answer with more clicks than max_clicks or fewer than min_clicks. The server also refuses any click with an x or y outside 0 to 1 or a negative t.

Example

Potato's release includes a click-contingent captioning example with two images. Start the example from the root of a Potato checkout:

bash
potato start examples/image/click-reveal/config.yaml -p 8000

The example's images load from images.unsplash.com, and a browser running the example needs a network connection. Point data_files at your own items, and put local images under media_directory, before running a real study.

Further reading

For implementation details, see the source documentation.

References

  • Zanca, D., Zugarini, A., Dietz, S., Altstidl, T. R., Turban Ndjeuha, M. A., Schwinn, L., and Eskofier, B. (2023). Contrastive Language-Image Pretrained Models are Zero-Shot Human Scanpath Predictors. arXiv:2305.12380. https://arxiv.org/abs/2305.12380