The detection of tomatoes is of vital importance for enhancing production efficiency, with image recognition-based tomato detection methods being the primary approach. However, these methods face challenges such as the difficulty in extracting small targets, low detection accuracy, and slow processing speeds. Therefore, this paper proposes an improved RT-DETR-Tomato model for efficient tomato detection under complex environmental conditions. The model mainly consists of a Swin Transformer block, a BiFormer module, path merging, multi-scale convolutional layers, and fully connected layers. In this proposed model, Swin Transformer is chosen as the new backbone network to replace ResNet50 because of its superior ability to capture broader global dependency relationships and contextual information. Meanwhile, a lightweight BiFormer block is adopted in Swin Transformer to reduce computational complexity through content-aware flexible computation allocation. Experimental results show that the average accuracy of the final RT-DETR-Tomato model is greatly improved compared to the original model, and the model training time is greatly reduced, demonstrating better environmental adaptability. In the future, the RT-DETR-Tomato model can be integrated with intelligent patrol and picking robots, enabling precise identification of crops and ensuring the safety of crops and the smooth progress of agricultural production.
Agricultural expert forums serve as important platforms for knowledge exchange, containing large volumes of text that embody professional expertise and practical experience. However, because experts often focus on different agricultural subfields and category semantics may overlap, traditional text classification methods that rely solely on textual content often show limited discriminative power. To address this issue, this paper proposes a text classification model for agricultural expert forums that integrates expert domain preferences with deep semantic representations. Specifically, the model incorporates an expert domain preference matrix and an expert semantic vector matrix into the deep semantic encoding of forum texts to construct interaction representations between experts and categories, thereby enabling collaborative modeling of textual semantics and expert domain preferences. To further improve classification performance, a category-level enhancement strategy based on domain attention is introduced at the output stage. This strategy uses candidate category masking and probability constraints to guide the model in adaptively aligning its predictions with experts’ long-term domain focus patterns. Experimental results on over 110,000 text sentences show that the proposed model improves average precision by approximately 12.7% and the overall F1 score by around 10.1%, with stable gains in both accuracy and recall. Compared with mainstream encoder-based classification models, the proposed model achieves an average accuracy improvement of 11.67%, demonstrating significant and robust performance advantages. Overall, the proposed model enhances both the accuracy and robustness of text classification in agricultural expert forums while improving interpretability, providing effective technical support for agricultural knowledge management and intelligent information retrieval.