With the development of space technology, there is an increasing demand for spacecraft on-orbit servicing, such as on-orbit assembly. Relative navigation of spacecraft is a key technology in on-orbit servicing because it ensures the safe and accurate approach of the two spacecraft. Non-cooperative spacecraft means that there is no communication with it and therefore cannot get precise relative position and attitude from differential GNSS. The ground guidance using ground-based orbit determination technology can guide the two spacecraft to be close as 200m. However, when the relative distance is less than 200m, higher-precision relative navigation is required. Binocular cameras can provide relative position and attitude within close range, however, as the focal length of binocular cameras is usually small, they are not suitable for medium range navigation. Thus, the relative navigation in medium range, such as 200m to 10m, becomes a challenge as the distance scale is uncertain using monocular camera. To solve this problem, this paper proposes a relative position visual navigation algorithm based on deep learning technology using monocular cameras. The navigation algorithm uses YOLOv5 target detection technology to obtain the position of the spacecraft in the image, and then calculates the real relative position in space based on the pinhole camera model. The speed of the proposed algorithm can reach 10 FPS on the NVIDIA TX2 computing device, and the average relative position error is 5.16% at 200m-10m. The proposed algorithm has been successfully applied to an on-orbit visual navigation task and achieve fast and robust navigation result.