Since rocks may collide with the rover or wear tires during the exploration mission of the Mars probe, and may contain rich geological information, identifying rocks in the scene is crucial for the navigation and obstacle avoidance of the Mars probe. Additionally, since the communication between the Mars rover and the earth is often intermittent and delayed during missions, it needs a certain degree of autonomy. Deep learning technologies such as semantic segmentation and target detection can meet this requirement to a certain extent, which facilitates the enhancement of safety and efficiency for the Mars rover. Rock segmentation is to divide the pixels of the rock from the image. However, the texture of the rock is often close to the texture of the surrounding sand, and some parts may be covered, so it is difficult to identify it correctly. To this end, this paper proposed RSU-Net (Rock Segmentation U-Net) and RSU-Net-L, which combine the SENet attention mechanism, and the latter achieves higher computational efficiency and inference speed by compressing the number of channels on the basis of the former. In addition, this paper established a dataset, MarsRock, for Mars rock segmentation to help the Mars rover for visual navigation. Its images come from “Tianwen-1”, which contains 1194 images, and each image has a corresponding rock label. And our experiments on the MarsRock dataset show that RSU-Net can achieve 99.07% accuracy and 67.71% F1-score. RSU-Net-L can achieve 98.99% accuracy and 66.67% F1-score while diminishing the number of parameter count by 43.7% and the number of FLOPs by 43.6%, while the FPS can reach 12.01 on a single RTX6000-24GB GPU.