Weeds are unwanted and invasive plants characterized by their rapid growth and ability to compete with crops for essential resources such as space, water, nutrients, and sunlight. This competition has a negative impact on crop quality and productivity. To reduce the influence of weeds, precision weeding is used, which uses image sensors and computational algorithms to identify plants and classify weeds using digital images. This study used images of maize (Zea mays L.) to detect four types of weeds (Lolium rigidum, Sonchus oleraceus, Solanum nigrum, and Poa annua). For this purpose, YOLO (You Only Look Once) architectures, YOLOv8s, YOLOv9s, YOLOv10s, and YOLOv11s versions, were trained and compared, along with an architecture based on RT-DETR (Real-Time Detection Transformer), version RT-DETR-1. The YOLO architectures are noted for their real-time detection efficiency, and RT-DETR-l allows evaluation of the impact of an architecture that dispenses with Non-Maximum Suppression (NMS). The YOLOv9s model had the best overall performance, achieving a mAP@0.5 of 0.834 in 60 epochs and an F1-score of 0.78, which demonstrates a optimal balance between accuracy and recall, although with less confidence in its predictions. On the other hand, the RT-DETR-l model stood out for its efficiency in convergence, reaching a competitive performance in only 58 epochs with a mAP@0.5 of 0.828 and an F1-score of 0.80.