Add Label Factory dataset 0000
#3
by KarolyArmin - opened
README.md
CHANGED
|
@@ -49,20 +49,75 @@ Every configuration provides deterministic `train`, `validation`, and `test`
|
|
| 49 |
splits. Adding another numbered capture appends rows through the wildcard paths;
|
| 50 |
it does not replace earlier datasets.
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
```python
|
| 53 |
from datasets import load_dataset
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
-
|
|
|
|
| 61 |
from io import BytesIO
|
| 62 |
from PIL import Image
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
```
|
| 67 |
|
| 68 |
## Contents
|
|
|
|
| 49 |
splits. Adding another numbered capture appends rows through the wildcard paths;
|
| 50 |
it does not replace earlier datasets.
|
| 51 |
|
| 52 |
+
## Loading all or several numbered datasets
|
| 53 |
+
|
| 54 |
+
The configuration automatically combines every uploaded directory (`0000`,
|
| 55 |
+
`0001`, `0002`, ...). Filter `dataset_id` to use selected captures:
|
| 56 |
+
|
| 57 |
```python
|
| 58 |
from datasets import load_dataset
|
| 59 |
|
| 60 |
+
poses = load_dataset("KarolyArmin/Hand_tools", "object_pose_estimation")
|
| 61 |
+
selected_ids = set(["0000", "0001", "0004"])
|
| 62 |
+
for split_name in poses:
|
| 63 |
+
poses[split_name] = poses[split_name].filter(
|
| 64 |
+
lambda row: row["dataset_id"] in selected_ids
|
| 65 |
+
)
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
## Depth-estimation example
|
| 69 |
|
| 70 |
+
```python
|
| 71 |
+
from datasets import load_dataset
|
| 72 |
from io import BytesIO
|
| 73 |
from PIL import Image
|
| 74 |
+
import numpy as np
|
| 75 |
+
|
| 76 |
+
depth_dataset = load_dataset("KarolyArmin/Hand_tools", "depth_estimation")
|
| 77 |
+
sample = depth_dataset["train"][0]
|
| 78 |
+
rgb = Image.open(BytesIO(sample["image_png"])).convert("RGB")
|
| 79 |
+
depth_native = np.asarray(Image.open(BytesIO(sample["depth_png"])))
|
| 80 |
+
depth_mm = depth_native.astype(np.float32) * sample["depth_scale"]
|
| 81 |
+
depth_m = depth_mm / 1000.0
|
| 82 |
+
intrinsics_3x3 = np.asarray(sample["camera_intrinsics"]).reshape(3, 3)
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
## Instance-segmentation example
|
| 86 |
+
|
| 87 |
+
```python
|
| 88 |
+
from datasets import load_dataset
|
| 89 |
+
from io import BytesIO
|
| 90 |
+
from PIL import Image
|
| 91 |
+
import json
|
| 92 |
+
import numpy as np
|
| 93 |
+
|
| 94 |
+
instances = load_dataset("KarolyArmin/Hand_tools", "instance_segmentation")
|
| 95 |
+
sample = instances["validation"][0]
|
| 96 |
+
rgb = Image.open(BytesIO(sample["image_png"])).convert("RGB")
|
| 97 |
+
instance_mask = np.asarray(Image.open(BytesIO(sample["instance_mask_png"])))
|
| 98 |
+
annotations = json.loads(sample["annotations_json"])
|
| 99 |
+
boxes_xywh = np.asarray(sample["boxes_xywh"])
|
| 100 |
+
instance_names = sample["instance_names"]
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
## Object-pose-estimation example
|
| 104 |
+
|
| 105 |
+
```python
|
| 106 |
+
from datasets import load_dataset
|
| 107 |
+
from io import BytesIO
|
| 108 |
+
from PIL import Image
|
| 109 |
+
import numpy as np
|
| 110 |
+
|
| 111 |
+
poses = load_dataset("KarolyArmin/Hand_tools", "object_pose_estimation")
|
| 112 |
+
sample = poses["test"][0]
|
| 113 |
+
rgb = Image.open(BytesIO(sample["image_png"])).convert("RGB")
|
| 114 |
+
depth = np.asarray(Image.open(BytesIO(sample["depth_png"])))
|
| 115 |
+
instance_mask = np.asarray(Image.open(BytesIO(sample["instance_mask_png"])))
|
| 116 |
+
world_from_camera = np.asarray(sample["world_from_camera"]).reshape(4, 4)
|
| 117 |
+
camera_from_world = np.asarray(sample["camera_from_world"]).reshape(4, 4)
|
| 118 |
+
world_from_objects = np.asarray(sample["world_from_objects"]).reshape(-1, 4, 4)
|
| 119 |
+
camera_from_objects = np.asarray(sample["camera_from_objects"]).reshape(-1, 4, 4)
|
| 120 |
+
object_names = sample["object_names"]
|
| 121 |
```
|
| 122 |
|
| 123 |
## Contents
|