Datasets:
Formats:
json
Languages:
English
Size:
< 1K
Tags:
hotel-identification
image-retrieval
visual-place-recognition
object-centric-retrieval
representative-sample
License:
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -53,24 +53,116 @@ README.md
|
|
| 53 |
|
| 54 |
## Metadata
|
| 55 |
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
`view_type` describes the room-level view depicted in a non-object image. Possible values in the full dataset are: `bedroom`, `bathroom`, `living area`, `hallway`, `kitchen`, `closet`, and `balcony`.
|
| 59 |
|
| 60 |
`object_type` describes the localized hotel-room object depicted in an object-centric image. Possible values in the full dataset are: `bed`, `lamp`, `artwork`, `window/curtains`, `toilet`, `nightstand`, `sink`, `seating`, `office desk`, `shower/bathtub`, `tv`, `wardrobe`, `door`, `chest`, `mirror`, `kitchen appliances`, `flooring`, and `sign`.
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
## Loading Images
|
| 63 |
|
|
|
|
|
|
|
| 64 |
```python
|
| 65 |
import json
|
| 66 |
import tarfile
|
| 67 |
from io import BytesIO
|
| 68 |
from PIL import Image
|
| 69 |
|
| 70 |
-
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
image = Image.open(BytesIO(image_file.read())).convert("RGB")
|
| 76 |
```
|
|
|
|
| 53 |
|
| 54 |
## Metadata
|
| 55 |
|
| 56 |
+
The sample includes the same metadata fields as the full OpenHotels release.
|
| 57 |
+
|
| 58 |
+
### Image Metadata
|
| 59 |
+
|
| 60 |
+
All image metadata rows include:
|
| 61 |
+
|
| 62 |
+
- `path`: image member name inside the tar file listed in `shard`.
|
| 63 |
+
- `shard`: relative path to the tar shard containing the image.
|
| 64 |
+
- `hotel_id`: stable anonymized hotel class identifier.
|
| 65 |
+
- `room`: room identifier associated with the image upload when available. This is not the semantic room/view label.
|
| 66 |
+
- `timestamp`: upload timestamp associated with the image.
|
| 67 |
+
|
| 68 |
+
Gallery rows additionally include:
|
| 69 |
+
|
| 70 |
+
- `is_object`: whether the gallery image is object-centric.
|
| 71 |
+
- `view_type`: room-level view category for non-object gallery images.
|
| 72 |
+
- `object_type`: localized object category for object-centric gallery images.
|
| 73 |
+
|
| 74 |
+
Test Non-Object rows additionally include:
|
| 75 |
+
|
| 76 |
+
- `view_type`: room-level view category for the query image.
|
| 77 |
+
|
| 78 |
+
Test Object rows additionally include:
|
| 79 |
+
|
| 80 |
+
- `object_type`: localized object category for the query image.
|
| 81 |
|
| 82 |
`view_type` describes the room-level view depicted in a non-object image. Possible values in the full dataset are: `bedroom`, `bathroom`, `living area`, `hallway`, `kitchen`, `closet`, and `balcony`.
|
| 83 |
|
| 84 |
`object_type` describes the localized hotel-room object depicted in an object-centric image. Possible values in the full dataset are: `bed`, `lamp`, `artwork`, `window/curtains`, `toilet`, `nightstand`, `sink`, `seating`, `office desk`, `shower/bathtub`, `tv`, `wardrobe`, `door`, `chest`, `mirror`, `kitchen appliances`, `flooring`, and `sign`.
|
| 85 |
|
| 86 |
+
### Hotel Metadata
|
| 87 |
+
|
| 88 |
+
Each row in `metadata_hotels.json` describes one hotel class:
|
| 89 |
+
|
| 90 |
+
- `hotel_id`: stable anonymized hotel class identifier.
|
| 91 |
+
- `name`: hotel name.
|
| 92 |
+
- `lat`: hotel latitude in decimal degrees.
|
| 93 |
+
- `lng`: hotel longitude in decimal degrees.
|
| 94 |
+
- `date_added`: timestamp when the hotel record was added.
|
| 95 |
+
- `in_gallery`: whether the hotel appears in the gallery subset.
|
| 96 |
+
- `in_test_non_object`: whether the hotel appears in the Test Non-Object subset.
|
| 97 |
+
- `in_test_object`: whether the hotel appears in the Test Object subset.
|
| 98 |
+
|
| 99 |
## Loading Images
|
| 100 |
|
| 101 |
+
The same helper can load gallery images and both query subsets. The metadata row tells the loader which tar shard contains the image and which member path to read from that shard.
|
| 102 |
+
|
| 103 |
```python
|
| 104 |
import json
|
| 105 |
import tarfile
|
| 106 |
from io import BytesIO
|
| 107 |
from PIL import Image
|
| 108 |
|
| 109 |
+
def load_image(row):
|
| 110 |
+
"""Load one OpenHotels image from its tar shard."""
|
| 111 |
+
with tarfile.open(row["shard"], "r") as tar:
|
| 112 |
+
image_file = tar.extractfile(row["path"])
|
| 113 |
+
return Image.open(BytesIO(image_file.read())).convert("RGB")
|
| 114 |
+
|
| 115 |
+
def load_metadata(path):
|
| 116 |
+
with open(path) as f:
|
| 117 |
+
return json.load(f)
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
Load a gallery image. Gallery rows contain `is_object`; non-object gallery rows include `view_type`, and object-centric gallery rows include `object_type`.
|
| 121 |
+
|
| 122 |
+
```python
|
| 123 |
+
gallery = load_metadata("metadata_gallery.json")
|
| 124 |
+
gallery_row = gallery[0]
|
| 125 |
+
gallery_image = load_image(gallery_row)
|
| 126 |
+
|
| 127 |
+
print(gallery_row["hotel_id"], gallery_row["path"])
|
| 128 |
+
if gallery_row["is_object"]:
|
| 129 |
+
print("object type:", gallery_row["object_type"])
|
| 130 |
+
else:
|
| 131 |
+
print("view type:", gallery_row["view_type"])
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
Load a Test Non-Object query image and inspect its room-level view label.
|
| 135 |
+
|
| 136 |
+
```python
|
| 137 |
+
test_non_object = load_metadata("metadata_test_non_object.json")
|
| 138 |
+
non_object_row = test_non_object[0]
|
| 139 |
+
non_object_image = load_image(non_object_row)
|
| 140 |
+
|
| 141 |
+
print(non_object_row["hotel_id"], non_object_row["path"])
|
| 142 |
+
print("view type:", non_object_row["view_type"])
|
| 143 |
+
```
|
| 144 |
+
|
| 145 |
+
Load a Test Object query image and inspect its object label.
|
| 146 |
+
|
| 147 |
+
```python
|
| 148 |
+
test_object = load_metadata("metadata_test_object.json")
|
| 149 |
+
object_row = test_object[0]
|
| 150 |
+
object_image = load_image(object_row)
|
| 151 |
+
|
| 152 |
+
print(object_row["hotel_id"], object_row["path"])
|
| 153 |
+
print("object type:", object_row["object_type"])
|
| 154 |
+
```
|
| 155 |
+
|
| 156 |
+
For retrieval evaluation, compare each query row's `hotel_id` against ranked gallery rows or gallery predictions aggregated by `hotel_id`.
|
| 157 |
+
|
| 158 |
+
```python
|
| 159 |
+
gallery_by_hotel = {}
|
| 160 |
+
for row in gallery:
|
| 161 |
+
gallery_by_hotel.setdefault(row["hotel_id"], []).append(row)
|
| 162 |
+
|
| 163 |
+
query_row = non_object_row
|
| 164 |
+
positive_gallery_rows = gallery_by_hotel[query_row["hotel_id"]]
|
| 165 |
|
| 166 |
+
print("query hotel:", query_row["hotel_id"])
|
| 167 |
+
print("matching gallery images:", len(positive_gallery_rows))
|
|
|
|
| 168 |
```
|