Datasets:
Update README.md
Browse files
README.md
CHANGED
|
@@ -69,10 +69,57 @@ Annotations were manually created using [COCO Annotator](https://github.com/jsbr
|
|
| 69 |
|
| 70 |
## Usage Example
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
```python
|
| 73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
|
| 75 |
-
dataset = load_dataset("etri/ForestPersons")
|
| 76 |
```
|
| 77 |
|
| 78 |
## License
|
|
|
|
| 69 |
|
| 70 |
## Usage Example
|
| 71 |
|
| 72 |
+
### (Recommended) Full Download — COCO Format Ready
|
| 73 |
+
|
| 74 |
+
```bash
|
| 75 |
+
# Clone the dataset repo (includes CSV + annotations.zip + dataset.py)
|
| 76 |
+
git lfs install
|
| 77 |
+
git clone https://huggingface.co/datasets/etri/ForestPersons
|
| 78 |
+
cd ForestPersons
|
| 79 |
+
|
| 80 |
+
# Download and extract all images (already included in the repo)
|
| 81 |
+
# Structure: images/{folder}/{image}.jpg
|
| 82 |
+
|
| 83 |
+
# Unzip COCO-style annotations
|
| 84 |
+
unzip annotations.zip -d annotations/
|
| 85 |
+
|
| 86 |
+
# Resulting directory:
|
| 87 |
+
# ├── images/
|
| 88 |
+
# ├── annotations/
|
| 89 |
+
# │ ├── train.json
|
| 90 |
+
# │ ├── val.json
|
| 91 |
+
# │ └── test.json
|
| 92 |
+
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
### Visualize One Sample
|
| 96 |
```python
|
| 97 |
+
import requests
|
| 98 |
+
from PIL import Image
|
| 99 |
+
import matplotlib.pyplot as plt
|
| 100 |
+
import matplotlib.patches as patches
|
| 101 |
+
from io import BytesIO
|
| 102 |
+
|
| 103 |
+
# Hugging Face image base path
|
| 104 |
+
BASE_URL = "https://huggingface.co/datasets/etri/ForestPersons/resolve/main/images/"
|
| 105 |
+
|
| 106 |
+
# Load sample
|
| 107 |
+
sample = dataset[0]
|
| 108 |
+
image_url = BASE_URL + sample["file_name"]
|
| 109 |
+
|
| 110 |
+
# Load image
|
| 111 |
+
image = Image.open(BytesIO(requests.get(image_url).content))
|
| 112 |
+
|
| 113 |
+
# Draw image + bounding box
|
| 114 |
+
fig, ax = plt.subplots()
|
| 115 |
+
ax.imshow(image)
|
| 116 |
+
x, y, w, h = sample["bbox_x"], sample["bbox_y"], sample["bbox_w"], sample["bbox_h"]
|
| 117 |
+
rect = patches.Rectangle((x, y), w, h, linewidth=2, edgecolor='red', facecolor='none')
|
| 118 |
+
ax.add_patch(rect)
|
| 119 |
+
plt.title(f"{sample['file_name']} | {sample['category_name']}")
|
| 120 |
+
plt.axis("off")
|
| 121 |
+
plt.show()
|
| 122 |
|
|
|
|
| 123 |
```
|
| 124 |
|
| 125 |
## License
|