Urban-ImageNet / Sample Dataset /Sample Dataset-README.md
Yiwei-Ou's picture
Upload folder using huggingface_hub
c10de6e verified
|
Raw
History Blame Contribute Delete
16.6 kB
---
license: cc-by-nc-sa-4.0
pretty_name: Urban-ImageNet β€” Sample Dataset
task_categories:
- image-classification
- image-to-text
- text-to-image
- zero-shot-image-classification
- image-segmentation
modalities:
- image
- text
language:
- zh
- en
size_categories:
- n<1K
tags:
- urban-perception
- social-media
- weibo
- image-text-retrieval
- instance-segmentation
- computational-urban-studies
- urban-ai
- chinese-cities
- husic
- cross-modal-retrieval
- multi-modal
- scene-classification
- urban-space-perception
- sample-dataset
---
# πŸ™οΈ Urban-ImageNet β€” Sample Dataset
**A balanced 100-image quality-inspection sample drawn from the Urban-ImageNet 100K benchmark, covering all three annotation tasks.**
<p align="center">
<a href="https://arxiv.org/abs/2605.09936"><img src="https://img.shields.io/badge/arXiv-2605.09936-b31b1b.svg" alt="arXiv"/></a>
<a href="https://github.com/yiasun/dataset-2"><img src="https://img.shields.io/badge/GitHub-yiasun%2Fdataset--2-black?logo=github" alt="GitHub"/></a>
<a href="https://huggingface.co/datasets/Yiwei-Ou/Urban-ImageNet"><img src="https://img.shields.io/badge/πŸ€—%20Full%20Dataset-Urban--ImageNet-yellow" alt="Full Dataset"/></a>
</p>
> This repository is a **compact, self-contained sample** of Urban-ImageNet, designed to let anyone quickly inspect data quality, annotation completeness, and label fidelity without downloading the 100K large corpus (6+ GB). It faithfully mirrors the structure, format, and annotation conventions of the 100K benchmark across all three tasks.
---
## Overview
Urban-ImageNet is a large-scale multi-modal dataset for urban space perception (see the [full dataset page](https://huggingface.co/datasets/Yiwei-Ou/Urban-ImageNet) and [paper](https://arxiv.org/abs/2605.09936) for complete documentation). This sample repository provides:
- **100 images** β€” 10 HUSIC classes Γ— 10 images per class, drawn from the **training split** of the 100K dataset.
- **Complete Task 1 labels** β€” images stored in `ImageFolder`-compatible class subdirectories.
- **Complete Task 2 annotations** β€” the corresponding 100 rows from the 100K text-image pairs file, with all metadata columns preserved.
- **Complete Task 3 annotations** β€” a filtered COCO-format JSON containing all instance segmentation masks for the 100 images.
- **Instance mask visualisations** β€” side-by-side original / coloured-mask / legend images for every one of the 100 images.
This sample represents approximately **0.1%** of the 100K benchmark by image count and is strictly class-balanced, making it representative of the 100K dataset's overall structure and label distribution.
---
## How the Sample Was Created
The sample was constructed through the following transparent, reproducible procedure:
1. **Source pool:** The **training split** of the Urban-ImageNet 100K balanced benchmark (80,000 images; 8,000 per HUSIC class).
2. **Stratified random sampling:** For each of the 10 HUSIC classes, **10 images were drawn uniformly at random** without replacement, independently per class, guaranteeing strict class balance (10 images Γ— 10 classes = 100 images total).
3. **Privacy verification:** All selected images had already undergone automated face blurring, licence-plate blurring, and QR-code blurring as part of the full dataset pipeline. The 100 selected images were additionally subject to **manual human inspection** to confirm that all privacy-sensitive regions are fully obscured before inclusion in this sample.
4. **Annotation extraction:**
- **T1:** Images placed into their HUSIC class subdirectory β€” no additional annotation step required.
- **T2:** The 100 `Image Filename` values were used to filter rows from the 100K `train.xlsx` file. All original metadata columns are preserved without modification.
- **T3:** The 100 image filenames were used to filter entries from the 100K COCO annotation file, extracting all matching `images` entries and their associated `annotations`. Image IDs and annotation IDs are re-indexed sequentially within the sample file.
5. **Mask visualisation generation:** For each of the 100 images, a side-by-side visualisation was rendered using a standard pipeline. Each visualisation shows: left panel β€” original image; right panel β€” instance mask overlay with per-instance colour coding; right margin β€” colour-coded legend of detected object labels.
---
## File Structure
```
Sample Dataset/
β”‚
β”œβ”€β”€ 01 Images with labels/ ← Task 1: Scene Classification
β”‚ β”œβ”€β”€ Exterior urban spaces with people/ (10 images)
β”‚ β”œβ”€β”€ Exterior urban spaces without people/ (10 images)
β”‚ β”œβ”€β”€ Food or drink items/ (10 images)
β”‚ β”œβ”€β”€ Hotel or commercial lodging spaces/ (10 images)
β”‚ β”œβ”€β”€ Human-centered portrait/ (10 images)
β”‚ β”œβ”€β”€ Interior urban spaces with people/ (10 images)
β”‚ β”œβ”€β”€ Interior urban spaces without people/ (10 images)
β”‚ β”œβ”€β”€ Other non-spatial content/ (10 images)
β”‚ β”œβ”€β”€ Private home interiors/ (10 images)
β”‚ └── Retail products and merchandise/ (10 images)
β”‚ ────────────────────
β”‚ Total: 100 images
β”‚
β”œβ”€β”€ 02 Text-Image Pairs/ ← Task 2: Cross-Modal Retrieval
β”‚ └── Sample Dataset Paired Texts.xlsx
β”‚
└── 03 Instance Segmentation/ ← Task 3: Instance Segmentation
β”œβ”€β”€ Sample Dataset Annotations.json
└── Visualization of instance labels/
β”œβ”€β”€ Exterior urban spaces with people/ (10 visualisations)
β”œβ”€β”€ Exterior urban spaces without people/ (10 visualisations)
β”œβ”€β”€ Food or drink items/ (10 visualisations)
β”œβ”€β”€ Hotel or commercial lodging spaces/ (10 visualisations)
β”œβ”€β”€ Human-centered portrait/ (10 visualisations)
β”œβ”€β”€ Interior urban spaces with people/ (10 visualisations)
β”œβ”€β”€ Interior urban spaces without people/ (10 visualisations)
β”œβ”€β”€ Other non-spatial content/ (10 visualisations)
β”œβ”€β”€ Private home interiors/ (10 visualisations)
└── Retail products and merchandise/ (10 visualisations)
```
> **Image format:** All images are JPEG, privacy-protected (faces, licence plates, and QR codes blurred), resized to a maximum long edge of 512 px.
---
## Correspondence Between Files
All three annotation modalities share a common **image filename key** in the format `{UserID}_{PostTime}_{Index}` (e.g., `1197195715_2023εΉ΄12月15ζ—₯_5`). The table below shows how each component references this key:
| Component | Key field | Example value |
|-----------|-----------|---------------|
| `01 Images with labels/{class}/` | Filename stem (without `.jpg`) | `1197195715_2023εΉ΄12月15ζ—₯_5.jpg` |
| `Sample Dataset Paired Texts.xlsx` | `Image Filename` column | `1197195715_2023εΉ΄12月15ζ—₯_5` |
| `Sample Dataset Annotations.json` | `images[].file_name` | `1197195715_2023εΉ΄12月15ζ—₯_5.jpg` |
| `Visualization of instance labels/{class}/` | Filename stem (without `.jpg`) | `1197195715_2023εΉ΄12月15ζ—₯_5.jpg` |
---
## Task 1: Scene Classification Labels
Images are stored in an `ImageFolder`-compatible layout. The subdirectory name is the ground-truth HUSIC label, directly loadable with standard PyTorch or TensorFlow pipelines:
```python
from torchvision.datasets import ImageFolder
dataset = ImageFolder(root="Sample Dataset/01 Images with labels")
# dataset.classes β†’ ['Exterior urban spaces with people', ...]
# dataset.class_to_idx β†’ {'Exterior urban spaces with people': 0, ...}
print(len(dataset)) # 100
```
The 10 HUSIC classes (integer IDs assigned by `ImageFolder`'s lexicographic sort):
| Class ID | Class Label |
|---------:|-------------|
| 0 | Exterior urban spaces with people |
| 1 | Exterior urban spaces without people |
| 2 | Food or drink items |
| 3 | Hotel or commercial lodging spaces |
| 4 | Human-centered portrait |
| 5 | Interior urban spaces with people |
| 6 | Interior urban spaces without people |
| 7 | Other non-spatial content |
| 8 | Private home interiors |
| 9 | Retail products and merchandise |
> **Note:** In the full Urban-ImageNet dataset, HUSIC class IDs 0–9 follow the theoretical ordering (exterior-before-interior, spatial-before-non-spatial). When loading with `ImageFolder`, always use `class_to_idx` to map label strings to IDs rather than assuming a fixed integer correspondence.
---
## Task 2: Text-Image Pair Metadata
`Sample Dataset Paired Texts.xlsx` contains **100 rows** β€” one per image β€” with all metadata columns from the original 100K dataset preserved without modification.
### Column Schema
| Column | Type | Description |
|--------|------|-------------|
| `Image Label` | string | HUSIC class label |
| `Image Filename` | string | Join key linking to image file and T3 annotation |
| `Post ID` | integer | Anonymised numerical post identifier |
| `User ID` | integer | Anonymised numerical user identifier |
| `Post Time` | string | Original post timestamp |
| `Post Text` | string | Original Weibo post text (Chinese, unmodified) |
| `City` | string | City of the location tag |
| `Place Tag` | string | Location hashtag / commercial-site place tag |
| `Posting Tool` | string | Client or posting-source string |
| `Mentioned Users` | string | Anonymised or empty mentioned-user field |
| `Extracted Topics` | string | Topic / hashtag terms extracted from post text |
| `Extracted Locations` | string | Location mentions extracted from post text |
| `Like Count` | integer | Public engagement count at collection time |
| `Repost Count` | integer | Public repost count at collection time |
| `Comment Count` | integer | Public comment count at collection time |
> `Post Text` retains original Chinese to preserve linguistic authenticity for Task 2 evaluation. All columns retain the original data types and formatting from the 100K source file.
---
## Task 3: Instance Segmentation Annotations
`Sample Dataset Annotations.json` uses the same extended COCO format as the full Urban-ImageNet dataset.
### JSON Structure
```json
{
"info": {
"description": "Urban-ImageNet Instance Segmentation Annotations",
"split": "train",
"version": "1.0",
"annotation_tool": "Grounding DINO + SAM2"
},
"categories": [
{"id": 0, "name": "Exterior urban spaces with people"},
...
],
"images": [
{
"id": 0,
"file_name": "1197195715_2023εΉ΄12月15ζ—₯_5.jpg",
"width": 512,
"height": 384,
"classification_label": 0
}
],
"annotations": [
{
"id": 0,
"image_id": 0,
"category_id": 0,
"detected_label": "person",
"detection_score": 0.8732,
"bbox": [x, y, width, height],
"area": 4512,
"segmentation": {"counts": "...", "size": [384, 512]},
"iscrowd": 0
}
]
}
```
**Extended fields beyond standard COCO:**
- `classification_label` *(in `images`)*: HUSIC class ID β€” enables multi-task joint training.
- `detected_label` *(in `annotations`)*: the specific object term detected by Grounding DINO (e.g., `"escalator"`, `"retail shelf"`, `"hotel bed"`).
- `detection_score` *(in `annotations`)*: Grounding DINO confidence score, enabling threshold-based downstream filtering.
- Segmentation masks are stored in **COCO RLE format**, directly compatible with `pycocotools`.
### Instance Mask Visualisations
The `Visualization of instance labels/` subfolder provides a visual verification of every annotation in this sample. Each visualisation image shows:
- **Left half:** the original image.
- **Right half:** the same image with coloured per-instance mask overlays (each unique instance receives a distinct colour).
- **Right margin:** a colour-coded legend listing the `detected_label` for each coloured mask.
Visualisation filenames match their source images exactly (e.g., `1197195715_2023εΉ΄12月15ζ—₯_5.jpg`), within the same class subdirectory, enabling direct one-to-one correspondence without any filename transformation.
---
## Relationship to the Full Dataset
| Property | This Sample | 100K Benchmark |
|----------|-------------|----------------|
| Images | 100 | 100,000 |
| Classes | 10 | 10 |
| Images per class | 10 | 10,000 |
| Source split | train only | train / val / test |
| T1 labels | βœ… | βœ… |
| T2 text metadata | βœ… 100 rows | βœ… 80K / 10K / 10K rows |
| T3 instance annotations | βœ… filtered JSON | βœ… train / val / test JSON |
| T3 visualisations | βœ… all 100 images | βœ… selected examples |
| Privacy protection | βœ… automated + manual review | βœ… automated + manual review |
| File format & schema | Identical to full dataset | β€” |
Code written against this sample runs unchanged on the full dataset by substituting the root path.
---
## Quick-Start
```python
import json
import pandas as pd
from pathlib import Path
from torchvision.datasets import ImageFolder
root = Path("Sample Dataset")
# ── Task 1 ──────────────────────────────────────────────────────────────
dataset = ImageFolder(root=root / "01 Images with labels")
print(dataset.classes) # 10 HUSIC class names
print(len(dataset)) # 100
# ── Task 2 ──────────────────────────────────────────────────────────────
df = pd.read_excel(root / "02 Text-Image Pairs" / "Sample Dataset Paired Texts.xlsx")
print(df.shape) # (100, 15)
print(df["Post Text"].iloc[0]) # Chinese post text
# ── Task 3 ──────────────────────────────────────────────────────────────
with open(root / "03 Instance Segmentation" / "Sample Dataset Annotations.json") as f:
coco = json.load(f)
print(f"Images: {len(coco['images'])}") # 100
print(f"Annotations: {len(coco['annotations'])}") # typically 500–1500
# Join image filename β†’ annotations
img_id_map = {img["file_name"]: img["id"] for img in coco["images"]}
ann_by_img = {}
for ann in coco["annotations"]:
ann_by_img.setdefault(ann["image_id"], []).append(ann)
```
---
## Privacy and Responsible Use
All images are derived from **public Weibo posts** and have undergone:
- Automated face detection and blurring (all detected faces).
- Automated licence-plate detection and blurring.
- Automated QR-code detection and blurring, supplemented by manual spot-checks.
- **Additional manual human review** of all 100 sample images, confirming complete protection of all privacy-sensitive regions.
Original usernames have been replaced with opaque numerical identifiers. Images are released at ≀ 512 px long edge. Use is restricted to **non-commercial academic research**. Re-identification, biometric profiling, facial recognition, and surveillance applications are strictly prohibited. See the [full dataset page](https://huggingface.co/datasets/Yiwei-Ou/Urban-ImageNet) for the complete data-use agreement.
---
## Citation
```bibtex
@article{ou2026urbanimagenet,
title = {Urban-ImageNet: A Large-Scale Multi-Modal Dataset and Evaluation Framework for Urban Space Perception},
author = {Ou, Yiwei and Cheung, Chung Ching and Ang, Jun Yang and Ren, Xiaobin and Sun, Ronggui and Gao, Guansong and Zhao, Kaiqi and Manfredini, Manfredo},
journal = {arXiv preprint arXiv:2605.09936},
year = {2026},
eprint = {2605.09936},
archivePrefix = {arXiv},
primaryClass = {cs.CV},
url = {https://arxiv.org/abs/2605.09936}
}
```
**Paper:** [arXiv:2605.09936](https://arxiv.org/abs/2605.09936)
**Full Dataset:** [huggingface.co/datasets/Yiwei-Ou/Urban-ImageNet](https://huggingface.co/datasets/Yiwei-Ou/Urban-ImageNet)
**Benchmark code:** [github.com/yiasun/dataset-2](https://github.com/yiasun/dataset-2)
---
## License
Released under **Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)**.
Non-commercial academic research use only. See [LICENSE](https://creativecommons.org/licenses/by-nc-sa/4.0/) for full terms.