# Internet of Things (IoT)-Based Solutions for Uneven Roads and Balanced Vehicle Systems Using YOLOv8
## 3 Methodology
### Edge-Cloud Architecture for Scalable IoT Deployment  
To support robust deployment and long-term adaptability, our system adopts an edge-cloud IoT architecture that balances real-time response with cloud-powered enhancements.  
The architecture of our system reflects a comprehensive Internet of Things (IoT) paradigm, with core stabilization logic executed on edge hardware, including the ESP32 microcontroller, the GY-521 sensor, and an onboard camera. This design decision is driven by the need for scalability, real-time responsiveness, and ongoing evolution within connected transportation environments. The interaction between cloud and edge components enables immediate local decision-making to ensure responsiveness, while asynchronous cloud services enhance the system's long-term performance and adaptability. This dual approach not only improves real-time operational efficiency but also supports the continuous development of the system, facilitating its integration and growth within the larger context of innovative transportation solutions.  
* **Remote diagnostics and analytics** --Stabilization and anomaly data are uploaded to a cloud server for fleet-level monitoring, diagnostics, and performance auditing across deployments.
* **Over-the-air (OTA) model and policy updates**--Detection models and stabilization policies can be remotely updated without manual intervention, ensuring the system remains adaptable to new conditions or datasets.
* **Fleet-wide data coordination**--In multi-vehicle deployments, centralized servers aggregate anomaly reports from different vehicles, enabling broader road health assessments and cross-vehicle warnings.  
The architecture integrates a fallback mechanism that utilizes cloud-based post-processing to deliver corrective insights when edge detections encounter challenges like motion blur or poor lighting conditions. This hybrid edge-cloud model promotes interoperability with emerging innovative infrastructure platforms and paves the way for future integration into connected vehicle ecosystems. It is designed to support responsive local control while ensuring scalability in deployment, continuous learning capabilities, and coordinated diagnostics across fleets--key elements vital for the advancement of next-generation intelligent transportation systems.  
Detection Fallback Handling  
To ensure robustness in case YOLOv8 fails to detect any object, we explicitly check for the absence of detections and log the event. The following code checks if no object class is returned and stores the image under a \"No_Detection\" label for later inspection or sensor-only fallback operation.  
This fallback mechanism in Listing 1 improves the system's resilience by enabling a sensor-only mode when no visual anomaly is detected. It directly addresses the concern regarding robustness handling in failure scenarios.  
```
class_id=None fordetectionindetections: class_id=int(detection.cls[0]) ifclass_idisNone: cv2.imwrite(f'.../No_Detection(index).jpg',results[0].plot())
```  
Listing 1: Detection Fallback Handling: Logging Frames if No Class ID Is Assigned.  
To ensure robustness in real-world deployments, we introduce a detection fallback mechanism. If the model fails to detect any object (e.g., due to lighting, occlusion, or uncommon anomalies), we explicitly check for the absence of detected classes using:  
**Code trigger:** if class_idisNone  
This condition logs and saves No Detection images for further handling or alternate processing. It ensures sensor-only fallback capability and prevents silent failures.