Traditional weed detection technology has several limitations, including low detection accuracy, substantial computational demands, and large-scale detection models. To meet the requirements of weed multi-target identification and portability, this study proposes the YOLO–WEED model for weed recognition. The proposed model has the following innovations: (1) The backbone standard convolution module in YOLOv5 was replaced by the lightweight MobileNetv3 network to simplify the network structure and reduce parameter complexity; (2) The addition of convolutional block attention module (CBAM) to the neck network enabled the model to focus on the most important features while filtering out noise and irrelevant information; (3) To further improve classification accuracy and reduce loss, the C2f module was employed to improve the C3 module in the neck network; and (4) During the model plot process, a coordinate variable was added in the box label to help the model accurately locate the weeds. In the study, six species of weeds and one crop were used as test subjects. After image enhancement techniques were used, ablation experiments were deployed. The experimental results indicated that the YOLO–WEED model achieved an average accuracy of 92.5% in identifying six types of weeds and one type of crop. The accuracies for each type of plant were 82.7%, 97.3%, 98.8%, 86%, 93.5%, 99.3% and 89.6%, respectively. The number of model parameters was reduced by 39.4% compared with YOLOv5s. Furthermore, the localisation, classification and object losses were reduced by 0.025, 0.005 and 0.014, respectively. The model optimisation and deployment of the Jetson mobile terminal for multi-target detection were realised, and the performance was better than six network models such as YOLOv5s.