## 4 Experimental Environment and Methodology in Smart Farming Environment
### Methodology  
The process of diagnosing sensor states through waveform segmentation in this study includes the following steps:  
1. **Time-series data collection**: Time-series data related to soil conditions and environmental variables, such as temperature, humidity, electrical conductivity, and pH, are collected from sensors installed on the smart farm. Data are collected for a year and segmented into 10-day intervals. This segmentation allows for the analysis of seasonal patterns and the monitoring of changes in soil and environmental conditions over time for optimizing irrigation and other farming operations. 2. **Waveform segmentation and state extraction**: The collected time-series data are segmented using waveform segmentation techniques, and features are then extracted from each segment. These features represent distinct operational states of the sensor controllers in the smart farm environment. Machine learning models are then trained on the extracted features to classify the operational states based on time-series data. The states are categorized into \"watering\", \"normal operation\", and \"abnormal operation\". This classification allows for real-time monitoring and prompt responses to any system issues that may occur. Figure 7 contains the **results of the dataset state classification**, illustrating how the machine learning model segments time-series data into distinct categories. Each segment corresponds to different sensor states, such as \"watering\", \"normal operation\", and \"abnormal operation\", allowing for efficient monitoring and responses to changes in the smart farming environment. This classification supports the real-time diagnosis and management of agricultural devices based on operational status. 3. **Partial labeling of features**: To streamline the training process, a subset of the data is manually labeled as a reference for the entire dataset. Initially, we manually labeled specific sections where peaks appear during watering events, as shown by the dashed areas in Figure 8. By leveraging this partially labeled dataset, machine learning models automatically label the remaining data, significantly reducing the time and effort required for manual labeling. Figure 8 demonstrates examples of **semantic segmentation** based on predicted labels. Each segmented section is analyzed by the model to monitor equipment states in real time and to support accurate predictions. This pseudo-labeling process enhances labeling efficiency, facilitating effective model development. Our methodology introduces a novel pseudo-labeling technique to automate the labeling of semantic segments in time-series data. This process involves using machine learning algorithms to identify patterns within the data and assign labels based on learned features, reducing the reliance on manual labeling. Pseudo-labeling enhances the model's ability to handle large-scale datasets with greater accuracy and consistency. The automated labeling approach also enables iterative refinement; as pseudo-labeled data are incorporated back into the training set, the model's predictions continue to improve. Figure 8 illustrates the segmentation process along with the inherent challenges of manual labeling, highlighting areas for improvement. This figure provides examples of semantic segmentation based on predicted labels and shows how manual labeling can introduce errors, such as missing segments or inaccuracies. These errors offer insights into areas needing further refinement, enhancing the model's overall performance. These errors are described as follows:  
* **Missing segments**: These occur when certain regions are overlooked during real-time data labeling, especially in large-scale time series. Missing segments can prevent the model from capturing important transitions in the data, reducing classification accuracy. * **Inaccuracies**: Misclassification errors may arise from similarities between different classes, the ambiguity of real-time data, or the limitations of segmentation algorithms.