[Objective] Tomato ripeness directly determines harvest timing, storage-transportation cycle and market pricing, while appearance defects not only reduce commercial value but also may cause cross-infection during storage, making them core mandatory indicators for automated equipment. Traditional manual detection suffers from low efficiency, strong subjectivity and high miss rate, while existing deep learning models generally have shortcomings of insufficient grading granularity, incomplete functional coverage and poor deployment adaptability, hardly balancing accuracy and real-time performance on low-power edge devices. The aim of this study is to propose a lightweight high-precision integrated tomato detection model to provide reliable visual technical support for automated harvesting and intelligent sorting. [Methods] An improved YOLOv10s tomato detection model named Tomato-YOLO was proposed, which simultaneously achieved fine-grained grading of 4 ripeness categories and integrated identification of 4 appearance defect categories. A tomato detection dataset containing 3 807 images was constructed for the study, integrating 2 221 public samples and 1 586 self-collected field samples and covering multiple complex field scenarios. The dataset was hierarchically and randomly split into training, validation and test sets at a 7:2:1 ratio, and five data augmentation strategies were adopted during training to improve generalization, with a total of 8 detection labels (4 ripeness + 4 appearance defects) set. Four improvements were implemented on the YOLOv10s baseline: First, the Scale-Aware Context Module (SACM) was introduced to replace the C2f module in the backbone network, enhancing the feature capture capability for subtle ripeness differences and micro defects while suppressing field background interference. Second, a cross-layer multi-scale bidirectional feature fusion strategy was constructed and extended to a four-detection-head architecture, with a P2 ultra-small target detection layer added to fill the scale coverage gap of the native architecture and boost perception robustness for small and occluded fruits in complex scenes. Third, the SIoU loss function was adopted to replace the native CIoU loss, paired with an adaptive weighting strategy for small targets, adding angle constraints to optimize bounding box regression accuracy for nearly circular tomatoes and raising the learning priority of hard samples. Fourth, Layer-Adaptive Magnitude Pruning (LAMP) technology was introduced to prune redundant convolutional layers, and the optimal pruning ratio was determined via gradient comparison to achieve lightweight performance with negligible accuracy loss. [Results and Discussions] Experiments were conducted on the RTX3070 platform, and the results showed that the precision, recall and mean average precision (mAP@0.5) of Tomato-YOLO reached 92.1%, 92.0% and 95.0% respectively, 6.9, 11.6 and 6.8 percentage points higher than those of the original YOLOv10s, with significant performance improvements for both defect and ripeness categories. Compared with mainstream models including Faster R-CNN, SSD, YOLOv5s/v8s/v11s/v12s, Tomato-YOLO achieved significantly higher detection accuracy, while its model size and inference speed were comparable to those of native YOLOv10s, striking a balance between accuracy and efficiency. Ablation experiments verified the independent effects and synergistic gains of the four improvements, and pruning experiments identified 15% as the optimal pruning ratio. At this ratio, the model weight was compressed to 15.1 MB, computational load reduced to 27.9 GFLOPs, and accuracy decreased by only 1.2 percentage points, achieving nearly lossless lightweighting. When the pruned model was deployed on the Jetson Nano edge platform, the inference speed reached 30.4 f/s, and the overall mAP@0.5 remained at 93.7%, far exceeding the ≥20 f/s real-time detection threshold for agricultural scenarios, meeting the continuous operation requirements of harvesting equipment. [Conclusions] The Tomato-YOLO proposed in this study effectively addresses the core limitations of existing tomato detection models, achieving a balance of high accuracy and real-time performance for fine-grained ripeness grading and integrated appearance defect identification. It can provide reliable technical support for intelligent harvesting and refined sorting in the tomato industry.