Deep Learning to Ternary Hash Codes by Continuation