Skip to content

Latest commit

 

History

History
54 lines (42 loc) · 3.98 KB

compute_fid_metric.md

File metadata and controls

54 lines (42 loc) · 3.98 KB

FID Metric

Since the FID metric doesn't require pair-wise correspondances, we do not simulate photo unobservations to compute it.

Proper FID Computation

FID computation requires at-least 2048 images per ground truth and predictions. We don't meet this requirement for surfaces of rare room types. Therefore, we make multiple texture predictions per surface using different random seeds for texture synthesis.

Note that this script will take a few hours to complete.

# Compute predictions for observed surfaces.
python code/scripts/plan2scene/preprocessing/fill_room_embeddings.py ./data/processed/texture_gen/test/drop_0.0 test --drop 0.0
python code/scripts/plan2scene/crop_select/vgg_crop_selector.py ./data/processed/vgg_crop_select/test/drop_0.0 ./data/processed/texture_gen/test/drop_0.0 test --drop 0.0
   
# Compute GNN predictions for unobserved surfaces
python code/scripts/plan2scene/texture_prop/gnn_texture_prop.py ./data/processed/gnn_prop/test/drop_0.0 ./data/processed/vgg_crop_select/test/drop_0.0 test [GNN_TRAIN_PATH]/conf/texture_prop.json [CHECKPOINT_PATH] --keep-existing-predictions --drop 0.0

# We generate 24 texture predictions per each surface so as to meet the 2048 predictions per surface requirement of FID.
# The 24 predictions are generated by using different random seeds for the texture synthesis.  
# This script handles seam correction internally.
python code/scripts/plan2scene/postprocessing/multiprop.py ./data/processed/gnn_prop/test/drop_0.0/tileable_multiprop_texture_crops ./data/processed/gnn_prop/test/drop_0.0/surface_texture_embeddings test 24 --drop 0.0

# Compute FID
python code/scripts/plan2scene/compute_fid.py ./data/processed/gnn_prop/test/drop_0.0/fid_results ./data/processed/gnn_prop/test/drop_0.0/tileable_multiprop_texture_crops ./data/processed/texture_gen/test/drop_0.0/texture_crops test --all-cases --prior-predictions ./data/processed/vgg_crop_select/test/drop_0.0/texture_crops --multiprop 24

# The results are saved at:
#   ./data/processed/gnn_prop/test/drop_0.0/fid_results/all_surfaces/fid_results.json.
#   ./data/processed/gnn_prop/test/drop_0.0/fid_results/observed_surfaces/fid_results.json.
#   ./data/processed/gnn_prop/test/drop_0.0/fid_results/unobserved_surfaces/fid_results.json.

Fast/inaccurate FID computation

Here, we ommit the requirement of needing at-least 2048 images. So, the FID results may be inaccurate. Use this approach for sanity checks only.

# Compute predictions for observed surfaces.
python code/scripts/plan2scene/preprocessing/fill_room_embeddings.py ./data/processed/texture_gen/test/drop_0.0 test --drop 0.0
python code/scripts/plan2scene/crop_select/vgg_crop_selector.py ./data/processed/vgg_crop_select/test/drop_0.0 ./data/processed/texture_gen/test/drop_0.0 test --drop 0.0
   
# Compute GNN predictions for unobserved surfaces
python code/scripts/plan2scene/texture_prop/gnn_texture_prop.py ./data/processed/gnn_prop/test/drop_0.0 ./data/processed/vgg_crop_select/test/drop_0.0 test [GNN_TRAIN_PATH]/conf/texture_prop.json [CHECKPOINT_PATH] --keep-existing-predictions --drop 0.0

# Correct seams of texture crops and make them tileable by running seam_correct_textures.py
python code/scripts/plan2scene/postprocessing/seam_correct_textures.py ./data/processed/gnn_prop/test/drop_0.0/tileable_texture_crops ./data/processed/gnn_prop/test/drop_0.0/texture_crops test --drop 0.0

# Compute FID
python code/scripts/plan2scene/compute_fid.py ./data/processed/gnn_prop/test/drop_0.0/fast_fid_results ./data/processed/gnn_prop/test/drop_0.0/tileable_texture_crops ./data/processed/texture_gen/test/drop_0.0/texture_crops test --all-cases --prior-predictions ./data/processed/vgg_crop_select/test/drop_0.0/texture_crops

# The results are saved at:
#   ./data/processed/gnn_prop/test/drop_0.0/fast_fid_results/all_surfaces/fid_results.json.
#   ./data/processed/gnn_prop/test/drop_0.0/fast_fid_results/observed_surfaces/fid_results.json.
#   ./data/processed/gnn_prop/test/drop_0.0/fast_fid_results/unobserved_surfaces/fid_results.json.