Imaging through scattering media is a long-standing problem which has been extensively studied to promote the development of imaging in complex environments. Extant techniques for image reconstruction in scattering media face with the disadvantages of limited ranges of applications, high sensitivity to environmental changes and huge computational load. The scattering media commonly used in practical applications are more complicated due to unknown perturbations. One of the most outstanding problems is the uncertainty of the object position which obstructs progressive development of image recovery techniques. Therefore, it is meaningful to explore a feasible method to bypass additional requirements of precision measuring instruments. Here, we present a method based on convolution neural network (CNN) for optical image reconstruction. The targets are placed in the scattering media which are composed of a certain volume of water and milk, and their diffraction patterns are recorded by using a camera. The learning model demonstrated in this paper is tolerant to uncertainty of object positions. It is foreseeable to be a promising substitute for imaging objects in harsh environments.