Code for sound field predictions in domains with impedance boundaries. Used for generating results from the paper

Overview

Authors:

Code for sound field predictions in domains with Neumann and impedance boundaries. Used for generating results from the paper "Physics-informed neural networks for 1D sound field predictions with parameterized sources and impedance boundaries" by N. Borrel-Jensen, A. P. Engsig-Karup, and C. Jeong.

Run

Train

Run

python3 main_train.py --path_settings="path/to/script.json"

Scripts for setting up models with Neumann, frequency-independent and dependent boundaries can be found in scripts/settings (see JSON settings).

Evaluate

Run

python3 main_evaluate.py

The settings are

do_animations = do_side_by_side_plot = ">
id_dir = <unique id>
settings_filename = 'settings.json'
base_dir = "path/to/base/dir"

do_plots_for_paper = <bool>
do_animations = <bool>
do_side_by_side_plot = <bool>

The id_dir corresponds to the output directory generated after training, settings_filename is the name of the settings file used for training (located inside the id_dir directory), base_dir is the path to the base directory (see Input/output directory structure).

Evaluate model execution time

To evaluate the execution time of the surrogate model, run

python3 main_evaluate_timings.py --path_settings="path/to/script.json" --trained_model_tag="trained-model-dir"

The trained_model_tag is the directory with the trained model weights trained using the scripts located at the path given in path_settings.

Settings

Input/output directory structure

The input data should be located in a specific relative directory structure as (data used for the paper can be downloaded here)

base_path/
    trained_models/
        trained_model_tag/
            checkpoint
            cp.ckpt.data-00000-of-00001
            cp.ckpt.index
    training_data/
        freq_dep_1D_2000.00Hz_sigma0.2_c1_d0.02_srcs3.hdf5
        ...
        freq_indep_1D_2000.00Hz_sigma0.2_c1_xi5.83_srcs3.hdf5
        ...
        neumann_1D_2000.00Hz_sigma0.2_c1_srcs3.hdf5
        ...

The reference data are located inside the training_data/ directory generated, where the data for impedance boundaries are generated using our SEM simulator, and for Neumann boundaries, the Python script main_generate_analytical_data.py was used.

Output result data are located inside the results folder

base_path/
    results/
        id_folder/
            figs/
            models/
                LossType.PINN/
                    checkpoint
                    cp.ckpt.data-00000-of-00001
                    cp.ckpt.index
            settings.json

The settings.json file is identical to the settings file used for training indicated by the --path_settings argument. The directory LossType.PINN contains the trained model weights.

JSON settings

The script scripts/settings/neumann.json was used for training the Neumann model from the paper

{
    "id": "neumann_srcs3_sine_3_256_7sources_loss02",
    "base_dir": "../data/pinn",
    
    "c": 1,
    "c_phys": 343,
    "___COMMENT_fmax___": "2000Hz*c/343 = 5.8309 for c=1, =23.3236 for c=4",
    "fmax": 5.8309,

    "tmax": 4,
    "xmin": -1,
    "xmax": 1,
    "source_pos": [-0.3,-0.2,-0.1,0.0,0.1,0.2,0.3],
    
    "sigma0": 0.2,
    "rho": 1.2,
    "ppw": 5,

    "epochs": 25000,
    "stop_loss_value": 0.0002,
    
    "boundary_type": "NEUMANN",
    "data_filename": "neumann_1D_2000.00Hz_sigma0.2_c1_srcs7.hdf5",
    
    "batch_size": 512,
    "learning_rate": 0.0001,
    "optimizer": "adam",

    "__comment0__": "NN setting for the PDE",
    "activation": "sin",
    "num_layers": 3,
    "num_neurons": 256,

    "ic_points_distr": 0.25,
    "bc_points_distr": 0.45,

    "loss_penalties": {
        "pde":1,
        "ic":20,
        "bc":1
    },

    "verbose_out": false,
    "show_plots": false
}

The script scripts/settings/freq_indep.json was used for training the Neumann model from the paper

{
    "id": "freq_indep_sine_3_256_7sources_loss02",
    "base_dir": "../data/pinn",

    "c": 1,
    "c_phys": 343,
    "___COMMENT_fmax___": "2000Hz*c/343 = 5.8309 for c=1, =23.3236 for c=4",
    "fmax": 5.8309,

    "tmax": 4,
    "xmin": -1,
    "xmax": 1,
    "source_pos": [-0.3,-0.2,-0.1,0.0,0.1,0.2,0.3],
    
    "sigma0": 0.2,
    "rho": 1.2,
    "ppw": 5,

    "epochs": 25000,
    "stop_loss_value": 0.0002,
    
    "batch_size": 512,
    "learning_rate": 0.0001,
    "optimizer": "adam",

    "boundary_type": "IMPEDANCE_FREQ_INDEP",
    "data_filename": "freq_indep_1D_2000.00Hz_sigma0.2_c1_xi5.83_srcs7.hdf5",

    "__comment0__": "NN setting for the PDE",
    "activation": "sin",
    "num_layers": 3,
    "num_neurons": 256,

    "impedance_data": {
        "__comment1__": "xi is the acoustic impedance ONLY for freq. indep. boundaries",
        "xi": 5.83
    },

    "ic_points_distr": 0.25,
    "bc_points_distr": 0.45,
    
    "loss_penalties": {
        "pde":1,
        "ic":20,
        "bc":1
    },

    "verbose_out": false,
    "show_plots": false
}

The script scripts/settings/freq_dep.json was used for training the Neumann model from the paper

{
    "id": "freq_dep_sine_3_256_7sources_d01",
    "base_dir": "../data/pinn",

    "c": 1,
    "c_phys": 343,
    "___COMMENT_fmax___": "2000Hz*c/343 = 5.8309 for c=1, =23.3236 for c=4",
    "fmax": 5.8309,

    "tmax": 4,
    "xmin": -1,
    "xmax": 1,
    "source_pos": [-0.3,-0.2,-0.1,0.0,0.1,0.2,0.3],
    
    "sigma0": 0.2,
    "rho": 1.2,
    "ppw": 5,

    "epochs": 50000,
    "stop_loss_value": 0.0002,

    "do_transfer_learning": false,

    "boundary_type": "IMPEDANCE_FREQ_DEP",
    "data_filename": "freq_dep_1D_2000.00Hz_sigma0.2_c1_d0.10_srcs7.hdf5",
    
    "batch_size": 512,
    "learning_rate": 0.0001,
    "optimizer": "adam",

    "__comment0__": "NN setting for the PDE",
    "activation": "sin",
    "num_layers": 3,
    "num_neurons": 256,

    "__comment1__": "NN setting for the auxillary differential ODE",
    "activation_ade": "tanh",
    "num_layers_ade": 3,
    "num_neurons_ade": 20,

    "impedance_data": {
        "d": 0.1,
        "type": "IMPEDANCE_FREQ_DEP",
        "lambdas": [7.1109025021758407,205.64002739443146],
        "alpha": [6.1969460587749818],
        "beta": [-15.797795759219973],
        "Yinf": 0.76935257750377573,
        "A": [-7.7594660571346719,0.0096108036858666163],
        "B": [-0.016951521199665469],
        "C": [-2.4690553703530442]
      },

    "accumulator_factors": [10.26, 261.37, 45.88, 21.99],

    "ic_points_distr": 0.25,
    "bc_points_distr": 0.45,

    "loss_penalties": {
        "pde":1,
        "ic":20,
        "bc":1,
        "ade":[10,10,10,10]
    },

    "verbose_out": false,
    "show_plots": false
}

HPC (DTU)

The scripts for training the models on the GPULAB clusters at DTU are located at scripts/settings/run_*.sh.

VSCode

Launch scripts for VS Code are located inside .vscode and running the settings script local_train.json in debug mode is done selecting the Python: TRAIN scheme (open pinn-acoustics.code-workspace to enable the workspace).

License

See LICENSE

Owner
DTU Acoustic Technology Group
DTU Acoustic Technology Group
Language Models Can See: Plugging Visual Controls in Text Generation

Language Models Can See: Plugging Visual Controls in Text Generation Authors: Yixuan Su, Tian Lan, Yahui Liu, Fangyu Liu, Dani Yogatama, Yan Wang, Lin

Yixuan Su 195 Dec 22, 2022
This repo is developed for Strong Baseline For Vehicle Re-Identification in Track 2 Ai-City-2021 Challenges

A STRONG BASELINE FOR VEHICLE RE-IDENTIFICATION This paper is accepted to the IEEE Conference on Computer Vision and Pattern Recognition Workshop(CVPR

Cybercore Co. Ltd 78 Dec 29, 2022
HHP-Net: A light Heteroscedastic neural network for Head Pose estimation with uncertainty

HHP-Net: A light Heteroscedastic neural network for Head Pose estimation with uncertainty Giorgio Cantarini, Francesca Odone, Nicoletta Noceti, Federi

18 Aug 02, 2022
Human Pose estimation with TensorFlow framework

Human Pose Estimation with TensorFlow Here you can find the implementation of the Human Body Pose Estimation algorithm, presented in the DeeperCut and

Eldar Insafutdinov 1.1k Dec 29, 2022
Churn-Prediction-Project - In this project, a churn prediction model is developed for a private bank as a term project for Data Mining class.

Churn-Prediction-Project In this project, a churn prediction model is developed for a private bank as a term project for Data Mining class. Project in

1 Jan 03, 2022
Azion the best solution of Edge Computing in the world.

Azion Edge Function docker action Create or update an Edge Functions on Azion Edge Nodes. The domain name is the key for decision to a create or updat

8 Jul 16, 2022
MoveNetを用いたPythonでの姿勢推定のデモ

MoveNet-Python-Example MoveNetのPythonでの動作サンプルです。 ONNXに変換したモデルも同梱しています。変換自体を試したい方はMoveNet_tf2onnx.ipynbを使用ください。 2021/08/24時点でTensorFlow Hubで提供されている以下モデ

KazuhitoTakahashi 38 Dec 17, 2022
Collapse by Conditioning: Training Class-conditional GANs with Limited Data

Collapse by Conditioning: Training Class-conditional GANs with Limited Data Moha

Mohamad Shahbazi 33 Dec 06, 2022
Train CNNs for the fruits360 data set in NTOU CS「Machine Vision」class.

CNNs fruits360 Train CNNs for the fruits360 data set in NTOU CS「Machine Vision」class. CNN on a pretrained model Build a CNN on a pretrained model, Res

Ricky Chuang 1 Mar 07, 2022
[CVPR 2020] Local Class-Specific and Global Image-Level Generative Adversarial Networks for Semantic-Guided Scene Generation

Contents Local and Global GAN Cross-View Image Translation Semantic Image Synthesis Acknowledgments Related Projects Citation Contributions Collaborat

Hao Tang 131 Dec 07, 2022
Code repository for our paper "Learning to Generate Scene Graph from Natural Language Supervision" in ICCV 2021

Scene Graph Generation from Natural Language Supervision This repository includes the Pytorch code for our paper "Learning to Generate Scene Graph fro

Yiwu Zhong 64 Dec 24, 2022
RefineGNN - Iterative refinement graph neural network for antibody sequence-structure co-design (RefineGNN)

Iterative refinement graph neural network for antibody sequence-structure co-des

Wengong Jin 83 Dec 31, 2022
ALFRED - A Benchmark for Interpreting Grounded Instructions for Everyday Tasks

ALFRED A Benchmark for Interpreting Grounded Instructions for Everyday Tasks Mohit Shridhar, Jesse Thomason, Daniel Gordon, Yonatan Bisk, Winson Han,

ALFRED 204 Dec 15, 2022
Data-depth-inference - Data depth inference with python

Welcome! This readme will guide you through the use of the code in this reposito

Marco 3 Feb 08, 2022
Python periodic table module

elemenpy Hello! elements.py is a small Python periodic table module that is used for calling certain information about an element. Installation Instal

Eric Cheng 2 Dec 27, 2021
It is a simple library to speed up CLIP inference up to 3x (K80 GPU)

CLIP-ONNX It is a simple library to speed up CLIP inference up to 3x (K80 GPU) Usage Install clip-onnx module and requirements first. Use this trick !

Gerasimov Maxim 93 Dec 20, 2022
[RSS 2021] An End-to-End Differentiable Framework for Contact-Aware Robot Design

DiffHand This repository contains the implementation for the paper An End-to-End Differentiable Framework for Contact-Aware Robot Design (RSS 2021). I

Jie Xu 60 Jan 04, 2023
Source code for our paper "Empathetic Response Generation with State Management"

Source code for our paper "Empathetic Response Generation with State Management" this repository is maintained by both Jun Gao and Yuhan Liu Model Ove

Yuhan Liu 3 Oct 08, 2022
Personals scripts using ageitgey/face_recognition

HOW TO USE pip3 install requirements.txt Add some pictures of known people in the folder 'people' : a) Create a folder called by the name of the perso

Antoine Bollengier 1 Jan 06, 2022