High intraocular pressure causes the eye disease glaucoma, which can eventually result in complete blindness. On the other hand, early detection and treatment of glaucoma can prevent complete blindness in a patient. However, we regularly experience delays as a result of challenging glaucoma screening procedures and a shortage of human resources, which might raise the worldwide vision loss ratio. In the final stage, it is envisaged that a confined region comprising glaucoma lesions and associated classes will develop. To prove the technique’s viability, it was put to the test on a challenging dataset, specifically an online retinal fundus image database for glaucoma research (ORIGA). Due to the existing dearth of intelligence and security research on outdoor gantry cranes, a method based on the updated you-only-look-once (YOLO)v5 network for intelligent anti-intrusion detection is proposed. The first step is to offer a broad detection strategy. The YOLOv5 network’s goal is to retain speed while achieving the highest detection precision: Add multi-layer receptive fields and fine-grained modules to the backbone network to improve the performance of features. The training of YOLO V5 resulted in an accuracy of 92.5% by the end of the 100th epoch. The high accuracy hence proves that the model was able to detect effectively.