Datasets:
Tasks:
Image Classification
Formats:
parquet
Sub-tasks:
multi-label-image-classification
Languages:
English
Size:
10K - 100K
ArXiv:
License:
| pretty_name: COCOLogic-V2 | |
| license: cc-by-4.0 | |
| language: | |
| - en | |
| source_datasets: | |
| - extended|coco | |
| task_categories: | |
| - image-classification | |
| task_ids: | |
| - multi-label-image-classification | |
| size_categories: | |
| - 10K<n<100K | |
| tags: | |
| - coco | |
| - metadata-only | |
| - visual-reasoning | |
| - neuro-symbolic | |
| - logic | |
| - hard-negatives | |
| - in-context-learning | |
| configs: | |
| - config_name: full | |
| data_files: | |
| - split: train | |
| path: full/train-*.parquet | |
| - split: test | |
| path: full/test-*.parquet | |
| - config_name: fewshot | |
| data_files: | |
| - split: train | |
| path: fewshot/train-*.parquet | |
| - split: test | |
| path: fewshot/test-*.parquet | |
| dataset_info: | |
| - config_name: full | |
| features: | |
| - name: image_id | |
| dtype: int64 | |
| - name: image_index | |
| dtype: int32 | |
| - name: file_name | |
| dtype: string | |
| - name: label_signal_and_ride | |
| dtype: bool | |
| - name: label_double_serving | |
| dtype: bool | |
| - name: label_herd_alone | |
| dtype: bool | |
| - name: label_either_dog_or_car | |
| dtype: bool | |
| - name: label_three_of_a_kind | |
| dtype: bool | |
| - name: label_car_majority | |
| dtype: bool | |
| - name: label_empty_seat | |
| dtype: bool | |
| - name: label_single_mode_traffic | |
| dtype: bool | |
| - name: label_personal_transport | |
| dtype: bool | |
| - name: label_surf_trip | |
| dtype: bool | |
| - name: labels | |
| sequence: int8 | |
| - name: rule_variants | |
| sequence: | |
| sequence: int8 | |
| - name: boundary_type | |
| sequence: int8 | |
| - name: sample_type | |
| sequence: string | |
| - name: category_counts | |
| sequence: int16 | |
| - name: object_names | |
| sequence: string | |
| - name: object_counts | |
| sequence: int16 | |
| - name: n_objects | |
| dtype: int32 | |
| splits: | |
| - name: train | |
| num_examples: 25000 | |
| - name: test | |
| num_examples: 3500 | |
| - config_name: fewshot | |
| features: | |
| - name: rule_id | |
| dtype: int8 | |
| - name: rule_name | |
| dtype: string | |
| - name: rule_sample_type | |
| dtype: string | |
| - name: group_index | |
| dtype: int8 | |
| - name: group_position | |
| dtype: int32 | |
| - name: image_id | |
| dtype: int64 | |
| - name: image_index | |
| dtype: int32 | |
| - name: file_name | |
| dtype: string | |
| - name: rule_label | |
| dtype: int8 | |
| - name: rule_variant_ids | |
| sequence: int8 | |
| - name: rule_boundary_type | |
| dtype: int8 | |
| - name: labels | |
| sequence: int8 | |
| - name: rule_variants | |
| sequence: | |
| sequence: int8 | |
| - name: boundary_type | |
| sequence: int8 | |
| - name: sample_type | |
| sequence: string | |
| - name: category_counts | |
| sequence: int16 | |
| - name: object_names | |
| sequence: string | |
| - name: object_counts | |
| sequence: int16 | |
| - name: n_objects | |
| dtype: int32 | |
| splits: | |
| - name: train | |
| num_examples: 240 | |
| - name: test | |
| num_examples: 400 | |
| # 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](https://cocodataset.org/#download) 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 | |
| | config | split | rows | images | a row is | | |
| |---|---|---:|---:|---| | |
| | `full` | train | 25,000 | 25,000 | one image | | |
| | `full` | test | 3,500 | 3,500 | one image | | |
| | `fewshot` | train | 240 | 238 | one (rule, image) pair | | |
| | `fewshot` | test | 400 | 368 | one (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 | |
| | # | Name | Logical rule | `full` label column | | |
| |---|------|--------------|---------------------| | |
| | 1 | Signal and Ride | `traffic light ∧ one of {bicycle, bus, train}` | `label_signal_and_ride` | | |
| | 2 | Double Serving | `Exactly two categories of {bottle, cup, pizza}` | `label_double_serving` | | |
| | 3 | Herd Alone | `At least two objects of the same category of {cow, elephant, sheep} ∧ no person` | `label_herd_alone` | | |
| | 4 | Either Dog or Car | `Either dog or car` | `label_either_dog_or_car` | | |
| | 5 | Three of a Kind | `Exactly three bowl ∨ exactly three cup` | `label_three_of_a_kind` | | |
| | 6 | Car Majority | `More car than truck ∧ at least one of each` | `label_car_majority` | | |
| | 7 | Empty Seat | `(couch ∨ chair) ∧ no person` | `label_empty_seat` | | |
| | 8 | Single Mode Traffic | `Exactly one category of {bicycle, motorcycle, car, bus}` | `label_single_mode_traffic` | | |
| | 9 | Personal Transport | `person ∧ (either bicycle or car)` | `label_personal_transport` | | |
| | 10 | Surf Trip | `Exactly as many person as surfboard ∧ at least one of each` | `label_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: | |
| | column | type | meaning | | |
| |---|---|---| | |
| | `labels` | `list[int8]` (10) | per-rule binary label, index `r-1` ↔ rule `r` | | |
| | `sample_type` | `list[string]` (10) | per-rule `positive` / `near_boundary` / `far_from_boundary` | | |
| | `rule_variants` | `list[list[int8]]` (10) | per-rule 1-based variant ids; non-empty iff the label is 1 | | |
| | `boundary_type` | `list[int8]` (10) | per-rule NB type; **only meaningful for negatives** | | |
| | `category_counts` | `list[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_names` | `list[string]` | names of the non-zero categories, ascending category id | | |
| | `object_counts` | `list[int16]` | counts aligned with `object_names` | | |
| | `n_objects` | `int32` | `sum(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*: | |
| | column | type | meaning | | |
| |---|---|---| | |
| | `rule_id` / `rule_name` | `int8` / `string` | 1..10, e.g. `Single Mode Traffic` | | |
| | `rule_sample_type` | `string` | `positive` / `near_boundary` / `far_from_boundary` — the scalar form of `sample_type[rule_id - 1]` | | |
| | `group_index` | `int8` | *which* 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_position` | `int32` | position within that group, preserving source order | | |
| | `rule_label` | `int8` | `labels[rule_id - 1]` | | |
| | `rule_variant_ids` | `list[int8]` | `rule_variants[rule_id - 1]` | | |
| | `rule_boundary_type` | `int8` | `boundary_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](https://cocodataset.org/#termsofuse) 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} | |
| } | |
| ``` | |