Speed up creating dataset from images