A novel star identification network (RPNet) based on representation learning is proposed in this paper. Unlike other pattern-based stars identification algorithms, the RPNet does not require the creation of an elaborate pattern, nor does it need to search among patterns. Instead, a star pattern generator (SPG) in the RPNet helps in finding the best pattern that can distinguish different stars clearly. A star pattern classifier (SPC) in the RPNet is utilized to recognize the pattern generated before. The simulations show that the RPNet is extremely robust toward star position noise, star magnitude noise, and false stars. The performance on simulation images outperforms almost all other pattern-based stars identification algorithms. On average, it achieves an identification rate of 99.23% in simulated star images. The identification rate on real star images is higher than 98%. Moreover, the algorithm achieves this performance with lesser memory and faster speed compared to polygon algorithms.