The requirement for service robots has grown in many industries recently. Traditionally, Simultaneous Localization and Mapping (SLAM) is used for localization. However, it is not an efficient way since particles are needed to scatter every time. And it takes a lot of time for particles to calculate the position of the robot. Also, GPS has poor signal in indoor environments. In this paper, an indoor localization algorithm based on a deep neural network is proposed. In the deep neural network model, the inputs are the distance to obstacles and the angle of the robot gotten by LiDAR and compass. The output is the robot position. Since we are familiar with the indoor environment, the data is collected, and the model is trained in advance. Furthermore, a model that combines GoogleNet and Random Forest is used for prediction. In the path planning section, Probabilistic Roadmap (PRM) algorithm is used. Finally, the proposed localization algorithm is reliable and efficient shown in the experimental results.