fix bug on crossvalidatebyimage and start writing dividing into blocks