CoolFace
Datasetpublic

AIML-TUDA/COCOLogic-v2

COCOLogic-V2 COCOLogic-V2 is an object-centric dataset for visual inductive reasoning on real-world images. Built on MSCOCO, it frames reasoning as a multilabel classification task over 10 compositional first-order-logic rules (object presence/absence, counting, and count comparisons). Samples of each rule are divided into different positive variants, as well as types of near-boundary (NB) negatives, and the typically easy far-from-boundary (FB) negatives. These annotations… See the full description on the dataset page: https://huggingface.co/datasets/AIML-TUDA/COCOLogic-v2.

sourceHugging Facecc-by-4.0updated 2mo agoView on Hugging Face
1likes43downloads
Dataset Card

COCOLogic-V2

COCOLogic-V2 is an object-centric dataset for visual inductive reasoning on real-world images. Built on MSCOCO, it frames reasoning as a multilabel classification task over 10 compositional first-order-logic rules (object presence/absence, counting, and count comparisons). Samples of each rule are divided into different positive variants, as well as types of near-boundary (NB) negatives, and the typically easy far-from-boundary (FB) negatives. These annotations enable automated insights for model accountability: they reveal whether a model has actually learned a logical rule or is merely exploiting coarse statistical shortcuts.

This dataset contains no images

It contains annotations only. Download MSCOCO 2017 yourself from cocodataset.org and join on file_name:

  • the train splits reference COCO train2017 (file_name = train2017/000000253444.jpg)
  • the test splits reference COCO val2017 (file_name = val2017/...)
python
import os
from datasets import load_dataset
from PIL import Image

COCO_IMAGES = "/path/to/coco/images"   # contains train2017/ and val2017/

ds = load_dataset("AIML-TUDA/COCOLogic-v2", "full", split="train")
ex = ds[0]
image = Image.open(os.path.join(COCO_IMAGES, ex["file_name"])).convert("RGB")
print(ex["sample_type"])      # per-rule: positive / near_boundary / far_from_boundary
print(ex["object_names"], ex["object_counts"])

Configs and splits

configsplitrowsimagesa row is
fulltrain25,00025,000one image
fulltest3,5003,500one image
fewshottrain240238one (rule, image) pair
fewshottest400368one (rule, image) pair

In fewshot, rows outnumber images because an image can be relevant to more than one rule.

python
full    = load_dataset("AIML-TUDA/COCOLogic-v2", "full")
fewshot = load_dataset("AIML-TUDA/COCOLogic-v2", "fewshot")

The 10 rules

#NameLogical rule`full` label column
1Signal and Ridetraffic light ∧ one of {bicycle, bus, train}label_signal_and_ride
2Double ServingExactly two categories of {bottle, cup, pizza}label_double_serving
3Herd AloneAt least two objects of the same category of {cow, elephant, sheep} ∧ no personlabel_herd_alone
4Either Dog or CarEither dog or carlabel_either_dog_or_car
5Three of a KindExactly three bowl ∨ exactly three cuplabel_three_of_a_kind
6Car MajorityMore car than truck ∧ at least one of eachlabel_car_majority
7Empty Seat(couch ∨ chair) ∧ no personlabel_empty_seat
8Single Mode TrafficExactly one category of {bicycle, motorcycle, car, bus}label_single_mode_traffic
9Personal Transportperson ∧ (either bicycle or car)label_personal_transport
10Surf TripExactly as many person as surfboard ∧ at least one of eachlabel_surf_trip

Rule r (1-based) corresponds to index r - 1 in every per-rule vector column (labels, sample_type, boundary_type, rule_variants).

Sample taxonomy: variants, NB, FB

Every sample is categorized per rule into one of three groups:

  • Positive variants — the distinct ways a rule can be satisfied. Each rule is converted to disjunctive normal form (DNF); each disjunct is one positive variant. The full positive set is the union of all variants. Variants are numbered from 1 (rule 8 has 4; an image may satisfy more than one).
  • Near-boundary (NB) negatives — hard negatives derived from a DNF disjunct by flipping a single literal (or, for counting rules, by changing the required object count). These sit just outside the rule and are the key probe of true rule understanding. NB types are numbered from 1 (up to 6).
  • Far-from-boundary (FB) negatives — easy negatives drawn from the remaining MSCOCO images, kept so the overall distribution stays close to MSCOCO's.

Worked example — "Double Serving" (exactly two of bottle, cup, pizza): positive variants are bottle ∧ cup ∧ ¬pizza, bottle ∧ pizza ∧ ¬cup, cup ∧ pizza ∧ ¬bottle; NB types are the three single-category cases plus the all-three case.

sample_type contains a coarse distinction between positive, near_boundary and far_from_boundary, while boundary_type contains the specific near_boundary type of the sample.

Columns

Both configs share this per-image block:

columntypemeaning
labelslist[int8] (10)per-rule binary label, index r-1 ↔ rule r
sample_typelist[string] (10)per-rule positive / near_boundary / far_from_boundary
rule_variantslist[list[int8]] (10)per-rule 1-based variant ids; non-empty iff the label is 1
boundary_typelist[int8] (10)per-rule NB type; only meaningful for negatives
category_countslist[int16] (91)object counts indexed by COCO category id; slot 0 and the 10 unused ids (12, 26, 29, 30, 45, 66, 68, 69, 71, 83) are always 0
object_nameslist[string]names of the non-zero categories, ascending category id
object_countslist[int16]counts aligned with object_names
n_objectsint32sum(category_counts)

full adds image_id, image_index, file_name, and the 10 boolean label_<rule> columns (the exploded form of labels, so the viewer can filter and sort per rule).

fewshot adds the rule the row belongs to, and the per-image block specialized to that rule:

columntypemeaning
rule_id / rule_nameint8 / string1..10, e.g. Single Mode Traffic
rule_sample_typestringpositive / near_boundary / far_from_boundary — the scalar form of sample_type[rule_id - 1]
group_indexint8which group within that type: the variant number for positive, the NB type for near_boundary, 0 for far_from_boundary (which has no groups)
group_positionint32position within that group, preserving source order
rule_labelint8labels[rule_id - 1]
rule_variant_idslist[int8]rule_variants[rule_id - 1]
rule_boundary_typeint8boundary_type[rule_id - 1]

Few-shot / in-context learning

The fewshot config is the task definition: it states which images are relevant for evaluating each rule. Each rule gets 24 train examples (8 positive + 16 negative) and 40 test examples (20 + 20). Reconstruct one rule's task with a single filter — no join needed, since each row already carries its image's metadata:

python
fs = load_dataset("AIML-TUDA/COCOLogic-v2", "fewshot", split="train")
rule_8 = fs.filter(lambda x: x["rule_id"] == 8)
positives = rule_8.filter(lambda x: x["rule_sample_type"] == "positive")
negatives = rule_8.filter(lambda x: x["rule_sample_type"] != "positive")

Note rule 4 ("Either Dog or Car") has no far-from-boundary examples — all of its negatives are near-boundary.

The few-shot version assumes a working perception module: images are manually curated so that the relevant objects are clearly visible and the labels are correct. It is intended for few-shot / in-context rule learning, not for training perception from scratch.

Source JSON files

The four original JSONs (cocologic_{train,test}[_fewshot].json) sit at the repo root, byte-for-byte as the code repository reads them. The parquet configs above are generated from them and round-trip back to them exactly.

Note the rules block of the full JSONs is not exported to parquet: its integers are not COCO image ids but positional indices into the source COCO split's candidate pools, recorded before subsampling (and one group, rule_7.near_boundary[2] in train, mixes raw ids into that index space). The per-image labels / rule_variants / boundary_type fields carry the same information, are self-consistent, and are in real COCO id space. The rules block of the fewshot JSONs does use real COCO image ids and is exported as the fewshot config.

Row order

Parquet row order matches the source JSON key order, and image_index records it. This matters only if you reuse the precomputed tensors from the code repository, which are index-aligned to that order.

Licensing

The COCOLogic-V2 annotations are released under CC BY 4.0, consistent with the MSCOCO annotations they are derived from (© COCO Consortium). Images are not redistributed here; they remain subject to the COCO terms of use and the Flickr terms for the individual photographs. Please cite both COCO and COCOLogic-V2.

Citation

bibtex
@article{steinmann2026cocologic,
  title={COCOLogic-V2: Identifying Logical Inconsistencies via Truly Hard-Negatives},
  author={Steinmann, David and W{\"u}st, Antonia and Kersting, Kristian and Stammer, Wolfgang},
  journal={arXiv preprint arXiv:2606.28194},
  year={2026}
}


@inproceedings{lin2014microsoft,
  title={Microsoft coco: Common objects in context},
  author={Lin, Tsung-Yi and Maire, Michael and Belongie, Serge and Hays, James and Perona, Pietro and Ramanan, Deva and Doll{\'a}r, Piotr and Zitnick, C Lawrence},
  booktitle={European conference on computer vision},
  pages={740--755},
  year={2014},
  organization={Springer}
}