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

You might also like...
Using python and scikit-learn to make stock predictions

MachineLearningStocks in python: a starter project and guide EDIT as of Feb 2021: MachineLearningStocks is no longer actively maintained MachineLearni

ReConsider is a re-ranking model that re-ranks the top-K (passage, answer-span) predictions of an Open-Domain QA Model like DPR (Karpukhin et al., 2020).

ReConsider ReConsider is a re-ranking model that re-ranks the top-K (passage, answer-span) predictions of an Open-Domain QA Model like DPR (Karpukhin

Systematic generalisation with group invariant predictions

Requirements are Python 3, TensorFlow v1.14, Numpy, Scipy, Scikit-Learn, Matplotlib, Pillow, Scikit-Image, h5py, tqdm. Experiments were run on V100 GPUs (16 and 32GB).

Neural Ensemble Search for Performant and Calibrated Predictions
Neural Ensemble Search for Performant and Calibrated Predictions

Neural Ensemble Search Introduction This repo contains the code accompanying the paper: Neural Ensemble Search for Performant and Calibrated Predictio

🔮 Execution time predictions for deep neural network training iterations across different GPUs.

Habitat: A Runtime-Based Computational Performance Predictor for Deep Neural Network Training Habitat is a tool that predicts a deep neural network's

Framework that uses artificial intelligence applied to mathematical models to make predictions
Framework that uses artificial intelligence applied to mathematical models to make predictions

LiconIA Framework that uses artificial intelligence applied to mathematical models to make predictions Interface Overview Table of contents [TOC] 1 Ar

Implementation of the bachelor's thesis "Real-time stock predictions with deep learning and news scraping".

Real-time stock predictions with deep learning and news scraping This repository contains a partial implementation of my bachelor's thesis "Real-time

Stroke-predictions-ml-model - Machine learning model to predict individuals chances of having a stroke

stroke-predictions-ml-model machine learning model to predict individuals chance

A python-image-classification web application project, written in Python and served through the Flask Microframework. This Project implements the VGG16 covolutional neural network, through Keras and Tensorflow wrappers, to make predictions on uploaded images.
Owner
DTU Acoustic Technology Group
DTU Acoustic Technology Group
The LaTeX and Python code for generating the paper, experiments' results and visualizations reported in each paper is available (whenever possible) in the paper's directory

This repository contains the software implementation of most algorithms used or developed in my research. The LaTeX and Python code for generating the

João Fonseca 3 Jan 3, 2023
Source code of "Hold me tight! Influence of discriminative features on deep network boundaries"

Hold me tight! Influence of discriminative features on deep network boundaries This is the source code to reproduce the experiments of the NeurIPS 202

EPFL LTS4 19 Dec 10, 2021
STEAL - Learning Semantic Boundaries from Noisy Annotations (CVPR 2019)

STEAL This is the official inference code for: Devil Is in the Edges: Learning Semantic Boundaries from Noisy Annotations David Acuna, Amlan Kar, Sanj

null 469 Dec 26, 2022
Alleviating Over-segmentation Errors by Detecting Action Boundaries

Alleviating Over-segmentation Errors by Detecting Action Boundaries Forked from ASRF offical code. This repo is the a implementation of replacing orig

null 13 Dec 12, 2022
Code for the paper "Unsupervised Contrastive Learning of Sound Event Representations", ICASSP 2021.

Unsupervised Contrastive Learning of Sound Event Representations This repository contains the code for the following paper. If you use this code or pa

Eduardo Fonseca 81 Dec 22, 2022
Code used to generate the results appearing in "Train longer, generalize better: closing the generalization gap in large batch training of neural networks"

Train longer, generalize better - Big batch training This is a code repository used to generate the results appearing in "Train longer, generalize bet

Elad Hoffer 145 Sep 16, 2022
This is the official Pytorch implementation of the paper "Diverse Motion Stylization for Multiple Style Domains via Spatial-Temporal Graph-Based Generative Model"

Diverse Motion Stylization (Official) This is the official Pytorch implementation of this paper. Diverse Motion Stylization for Multiple Style Domains

Soomin Park 28 Dec 16, 2022
Sound-guided Semantic Image Manipulation - Official Pytorch Code (CVPR 2022)

?? Sound-guided Semantic Image Manipulation (CVPR2022) Official Pytorch Implementation Sound-guided Semantic Image Manipulation IEEE/CVF Conference on

CVLAB 58 Dec 28, 2022
Code Release for Learning to Adapt to Evolving Domains

EAML Code release for "Learning to Adapt to Evolving Domains" (NeurIPS 2020) Prerequisites PyTorch >= 0.4.0 (with suitable CUDA and CuDNN version) tor

null 23 Dec 7, 2022
naked is a Python tool which allows you to strip a model and only keep what matters for making predictions.

naked is a Python tool which allows you to strip a model and only keep what matters for making predictions. The result is a pure Python function with no third-party dependencies that you can simply copy/paste wherever you wish.

Max Halford 24 Dec 20, 2022