Yolov5–Based Freshness Detection of Selected Vegetables Using Raspberry Pi
Keywords:
Yolov5, Object Detection, Vegetable Freshness, Raspberry Pi, Real-Time Monitoring, Image Classification, Food Waste ReductionAbstract
Maintaining the freshness of vegetables is essential to reduce food waste and ensure customer satisfaction. This work presents an automated monitoring system that uses the YOLOv5 object detection model to classify the freshness of selected vegetables—specifically tomatoes, eggplants, and red onions. A dataset of 800 annotated images (80% for training and 20% for validation) was used to train the model to distinguish between fresh and spoiled produce. The system is implemented using a Raspberry Pi 4 Model B connected to a camera module, which captures images in real time for freshness detection. Based on the classification result, the system triggers physical alerts: if fresh vegetables are detected, the green LED turns on; if spoiled vegetables are detected, the red LED lights up and the buzzer is activated to warn staff. A web interface provides real-time visual feedback, displaying annotated images, confidence scores, and freshness logs. The model achieved an accuracy of 80% under ideal lighting conditions, with confidence scores ranging from 52% to 84% for fresh produce. Challenges include difficulty detecting early-stage spoilage and reduced performance in poor lighting. This system has potential for improving freshness monitoring and quality control in retail stores through automation and real-time alerts.



