We provide physics evaluation algorithms extracting physical variables including positions, velocities, and energies from ground truth and predicted frames for the three known systems (single pendulum, rigid double pendulum, and elastic double pendulum). You can use these algorithms to evaluate the physical accuracy of predictions.
-
Evaluate physical variables from ground truth data.
python eval_phys_data.py dataset_name data_filepath
The
dataset_name
can be single_pendulum, double_pendulum, or elastic_pendulum. Thedata_filepath
is the respective data filepath, e.g.,data/single_pendulum
wheredata
is your customized data folder. The results will be saved in thephys_vars.npy
file underdata_filepath
. -
Evaluate physical variables from long-term predictions via model rollouts and compute physical errors between ground truth data and the predictions.
python eval_phys_long_term_pred.py config_filepath pred_save_path
The
config_filepath
is the model configuration filepath, e.g.,../configs/single_pendulum/model/config1.yaml
. Thepred_save_path
is the path to the predicted images, e.g.,../scripts/logs_single_pendulum_encoder-decoder_1/prediction_long_term/model_rollout/
. The results will be saved in thephys_vars.npy
,phys_error.npy
, andpixel_error.npy
files underpred_save_path
.
Note: eval_phys_single_pendulum
, eval_phys_double_pendulum
, and eval_phys_elastic_pendulum
are helper packages for evaluating physical variables for the above command lines.
-
Navigate to the scripts folder
cd ../scripts
which is the default directory saving all models' log folders.
-
Estimate intrinsic dimension from model latent vectors using the Levina-Bickel method
python ../analysis/eval_intrinsic_dimension.py {config_filepath} model-latent NA
or using all methods (Levina-Bickel, MiND-ML, MiND-KL, Hein, CD)
python ../analysis/eval_intrinsic_dimension.py {config_filepath} model-latent all-methods
The
config_filepath
is the model configuration filepath, e.g.,../configs/single_pendulum/model/config1.yaml
. The results will be saved in theintrinsic_dimension.npy
file (using the Levina-Bickel method) or theintrinsic_dimension_all_methods.npy
file (using all methods) in thevariables
subfolder under the model's log folder. -
Estimate intrinsic dimension from raw data (image pairs) using the Levina-Bickel method
python ../analysis/eval_intrinsic_dimension.py {config_filepath} data-image NA
or using all methods (Levina-Bickel, MiND-ML, MiND-KL, Hein, CD)
python ../analysis/eval_intrinsic_dimension.py {config_filepath} data-image all-methods
The
config_filepath
is the model configuration filepath, e.g.,../configs/single_pendulum/model/config1.yaml
. The results will be saved in theintrinsic_dimension_image.npy
file (using the Levina-Bickel method) or theintrinsic_dimension_image_all_methods.npy
file (using all methods) in thevariables
subfolder under the model's log folder. Here the model configuration only provides data filepath and test video ids.
Note: intrinsic_dimension_estimation
are helper packages providing various intrinsic dimension estimation methods. When choosing the all-methods
option, the MATLAB and MATLAB Engine API for Python should be installed on the machine, see instructions here.
References of MATLAB codes:
[1] Gabriele Lombardi (2021). Intrinsic dimensionality estimation techniques (https://www.mathworks.com/matlabcentral/fileexchange/40112-intrinsic-dimensionality-estimation-techniques), MATLAB Central File Exchange. Retrieved October 21, 2021.
[2] M. Hein and J.-Y. Audibert, Intrinsic dimensionality estimation of submanifolds in Euclidean space, Proceedings of the 22nd Internatical Conference on Machine Learning (https://www.ml.uni-saarland.de/code/IntDim/IntDim.htm).
-
Navigate to the scripts folder
cd ../scripts
which is the default directory saving all models' log folders.
-
Regress physical variables from the model latent vectors
python ../analysis/eval_regression.py config_filepath NA
or from the first
num_components
principal components of the model latent vectorspython ../analysis/eval_regression.py config_filepath num_components
The
config_filepath
is the model configuration filepath, e.g.,../configs/single_pendulum/model/config1.yaml
. The results will be saved in theregression_results.npy
file (with model latent vectors) or theregression_results_pca_{num_components}.npy
file (with first few principal components of model latent vectors) in thevariables
subfolder under the model's log folder.