Ensuring the safety of automated bulldozers during edge dumping operations in open-pit mines requires accurate detection of the berm's edge. However, precisely detecting berm edges in open-pit mining scenes is challenging due to the presence of similar texture structures. To address this issue, this paper created a dataset for berm edge detection that covers multiple scenes and proposed the edge detection model with transformer (MEDTER). This model, based on a transformer with a two-stage detection structure, aims to restore thin edges. Additionally, the deep multilevel aggregation decoder enhances the information flow in the transformer to improve the sensitivity to detailed information. The BCE-Dice loss functions effectively handle the problem of pixel imbalance. Results demonstrate that the proposed model achieves significant improvements compared to others. Furthermore, the model exhibits excellent detection performance despite variations in scenes and detection distances, suggesting its practical value in ensuring the safety of automated bulldozers during edge dumping.