Team Ai
Datasetpublic

OneScience-Group/ShapeNetCar

ShapeNetCar Dataset Description The ShapeNetCar dataset comes from the paper Learning Three-dimensional Flow for Interactive Aerodynamic Design by Umetani and Bickel, published in ACM Transactions on Graphics (SIGGRAPH 2018). Based on three-dimensional car geometries from ShapeNet, the dataset uses CFD simulations to obtain velocity fields around the vehicles, surface pressure, and drag coefficients. It supports research on rapidly predicting aerodynamic physical… See the full description on the dataset page: https://huggingface.co/datasets/OneScience-Group/ShapeNetCar.

sourceHugging Facecc-by-4.0updated 2mo agoView on Hugging Face
0likes1.9kdownloads
validate_shapenetcar_data.py97 linesDownload Raw Back to scripts
1#!/usr/bin/env python32"""Validate ShapeNetCar mlcfd_data structure and readable arrays."""3 4from __future__ import annotations5 6import argparse7import sys8from pathlib import Path9 10import numpy as np11 12 13STATS = {14    "mean_in.npy": (7,),15    "std_in.npy": (7,),16    "mean_out.npy": (4,),17    "std_out.npy": (4,),18}19TRAINING_FILES = ("Cd.npy", "I1.npy", "I2.npy", "Press.npy", "Velo.npy")20PREPROCESSED_FILES = ("x.npy", "y.npy", "pos.npy", "surf.npy", "edge_index.npy")21 22 23def fail(message: str) -> None:24    print(f"[FAIL] {message}", file=sys.stderr)25    raise SystemExit(1)26 27 28def load(path: Path) -> np.ndarray:29    try:30        return np.load(path, allow_pickle=False)31    except Exception as exc:  # pragma: no cover - diagnostic path32        fail(f"cannot read {path}: {exc}")33 34 35def main() -> None:36    parser = argparse.ArgumentParser()37    parser.add_argument("--data-root", default="data/mlcfd_data")38    args = parser.parse_args()39    root = Path(args.data_root)40 41    if not root.is_dir():42        fail(f"data root not found: {root}")43 44    for subdir in ("training_data", "preprocessed_data", "stats"):45        if not (root / subdir).is_dir():46            fail(f"missing directory: {root / subdir}")47 48    for filename, shape in STATS.items():49        arr = load(root / "stats" / filename)50        if arr.shape != shape:51            fail(f"stats shape mismatch for {filename}: expected {shape}, got {arr.shape}")52        if not np.issubdtype(arr.dtype, np.floating):53            fail(f"stats dtype mismatch for {filename}: got {arr.dtype}")54 55    train_param_dirs = sorted(p for p in (root / "training_data").glob("param*") if p.is_dir())56    if not train_param_dirs:57        fail("no training_data/param* directories found")58    for param_dir in train_param_dirs:59        for filename in TRAINING_FILES:60            path = param_dir / filename61            if not path.is_file():62                fail(f"missing training file: {path}")63            arr = load(path)64            if arr.size == 0:65                fail(f"empty training array: {path}")66 67    sample_dirs = sorted(p for p in (root / "preprocessed_data").glob("param*/*") if p.is_dir())68    if not sample_dirs:69        fail("no preprocessed sample directories found")70    sample = sample_dirs[0]71    arrays = {name: load(sample / name) for name in PREPROCESSED_FILES}72    if arrays["x.npy"].ndim != 2 or arrays["x.npy"].shape[1] != 7:73        fail(f"x.npy schema mismatch in {sample}: {arrays['x.npy'].shape}")74    if arrays["y.npy"].ndim != 2 or arrays["y.npy"].shape[1] != 4:75        fail(f"y.npy schema mismatch in {sample}: {arrays['y.npy'].shape}")76    if arrays["pos.npy"].ndim != 2 or arrays["pos.npy"].shape[1] != 3:77        fail(f"pos.npy schema mismatch in {sample}: {arrays['pos.npy'].shape}")78    if arrays["surf.npy"].ndim != 1:79        fail(f"surf.npy schema mismatch in {sample}: {arrays['surf.npy'].shape}")80    if arrays["edge_index.npy"].ndim != 2 or arrays["edge_index.npy"].shape[0] != 2:81        fail(f"edge_index.npy schema mismatch in {sample}: {arrays['edge_index.npy'].shape}")82 83    node_count = arrays["x.npy"].shape[0]84    if arrays["y.npy"].shape[0] != node_count or arrays["pos.npy"].shape[0] != node_count:85        fail(f"node count mismatch in {sample}")86    if arrays["surf.npy"].shape[0] != node_count:87        fail(f"surface mask length mismatch in {sample}")88 89    print("[OK] ShapeNetCar data validation passed")90    print(f"[OK] training param dirs: {len(train_param_dirs)}")91    print(f"[OK] preprocessed samples: {len(sample_dirs)}")92    print(f"[OK] checked sample: {sample.relative_to(root)}")93 94 95if __name__ == "__main__":96    main()97 
OneScience-Group/ShapeNetCar · Team Ai