Refactor

fix bug of im2bin and log loss