Imported from https://github.com/aonotas/deep-crf