fixed bug: in image, y are rows and x are cols.
add multi classification support