--- 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.**
> 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.