We apply two transformer-based models, the MiT-B2 + U-Net hybrid model and the pure Transformer-based SegFormer-B2, to perform fine-grained classification across five distinct categories (excluding background), facilitating accurate radio frequency interference (RFI) identification while actively preserving bright pulsar signals. These models were trained and evaluated using real observational data from the Five-hundred-meter Aperture Spherical radio Telescope Galactic Plane Pulsar Snapshot (FAST-GPPS) Survey, supplemented by carefully constructed simulated data sets. On the FAST-GPPS validation data set, the MiT-B2 + U-Net model achieves a multi-class Macro F1 score of 0.8091, substantially outperforming the SegFormer-B2 baseline (0.6298), demonstrating the advantage of the hybrid architecture over the pure Transformer across diverse RFI morphologies. Notably, both models show strong capability in pulsar signal preservation, achieving recalls of 94.88% (MiT-B2 + U-Net) and 93.04% (SegFormer-B2). Further evaluations with simulated test data yielded binary F1 scores of 0.9479 and 0.8684, significantly outperforming the widely used AOFlagger toolkit (0.7976). These results indicate that this multi-class approach not only effectively identifies and classifies complex RFI into multiple categories but also achieves robust protection of pulsar signals—a key advantage rarely addressed in prior work.

