Advancements in real-time processing for object detection have significantly improved the accuracy of detection algorithms. These improvements are important for precision spraying technologies, enabling more focused and efficient approaches that are fundamental to the progress of precision agriculture. In this study, a real-time grape vineyard leaf detection system is presented to specifically identify and spray unhealthy leaves, improving pesticide application efficiency. The system employs an improved YOLOv7 deep learning algorithm, capable of classifying grapevine leaves into three categories: unhealthy leaves, healthy leaves, and grape cluster bags. A lightweight convolution layer was integrated into the algorithm's backbone for better generalization and feature extraction, making the model more adaptable across various data types. Then, a squeeze and excitation block coupled with the batch normalization block was incorporated to assess each channel's significance. This addition merges spatial and channel-wise information within each layer's local receptive field. An adaptive gradient optimizer coupled with Lasso regularization was implemented for improved generalization and better handling of noisy data. An ELU activation function was added to better converge and regularize the model, and a GELU activation function was exchanged to introduce non-linearity and reduce vanishing gradient points. A total of 2300 images of grape leaves were taken from the vineyard and labeled with LabelImg annotation tool. The results of the improved YOLOv7 algorithm showed a 3.2 % improvement in Precision, 6.2 % in Recall, 1.6 % in mAP@0.5, and 7.1 % in mAP@0.5:0.95. To verify the effectiveness of the proposed method, the results were compared with Faster RCNN, RetinaNet R50-FPN, Double Head RCNN, YOLOv5, YOLOv7, and YOLOv9. To evaluate the pesticide coverage outcome, the improved results file was then taken for an outdoor experiment which showed 65.96 % improvement in spraying pesticide on unhealthy leaves with controlled spraying. The achieved outcomes affirmed the satisfactory performance of the improved algorithm, aiming to provide valuable technical support for further advancements in precision spraying within grape vineyard environment.