Wheat leaf diseases such as yellow rust and powdery mildew are very harmful to wheat yields worldwide. It is important to detect these diseases as early as possible so that losses can be minimized. In this work, we have used lightweight convolutional neural networks (CNNs) and Transformer-based methods to detect wheat leaf diseases under complex environmental conditions. In the first study, we tried several lightweight CNN models, such as MobileNetV3, ShuffleNetV2, GhostNet, MnasNet, and EfficientNetV2. These models were trained using different learning methods and achieved the highest accuracy of 98.65% using MnasNet and a fine-tuned learning rate. The second study focused on detecting yellow rust with UNET Segmentation and Swin Transformer classification methods. They achieved 95.8% accuracy in the field without manual intervention. These studies created a complete pipeline, including finding and delimiting wheat leaves from a complex background. They used YOLOv8 to quickly find leaves, then performed Segmentation and classification. The results showed that the combination of Segmentation, lightweight CNN, and Transformer techniques can handle leaf disease detection in nature with different backgrounds. This system has high accuracy and good efficiency for use in the field. This method can help the development of smart agricultural applications by accelerating and facilitating automatic detection of wheat leaf diseases. Using technologies such as Convolutional neural networks, Transformers, and Segmentation to overcome complex backgrounds.