Refactor segmentation model to use classifier. (Fixed issue #22).