Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -24,7 +24,7 @@ configs:
|
|
| 24 |
# Dataset Card: Hidden-Objects
|
| 25 |
|
| 26 |
## 📌 Overview
|
| 27 |
-
|
| 28 |
|
| 29 |
* **Project Page:** [marcoschouten.github.io/hidden_objects/](https://marcoschouten.github.io/hidden_objects/)
|
| 30 |
* **Background Source:** [Places365 Dataset](http://places2.csail.mit.edu/download.html)
|
|
@@ -45,7 +45,7 @@ Each entry consists of a foreground object (`fg_class`) to be inserted within a
|
|
| 45 |
---
|
| 46 |
|
| 47 |
## 📐 Preprocessing & Bounding Boxes
|
| 48 |
-
The bounding boxes are defined relative to a **512x512 center-cropped** version of the background image.
|
| 49 |
1. Resize the shortest side of the original image to **512px**.
|
| 50 |
2. Perform a **center crop** to reach 512x512.
|
| 51 |
3. The upper-left corner of the crop is `(0, 0)`.
|
|
@@ -55,12 +55,14 @@ The bounding boxes are defined relative to a **512x512 center-cropped** version
|
|
| 55 |
# Convert normalized [x, y, w, h] to 512x512 pixel coordinates
|
| 56 |
px_x, px_y = bbox[0] * 512, bbox[1] * 512
|
| 57 |
px_w, px_h = bbox[2] * 512, bbox[3] * 512
|
|
|
|
|
|
|
| 58 |
|
| 59 |
-
##############
|
| 60 |
## Example Setup
|
| 61 |
huggingface-cli login
|
| 62 |
|
| 63 |
|
|
|
|
| 64 |
|
| 65 |
```python
|
| 66 |
|
|
@@ -69,16 +71,18 @@ import torchvision.datasets as datasets
|
|
| 69 |
root = "INSERT_YOUR_PATH"
|
| 70 |
dataset = datasets.Places365(root=root, split='train-standard', small=False, download=True)
|
| 71 |
print(f"Downloaded {len(dataset)} images to {root}")
|
|
|
|
| 72 |
|
| 73 |
|
| 74 |
-
|
|
|
|
| 75 |
from datasets import load_dataset
|
| 76 |
|
| 77 |
dataset = load_dataset("marco-schouten/hidden-objects", streaming=True)
|
| 78 |
first_row = next(iter(dataset["train"]))
|
| 79 |
print(first_row)
|
| 80 |
```
|
| 81 |
-
|
| 82 |
```json
|
| 83 |
{
|
| 84 |
"entry_id": 1,
|
|
@@ -92,7 +96,7 @@ print(first_row)
|
|
| 92 |
}
|
| 93 |
```
|
| 94 |
|
| 95 |
-
|
| 96 |
|
| 97 |
```Python
|
| 98 |
import os
|
|
@@ -126,7 +130,7 @@ class HiddenObjectsDataset(Dataset):
|
|
| 126 |
# dataset = HiddenObjectsDataset(places_root="./data/places365")
|
| 127 |
```
|
| 128 |
|
| 129 |
-
|
| 130 |
|
| 131 |
```Python
|
| 132 |
import os
|
|
|
|
| 24 |
# Dataset Card: Hidden-Objects
|
| 25 |
|
| 26 |
## 📌 Overview
|
| 27 |
+
It provides image-object pairs with localized bounding boxes, designed to help models learn realistic object placement and spatial relationships within background scenes.
|
| 28 |
|
| 29 |
* **Project Page:** [marcoschouten.github.io/hidden_objects/](https://marcoschouten.github.io/hidden_objects/)
|
| 30 |
* **Background Source:** [Places365 Dataset](http://places2.csail.mit.edu/download.html)
|
|
|
|
| 45 |
---
|
| 46 |
|
| 47 |
## 📐 Preprocessing & Bounding Boxes
|
| 48 |
+
The bounding boxes are defined relative to a **512x512 center-cropped** version of the background image.
|
| 49 |
1. Resize the shortest side of the original image to **512px**.
|
| 50 |
2. Perform a **center crop** to reach 512x512.
|
| 51 |
3. The upper-left corner of the crop is `(0, 0)`.
|
|
|
|
| 55 |
# Convert normalized [x, y, w, h] to 512x512 pixel coordinates
|
| 56 |
px_x, px_y = bbox[0] * 512, bbox[1] * 512
|
| 57 |
px_w, px_h = bbox[2] * 512, bbox[3] * 512
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
|
|
|
|
| 61 |
## Example Setup
|
| 62 |
huggingface-cli login
|
| 63 |
|
| 64 |
|
| 65 |
+
### Download Background Images from Places
|
| 66 |
|
| 67 |
```python
|
| 68 |
|
|
|
|
| 71 |
root = "INSERT_YOUR_PATH"
|
| 72 |
dataset = datasets.Places365(root=root, split='train-standard', small=False, download=True)
|
| 73 |
print(f"Downloaded {len(dataset)} images to {root}")
|
| 74 |
+
```
|
| 75 |
|
| 76 |
|
| 77 |
+
### Load as JSONL
|
| 78 |
+
```Python
|
| 79 |
from datasets import load_dataset
|
| 80 |
|
| 81 |
dataset = load_dataset("marco-schouten/hidden-objects", streaming=True)
|
| 82 |
first_row = next(iter(dataset["train"]))
|
| 83 |
print(first_row)
|
| 84 |
```
|
| 85 |
+
Sample:
|
| 86 |
```json
|
| 87 |
{
|
| 88 |
"entry_id": 1,
|
|
|
|
| 96 |
}
|
| 97 |
```
|
| 98 |
|
| 99 |
+
### Load for Training / Evalauting
|
| 100 |
|
| 101 |
```Python
|
| 102 |
import os
|
|
|
|
| 130 |
# dataset = HiddenObjectsDataset(places_root="./data/places365")
|
| 131 |
```
|
| 132 |
|
| 133 |
+
### Load Streaming Mode
|
| 134 |
|
| 135 |
```Python
|
| 136 |
import os
|