Add files using upload-large-folder tool
Browse files- ball_bounce/eval.parquet +3 -0
- ball_bounce/test.parquet +3 -0
- ball_bounce/train.parquet +3 -0
- ball_roll/eval.parquet +3 -0
- ball_roll/test.parquet +3 -0
- ball_roll/train.parquet +3 -0
- lens_p1/eval.parquet +3 -0
- lens_p1/test.parquet +3 -0
- lens_p1/train.parquet +3 -0
- lens_p2/eval.parquet +3 -0
- lens_p2/test.parquet +3 -0
- lens_p2/train.parquet +3 -0
- physicsgen.py +163 -0
- sound_baseline/eval.parquet +3 -0
- sound_baseline/test.parquet +3 -0
- sound_baseline/train.parquet +3 -0
- sound_combined/eval.parquet +3 -0
- sound_combined/test.parquet +3 -0
- sound_combined/train.parquet +3 -0
- sound_diffraction/eval.parquet +3 -0
- sound_diffraction/test.parquet +3 -0
- sound_diffraction/train.parquet +3 -0
- sound_reflection/eval.parquet +3 -0
- sound_reflection/test.parquet +3 -0
- sound_reflection/train.parquet +3 -0
ball_bounce/eval.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7c2b9b3700c3e8b3c6a4ea54ee4e8e7e6f7a2bb8c297bd28ccc489f314026685
|
| 3 |
+
size 5635966
|
ball_bounce/test.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:73f44301ff73102b6808f6ff698d4c20f75b3dcede7baf03086419623e39f972
|
| 3 |
+
size 157885979
|
ball_bounce/train.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e162198bb9e078f3f5ae9e5f77935b5e26a80f5a24362929c07300ed3a468aa1
|
| 3 |
+
size 4400772013
|
ball_roll/eval.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c5d0269ba07df46b18ae07b45c21d4028e5d8eb4e06faea17d8884aa5787cc49
|
| 3 |
+
size 4910894
|
ball_roll/test.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5dab6232e19c6a93e6a3233f840fe79ea83f569926ea110cb73f6e46d4451f32
|
| 3 |
+
size 177317911
|
ball_roll/train.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0a44ea2931cb69c7ab6572b22a7295656bc00f03cca5c304083f9eaa66337f9e
|
| 3 |
+
size 2733858105
|
lens_p1/eval.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e1069246dccb40616500356ae0c02955f05df0452cd60147963fb9ee8e54c0fa
|
| 3 |
+
size 121983
|
lens_p1/test.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d55477d86ef8805806b45905afe97defa3946ca0f210b13b404c1834a1a9f8bd
|
| 3 |
+
size 41675
|
lens_p1/train.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e630f98734088164ee063ac2b869ac4b2b3b091846a1024dd2d701107102508b
|
| 3 |
+
size 670287
|
lens_p2/eval.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6499f15410309a4948b25a17afc613c23c5c355eb7b45246d80b7edd70541696
|
| 3 |
+
size 121983
|
lens_p2/test.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9068e606c3f81d8943db24d291214d464e83b3cc389037bc9339a9d307153fdb
|
| 3 |
+
size 41675
|
lens_p2/train.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:52881d2caf3baba771433e1c385ffa95002c4070b53a9edc7d7a6d7b91d17378
|
| 3 |
+
size 670287
|
physicsgen.py
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import csv
|
| 3 |
+
from PIL import Image
|
| 4 |
+
import datasets
|
| 5 |
+
|
| 6 |
+
# Define configurations for each flavor.
|
| 7 |
+
BUILDER_CONFIGS = [
|
| 8 |
+
datasets.BuilderConfig(
|
| 9 |
+
name="sound_baseline",
|
| 10 |
+
description="Physical dataset: baseline variant",
|
| 11 |
+
data_dir="./physicsgen/urban_sound_25k_baseline"
|
| 12 |
+
),
|
| 13 |
+
datasets.BuilderConfig(
|
| 14 |
+
name="sound_reflection",
|
| 15 |
+
description="Physical dataset: reflection variant",
|
| 16 |
+
data_dir="./physicsgen/urban_sound_25k_reflection"
|
| 17 |
+
),
|
| 18 |
+
datasets.BuilderConfig(
|
| 19 |
+
name="sound_diffraction",
|
| 20 |
+
description="Physical dataset: reflection variant",
|
| 21 |
+
data_dir="./physicsgen/urban_sound_25k_diffraction"
|
| 22 |
+
),
|
| 23 |
+
datasets.BuilderConfig(
|
| 24 |
+
name="sound_combined",
|
| 25 |
+
description="Physical dataset: reflection variant",
|
| 26 |
+
data_dir="./physicsgen/urban_sound_25k_combined"
|
| 27 |
+
),
|
| 28 |
+
datasets.BuilderConfig(
|
| 29 |
+
name="lens_p1",
|
| 30 |
+
description="Distortion dataset variant",
|
| 31 |
+
data_dir="./physicsgen/lens_distortion_p1"
|
| 32 |
+
),
|
| 33 |
+
datasets.BuilderConfig(
|
| 34 |
+
name="lens_p2",
|
| 35 |
+
description="Distortion dataset variant",
|
| 36 |
+
data_dir="./physicsgen/lens_distortion_p2"
|
| 37 |
+
),
|
| 38 |
+
datasets.BuilderConfig(
|
| 39 |
+
name="ball_roll",
|
| 40 |
+
description="Double image dataset variant",
|
| 41 |
+
data_dir="./physicsgen/ball_roll"
|
| 42 |
+
),
|
| 43 |
+
datasets.BuilderConfig(
|
| 44 |
+
name="ball_bounce",
|
| 45 |
+
description="Double image dataset variant",
|
| 46 |
+
data_dir="./physicsgen/ball_bounce"
|
| 47 |
+
),
|
| 48 |
+
]
|
| 49 |
+
|
| 50 |
+
class MyPhysicalDataset(datasets.GeneratorBasedBuilder):
|
| 51 |
+
BUILDER_CONFIGS = BUILDER_CONFIGS
|
| 52 |
+
VERSION = datasets.Version("1.0.2")
|
| 53 |
+
|
| 54 |
+
def _info(self):
|
| 55 |
+
if self.config.name in ["sound_baseline", "sound_reflection", "sound_diffraction", "sound_combined"]:
|
| 56 |
+
features = datasets.Features({
|
| 57 |
+
"lat": datasets.Value("float"),
|
| 58 |
+
"long": datasets.Value("float"),
|
| 59 |
+
"db": datasets.Value("string"),
|
| 60 |
+
"soundmap": datasets.Image(),
|
| 61 |
+
"osm": datasets.Image(),
|
| 62 |
+
"temperature": datasets.Value("int32"),
|
| 63 |
+
"humidity": datasets.Value("int32"),
|
| 64 |
+
"yaw": datasets.Value("float"),
|
| 65 |
+
"sample_id": datasets.Value("int32"),
|
| 66 |
+
"soundmap_512": datasets.Image(),
|
| 67 |
+
})
|
| 68 |
+
elif self.config.name in ["lens_p1", "lens_p2"]:
|
| 69 |
+
features = datasets.Features({
|
| 70 |
+
"label_path": datasets.Value("string"),
|
| 71 |
+
"fx": datasets.Value("float"),
|
| 72 |
+
"k1": datasets.Value("float"),
|
| 73 |
+
"k2": datasets.Value("float"),
|
| 74 |
+
"k3": datasets.Value("float"),
|
| 75 |
+
"p1": datasets.Value("float"),
|
| 76 |
+
"p2": datasets.Value("float"),
|
| 77 |
+
"cx": datasets.Value("float"),
|
| 78 |
+
"distortion_path": datasets.Value("string"),
|
| 79 |
+
})
|
| 80 |
+
elif self.config.name in ["ball_roll", "ball_bounce"]:
|
| 81 |
+
features = datasets.Features({
|
| 82 |
+
"ImgName": datasets.Value("string"),
|
| 83 |
+
"StartHeight": datasets.Value("int32"),
|
| 84 |
+
"GroundIncli": datasets.Value("float"),
|
| 85 |
+
"InputTime": datasets.Value("int32"),
|
| 86 |
+
"TargetTime": datasets.Value("int32"),
|
| 87 |
+
"input_image": datasets.Image(),
|
| 88 |
+
"target_image": datasets.Image(),
|
| 89 |
+
})
|
| 90 |
+
else:
|
| 91 |
+
raise ValueError(f"Unknown config name: {self.config.name}")
|
| 92 |
+
return datasets.DatasetInfo(
|
| 93 |
+
description="Multiple variant physical tasks dataset.",
|
| 94 |
+
features=features,
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
def _split_generators(self, dl_manager):
|
| 98 |
+
data_dir = self.config.data_dir
|
| 99 |
+
return [
|
| 100 |
+
datasets.SplitGenerator(
|
| 101 |
+
name=datasets.Split.TRAIN,
|
| 102 |
+
gen_kwargs={"split_dir": os.path.join(data_dir, "train")},
|
| 103 |
+
),
|
| 104 |
+
datasets.SplitGenerator(
|
| 105 |
+
name=datasets.Split.TEST,
|
| 106 |
+
gen_kwargs={"split_dir": os.path.join(data_dir, "test")},
|
| 107 |
+
),
|
| 108 |
+
datasets.SplitGenerator(
|
| 109 |
+
name=datasets.Split.VALIDATION,
|
| 110 |
+
gen_kwargs={"split_dir": os.path.join(data_dir, "eval")},
|
| 111 |
+
),
|
| 112 |
+
]
|
| 113 |
+
|
| 114 |
+
def _generate_examples(self, split_dir):
|
| 115 |
+
if self.config.name in ["sound_baseline", "sound_reflection", "sound_diffraction", "sound_combined"]:
|
| 116 |
+
csv_path = os.path.join(split_dir, "meta_data.csv")
|
| 117 |
+
with open(csv_path, encoding="utf-8") as f:
|
| 118 |
+
reader = csv.DictReader(f)
|
| 119 |
+
for idx, row in enumerate(reader):
|
| 120 |
+
row["soundmap"] = os.path.join(split_dir, row["soundmap"])
|
| 121 |
+
row["osm"] = os.path.join(split_dir, row["osm"])
|
| 122 |
+
row["soundmap_512"] = os.path.join(split_dir, row["soundmap_512"])
|
| 123 |
+
row["lat"] = float(row["lat"])
|
| 124 |
+
row["long"] = float(row["long"])
|
| 125 |
+
row["temperature"] = int(row["temperature"])
|
| 126 |
+
row["humidity"] = int(row["humidity"])
|
| 127 |
+
row["sample_id"] = int(row["sample_id"])
|
| 128 |
+
row["yaw"] = float(row["yaw"]) if row["yaw"] else 0.0
|
| 129 |
+
yield idx, row
|
| 130 |
+
|
| 131 |
+
elif self.config.name in ["lens_p1", "lens_p2"]:
|
| 132 |
+
csv_path = os.path.join(split_dir, "meta_data.csv")
|
| 133 |
+
with open(csv_path, encoding="utf-8") as f:
|
| 134 |
+
reader = csv.DictReader(f)
|
| 135 |
+
for idx, row in enumerate(reader):
|
| 136 |
+
row["label_path"] = str(row["label_path"])
|
| 137 |
+
row["distortion_path"] = str(row["distortion_path"])
|
| 138 |
+
row["fx"] = float(row["fx"])
|
| 139 |
+
row["k1"] = float(row["k1"])
|
| 140 |
+
row["k2"] = float(row["k2"])
|
| 141 |
+
row["k3"] = float(row["k3"])
|
| 142 |
+
row["p1"] = float(row["p1"])
|
| 143 |
+
row["p2"] = float(row["p2"])
|
| 144 |
+
row["cx"] = float(row["cx"])
|
| 145 |
+
yield idx, row
|
| 146 |
+
|
| 147 |
+
elif self.config.name in ["ball_roll", "ball_bounce"]:
|
| 148 |
+
csv_path = os.path.join(split_dir, "meta_data.csv")
|
| 149 |
+
with open(csv_path, encoding="utf-8") as f:
|
| 150 |
+
reader = csv.DictReader(f)
|
| 151 |
+
for idx, row in enumerate(reader):
|
| 152 |
+
# Construct image path from ImgName, e.g., "DoubleImg_0.jpg"
|
| 153 |
+
image_filename = "DoubleImg_" + row["ImgName"] + ".jpg"
|
| 154 |
+
input_image_path = os.path.join(split_dir, "x", image_filename)
|
| 155 |
+
target_image_path = os.path.join(split_dir, "y", image_filename)
|
| 156 |
+
row["input_image"] = input_image_path
|
| 157 |
+
row["target_image"] = target_image_path
|
| 158 |
+
row["ImgName"] = row["ImgName"]
|
| 159 |
+
row["StartHeight"] = int(row["StartHeight"])
|
| 160 |
+
row["GroundIncli"] = float(row["GroundIncli"])
|
| 161 |
+
row["InputTime"] = int(row["InputTime"])
|
| 162 |
+
row["TargetTime"] = int(row["TargetTime"])
|
| 163 |
+
yield idx, row
|
sound_baseline/eval.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bd3c0342d7e793207a0d1a02c0906c4aa7d205988d3d240af4195dfc8d375ec7
|
| 3 |
+
size 119262832
|
sound_baseline/test.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:58384373f4c6c7ba284620be445a8a5c86674c9ee355b32cc7ee9186db3deba2
|
| 3 |
+
size 40109864
|
sound_baseline/train.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9069deff9b384e3c2d188af5af5b1a6c8942b1531f34464a34f65e80326ecf04
|
| 3 |
+
size 648507369
|
sound_combined/eval.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f579cc194a38c9a018103e13c5462988fc2102f4c5f463c5df1ce825d99d0fb7
|
| 3 |
+
size 222984612
|
sound_combined/test.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cc7645396f0db7074a36bf2dbd00745435a4b2a7dc4c5e5e9735637b9d6415dc
|
| 3 |
+
size 75292721
|
sound_combined/train.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f831d6918d4de32c60c30967edd6897033bd3978f8b64e66c3b9ebfdab92f89d
|
| 3 |
+
size 1262623105
|
sound_diffraction/eval.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0613ad429cef5519a8574eaec99e882df295f70289d7b7b387196bf2e5206b32
|
| 3 |
+
size 195071676
|
sound_diffraction/test.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aa6d9609b402dedec77135bddac8744d450df62baaafd2de9873020f3b725901
|
| 3 |
+
size 65603263
|
sound_diffraction/train.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a70b1fdb2443dafdc6caa1d021869bee688555821f53b982fa47a3a7b5e16055
|
| 3 |
+
size 1108509903
|
sound_reflection/eval.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4fd8290688fe2707391924de7ce6a3c6c153921fc1f8453e628413c5fefe717d
|
| 3 |
+
size 187197405
|
sound_reflection/test.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c912b3e5154ba0534dbafc42bab3d141b190c91f3d891040a6adf5f03ab90aa2
|
| 3 |
+
size 63205053
|
sound_reflection/train.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3e801031b02b05111cda20c96b49d393c96ff12fc9b4bcd35ae7b19ec4589b5d
|
| 3 |
+
size 1047687635
|