Image data optimization in ML