Enhancing Agricultural Efficiency: Deep Learning-Based Soil Crack Detection for Water Irrigation

Abstract


A. Introduction
The soil crack formation are multifaceted and can be attributed to various natural processes and human activies factors.Natural factors like biotic processes, hypergenesis and geological phenomena are significant contributors.Hypergenesis exacerbating soil cracking especially in arid regions with high salt levels.Biotic activities, such as plant root growth and burrowing organisms, can disrupt soil integrity.Geological processes, shape the Earth's surface and influence soil stability.Hydrogeological processes, driven by underground water movement, contribute to soil erosion and deposition.Both natural and man-made earthquakes impact soil stability and surface features.Additionally, human activities like intensive agriculture, deforestation, and urbanization worsen soil degradation, increasing susceptibility to cracking [1].Comprehending the various factors contributing to soil cracking is crucial for successful soil management and conservation efforts.[2] Cracks naturally due to moisture evaporation and reduced water content in soil, while swelling occurs in expansive soils with higher water content.Exposure to atmospheric conditions alters the behavior of expansive soils like clays or mad, influenced by local weather fluctuations.Cracks can occur due to the thermo-hydromechanical (THM) problem, which involves the water losing through evaporation and the problem of fracture mechanics (FM) [3].
. Researchers are exploring its potential for image recognition tasks, promising cost-effective solutions for computer vision applications.Introduced in 2012, the Raspberry Pi has become a prominent single-board computer known for its versatility and affordability.Widely utilized in computer science education, it offers practical hands-on learning experiences.[7][8][9][10][11] Moreover, it plays an essential role in the IoT as a gateway device, connecting sensors, actuators, and other IoT devices to the internet, facilitating seamless communication within IoT ecosystems.In [12] Raspberry Pi, captured images are sent to the cloud for image recognition.Unlike traditional methods, we employ a convolutional neural network (CNN) for our model.Although CNNs have gained immense popularity in image classification [13], there is a notable scarcity of research on implementing CNNs on Raspberry Pi, predominantly owing to the restricted processing power of older Raspberry Pi iterations.The analysis revealed that employing a CNN framework that integrated TensorFlow [14], [15] resulted in the optimal performance on the Raspberry Pi.Among the various CNN models, [5] Inception V3 has garnered significant attention for its superior performance in image classification tasks.Its complex architecture enables comprehensive feature extraction, making it well-suited for detecting subtle patterns in soil cracks.It can use in soil crack detection holds promise for understanding soil degradation processes and implementing timely intervention measures.The importance of efficient resource management in agricultural production, historically reliant on natural resources, is paramount.The analysis of agricultural water distribution systems entails two fundamental rules, where the distribution methods encompass both manual (hand watering) and automated (automatic watering) systems.The automatic watering systems include tube watering, capillary mat watering, overhead sprinklers, and drip irrigation mechanisms.
In this paper, we utilize freely available components to emulate conservationists' practices, such as the Raspberry Pi, reducing costs for deploying camera sensor systems.We select the Raspberry Pi Model 3B+ for its features and compatibility with TensorFlow, chosen for their user-friendly interfaces and machine learning capabilities.The contributions of this research paper are outlined as follows: ➢ A thorough investigation of prominent literature on soil crack detection utilizing machine learning and deep learning methodologies is undertaken.➢ The introduction of a soil crack detection problem is proposed, employing a pre-trained Inception V3 Convolutional Neural Network (CNN) model for classifying various soil crack detections.➢ A comprehensive soil dataset is meticulously compiled and organized.➢ The proposed model is trained with a CPU to achieve optimal accuracy and minimal validation loss, significantly enhancing its suitability for integration into Raspberry Pi applications, thereby strengthening their capabilities in precise data processing and decision-making tasks.➢ The required libraries and software frameworks are installed, utilizing TensorFlow backend for model development and integration with the Raspberry Pi. ➢ Finally, an automatic watering system is implemented and driving the pump motor control system based on the detected crack condition.
The remaining sections of this paper are in section 2 elucidates the pertinent knowledge and outlines the proposed architecture for crack detection using Deep learning model, while section 3 outlines the dataset collection preprocessing and methodology utilized.Section 4 conducts experimental validation, showcasing outcomes from the proposed model alongside analogous comparative models and a detailed discussion is presented on the obtained results.Finally, Section 5 provides a summary of the main points and concludes of this study.

B. Related Works
Researchers have primarily concentrated on studying soil crack development and morphology, along with quantitative measurements to comprehend crack patterns [16].[17] have also employed diverse methods to analyze, predict and quantify crack formation in expansive soils.Despite limitations in traditional crack detection methods, newer methods utilizing modern technologies have spurred development.Within Digital Image Processing, Machine Learning and Deep Learning algorithms are prevalent methods for crack detection and recognition.Machine learning-based methods, such as support vector machine (SVM) [18] and extreme learning machine (ELM) [19], are utilized to classify cracks in concrete from input images, enabling the handling of large datasets.Additionally, Andrushia et al. [20] explored crack detection techniques for concrete structures exposed to fire, analyzing images in the transformed domain to identify and pinpoint crack locations.In various machine learning approaches, a crucial initial step involves extracting features to understand input images.Feature reduction techniques are then applied to optimize feature selection, often employing Principle Component Analysis (PCA) for informative feature sets.These selected features are fed into classifiers, such as K Nearest Neighbor (KNN), Artificial Neural Networks (ANN), Fuzzy Logic with Support Vector Machine (SVM), and Genetic Algorithms with SVM, to accurately detect cracks in input images [21].Traditionally ,pattern recognition involves pre-processing, feature extraction, segmentation, classification, and recognition, each stage offering opportunities for algorithmic intervention.However, feature extraction presents a challenge as it depends on user-provided high-level features, possibly compromising detection accuracy.This challenge is addressed by employing deep learning techniques capable of automatic feature extraction and handling large input volumes.
Deep learning, a rapidly advancing artificial intelligence tool, has revolutionized pattern recognition, showcasing superior performance compared to traditional machine learning methods [22].These methods leverage convolutional neural networks (CNNs) to extract intricate spatial and textural features from soil images, enabling accurate crack identification and quantification.Several studies have explored the efficiency of deep learning techniques, including CNN architectures, for soil crack detection, demonstrating promising results.Researchers have effectively employed deep convolutional neural networks (CNNs) for concrete crack detection [23], utilizing architectures like U-net with residual connections.For pavement crack detection, ensemble networks and encoder-decoder architectures have achieved 92.1% accuracy [24].Deep learning models have also been utilized for concrete structure crack detection, comparing multiple pretrained models [25].Additionally, four deep neural models, including customized CNN models, VGG-19, and ResNet-50, are used for soil shrinkage crack detection, showing improved accuracy over pretrained models.Determining foundation types relies on soil type accuracy, driving the development of deep learning-based approaches.In agriculture, deep learning methods such as U-net and FCN-8s are investigated for crop/weed discrimination, with FCN-8s achieving 75.1% accuracy in detecting weeds and U-net performing better in detecting crops with 60.48% accuracy.The adaptability of Raspberry Pi system has also made it integral to robotics projects, serving as the computational backbone for controlling and coordinating robotic systems [26].Moreover, in sensor networks, the Raspberry Pi offers a convenient platform for collecting, processing, and transmitting data from distributed sensor nodes, facilitating diverse sensing applications [27] [28].
Our study investigates the Raspberry Pi's effectiveness in detecting soil cracks using a pre-trained Inception V3 model for automatic tube water irrigation systems.Leveraging TensorFlow and transfer learning is trained on images from the Pi camera module, aiming to detect soil crack images efficiently.

C. Research Method Dataset Creating
To detect the soil crack for agricultural water distribution approach,we employed transfer learning to develop a CNN of deep learning algorithm.The transfer learning model adeptly utilizes images from our proprietary dataset while also capitalizing on established datasets such as ImageNet [29] and VIPeR [30].The ImageNet dataset, curated by Stanford University, categorizes images into classes.The resource of ImageNet dataset simplifies the process of accessing, downloading, and utilizing a substantial pool of images for supervised learning tasks.In contrast, our custom dataset consists of soil images captured in various agricultural regions of Myanmar, encompassing diverse perspectives and lighting conditions.In this system, a dataset comprising 500 images is established in each categories, with crack images labeled as 'crack' and uncrack images as 'no crack'.All images are captured using a Pi camera with a specific resolution.The dataset, comprising 1000 images, is subsequently utilized for training, testing, and validation purposes.Preprocessing is essential to enhance image analysis accuracy, achieved through Python OpenCV to resize images to 299x299x3, facilitating better feature detection for tracks, cracks, and scratches.This dataset is provided to assess model performance in contemporary surveillance systems.

Inception v3
Inception v3 is utilized for classification and recognition tasks in this paper.Deep learning frameworks, categorized into non-symbolic (e.g., Torch and Caffe) and symbolic (e.g., TensorFlow, Theano), offer distinct advantages.While nonsymbolic frameworks require manual optimization and are less easily modified, symbolic frameworks automatically optimize and exploit memory reuse more effectively.The versatility of Inception V3 is evident in its capacity to adapt vast datasets and accommodate images of different sizes and resolutions.This flexibility is particularly significant within the medical imaging field, where images can vastly differ in their dimensions, resolutions, and overall quality.Typically, the Inception, as detailed by Ting et al. in 2017, incorporates a combination of one maximum pooling layer and three convolution layers of varying sizes.This module serves to aggregate channels from the preceding layer, followed by a non-linear fusion operation.In this specific model, the inclusion of the Inception module ensures that over fitting is mitigated while simultaneously enhancing the network's expressive capability and adaptability to diverse scales.In the Inception-v3 procedure, a transfer learning approach is employed.It, presented in Equation 1, is a pre-trained deep convolutional neural network consisting of 48 layers.It excels in the task of learning and identifying intricate patterns and features within crack images.Its primary capability lies in its adeptness at discerning complex patterns and features present in crack images.
In order to prevent over fitting, the output layer is flattened and reduced its dimensions into one.Subsequently, a sigmoid layer was incorporated for classification, along with a fully connected layer containing 1,024 hidden units.We employed a Relu activation function, denoted as Equation 2, and applied dropout with a rate of 0.4 to further enhance performance.
( ) max(0, ) For initializing the weights of the classification layers, we followed the algorithm outlined in (Beauxis-Aussalet and Hardman, 2014), presented in Equation 3.This strategy effectively enabled us to utilize Inception V3 for our specific objectives. (3) The parameters of the preceding layer are retained while the last layer is removed.The soil dataset is then introduced to retrain the new last layer, adjusting the number of output nodes to two different soil crack categories.By employing the backpropagation algorithm, the last layer of the model can be trained effectively, and the weight parameters are adjusted by calculating the error between the output of the SoftMax layer and the label vector corresponding to the given sample category using cross-entropy of the cost function [31] .

System Design
The main steps included in the methodology of this system encompass dataset creation, preprocessing, and training, testing, and validation.Dataset creation is fundamental, necessitating the generation of a comprehensive dataset for accurate outcomes.Figure 1 shows the block diagram of overall system.Once the necessary components, including the Raspberry Pi 3 B+, SMP 0023 Pi camera module, HDMI cable,7inches display monitor, external keyboard, mouse, and power supply, are selected.They are interconnected with the Raspberry Pi.It undergoes installation of the operating system and configuration of modules to facilitate the operation of the image classification system.This next setup, the pretrained and tested program code from the computer.If the simulation performance on CPU obtained higher accuracy, it would be deployed onto the Raspberry Pi.Finally, training, testing, and validation are conducted utilizing TensorFlow learn package in Python and the Inception v3 model, ensuring robust performance in crack detection.Additionally, the relay and water pump are integrated with the Raspberry Pi to establish the water distribution system.As the image classification system achieves satisfactory accuracy results, the relay is triggered, initiating the continuous operation of the water pump for efficient water distribution.Figure 2 shows the flowchart of this system.

Plants Watering System
After soil crack has been detected, the automatic watering system will initiate its operation.In the event that the soil is identified as cracked, the water pump will activate and run for approximately 5 minutes, ensuring sufficient hydration to mitigate soil degradation.Conversely, if the soil is recognized as intact with no cracks, the water pump will remain off, conserving resources and minimizing unnecessary irrigation.This automated process optimizes water usage by delivering targeted hydration precisely where it is needed, thereby promoting efficient and sustainable plant growth practices.

D. Result and Discussion
This research is divided into two sections, aiming an optimal model for accurately identifying and classifying different soil types based on crack and continuously followed by an exploration of its real-world applications.There are two sections as software and hardware implementation on CPU and Raspberry Pi Computer.

Experimental Setup in CPU
Data are collected as capturing crack and no crack images using a Pi camera, resulting in a dataset comprising 600 crack images and 600 no crack images organized into subfolders for training purposes.Subsequently, a testing dataset is curated with 60 crack images and 60 no crack images, similarly organized into subfolders for evaluation.The dataset needs manual screening, and each soil crack target must be labeled.To meet the experiment's criteria, the soil image dataset was divided into training, testing, and validation sets at an 8:1:1 ratio for model testing.The experimental setup on CPU is listed in Table 1.Table 1 highlights important parameter settings used in training.It primarily employs the default stochastic gradient descent (SGD) method for optimization.However, it also mentions the option to use the adaptive moment estimation (Adam) algorithm depending on the training conditions.Dataset images are meticulously collected using the Pi camera, capturing instances of both crack and no crack scenarios.Following the implementation of our pre-trained model within the Raspberry Pi environment, comprehensive training, testing and analysis are conducted to evaluate its efficacy.In Figure 6, the output results exhibit accurate classification as they pass through our system, demonstrating the model's capability to correctly identify crack images.Similarly, Figure 7showcases the successful classification of input no crack test images captured by the Pi camera, reaffirming the robustness and reliability of our system in distinguishing between crack and no crack instances with their respective precision percentage.These results underscore the effectiveness of our pre-trained model in real-world applications, offering promising insights into its potential for practical deployment in crack detection systems.

Performance Evaluation
The performance evaluation of soil crack classification with our pre-trained deep learning model is assessed using the accuracy, calculated as the ratio of correctly classified images to the total number of images.Specifically, accuracy is computed using the formula: Accuracy = (TP + TN) / (TP + TN + FP + FN), where , TP= the number of soil crack images correctly identified as soil crack, TN=the number of no soil crack images correctly identified as no soil crack, FP=the number of soil crack images incorrectly classified as no soil crack, FN=the number of no soil crack images incorrectly classified as soil crack In our evaluation, the accuracy of our soil crack classification model is determined to be 99.7%, reflecting the model's ability to effectively distinguish between soil crack and no soil crack instances with impeccable precision.

Discussion
Inception V3 is employed as a classifier, we conducted our experiments and implemented the model with cutting-edge alternatives, evaluating crack detection results both on CPU and Raspberry Pi Computer.Deep learning methods, while demanding longer training times due to their reliance on extensive operations and large datasets, offer superior accuracy compared to traditional machine learning approaches.Leveraging the Python programming language, the TensorFlow framework seamlessly supports the implementation of deep learning algorithms, providing a high-level interface that simplifies the image classification or recognition process.Importantly, the incorporation of a deep learning model does not escalate the overall cost of the system since our image recognition technology relies on freely available software and tools.Furthermore, the cost-effectiveness and efficiency of this water distribution system outperform those of pricier alternatives, rendering it ideal for agricultural applications.

E. Conclusion and Future Work
In this system, a Deep Convolutional Neural Network (CNN) serves as the cornerstone for extracting crucial features from images within the training dataset.The model of Inception v3 is employed to comprehend the underlying patterns within the training data and subsequently classify the test data accurately.The training of the model on Raspberry pi spanned 90 minutes across 12 epochs, averaging 18 minutes per epoch.Our experiments reveal a soil crack detection accuracy of at least 99 percent, with image classification occurring at acceptable speeds conducive to real-time processing.These outcomes suggest that a Raspberry Pi-based camera system, integrated with a deep learning model, can significantly aid conservation efforts.This system benefits conservationists exploring Raspberry Pi for monitoring soil cracks and water supply in agriculture.
In the future, we will explore additional optimization techniques, such as model quantization, integrating with IoT and cloud systems, and incorporating remote sensing control.Although these optimizations might result in a slight decrease in accuracy, they have the potential to significantly lower power consumption and memory requirements, ultimately improving the efficiency and scalability of our models.

F. Acknowledgment
This research initiative was undertaken within the esteemed laboratory facilities of the Department of Electronic Engineering at Mandalay Technological utilizes a pre-trained deep convolutional network to facilitate crack detection, employing a systematic approach to dataset construction and testing.The simulation results entail training the dataset with the Inception V3 model within the TensorFlow framework, augmented by visualizations of the training model graph through Tensor Board.
Figure 3 illustrates the visual representation of the soil crack or no soil crack classification model graph on Tensor Board, providing insights into the network's architecture.

Figure 3 .Figure 4 .Figure 5 .
Figure 3. Visualizing of Soil Crack Classification Model Graph on Tensor Board

Figure 6 .
Figure 6.Experimental Result of No Crack Image Classification

Figure 7 .
Figure 7. Experimental Result of Crack Image Classification