The substance classifier is used by the SUBS metric. We train it a mix of crops obtained from the opensurfaces dataset and stationary textures dataset. More details are provided in the supplementary metrics section of the paper.
Download the opensurfaces dataset. The download script will extract the rectified surface masks.
From those extracted rectified surface masks, we prepare a train_masks
directory and a val_masks
directory having masks with following file names.
Then, we use the following script to extract crops from these rectified surface masks.
python scripts/plan2scene/metric_impl/substance_classifier/prepare_opensurfaces_crops.py ./data/processed/open-surfaces-crops/train PATH/TO/train_masks
python scripts/plan2scene/metric_impl/substance_classifier/prepare_opensurfaces_crops.py ./data/processed/open-surfaces-crops/val PATH/TO/val_masks
We use the following script to extract crops from the texture dataset.
python scripts/plan2scene/metric_impl/substance_classifier/prepare_texture_crops.py ./data/processed/stationary-textures-crops/train PATH/TO/TRAIN/TEXTURES
python scripts/plan2scene/metric_impl/substance_classifier/prepare_texture_crops.py ./data/processed/stationary-textures-crops/val PATH/TO/VAL/TEXTURES
-
Make sure the crops extracted from the texture dataset are in the
[PROJECT_ROOT]/data/processed/stationary-textures-dataset-crops/train
and/data/processed/stationary-textures-crops/val
directories. -
Make sure the crops extracted from opensurfaces rectified surface masks are in the
/data/processed/open-surfaces-crops/train
and[PROJECT_ROOT]/data/processed/open-surfaces-crops/val
directories. -
Run the following command to start training. This will continue training for 200 epochs.
export PYTHONPATH=./code/src python ./code/scripts/plan2scene/metric_impl/substance_classifier/train.py ./trained_models/substance_classifier/default ./conf/plan2scene/substance_classifier_conf/default.json --save-model-interval 1
Checkpoints are saved at './trained_models/substance_classifier/default/checkpoints' directory.
-
Preview learning curves using Tensorboard.
tensorboard --logdir=./trained_models/substance_classifier/default/tensorboard
-
Choose the best checkpoint based on substance classification accuracy. Update
substance_classifier.checkpoint_path
field of./conf/plan2scene/metric.json
to point to the best checkpoint. Updatesubstance_classifier.conf_path
field of the same file to./trained_models/substance_classifier/default/conf/substance_classifier_conf.json