Professional Documents
Culture Documents
Jia 2023 J. Phys. Conf. Ser. 2504 012034
Jia 2023 J. Phys. Conf. Ser. 2504 012034
Series
Abstract. More than two-thirds of freshwater consumed worldwide are used for irrigation, and
the existing control system for irrigation and fertilization is not intelligent and efficient enough.
It is necessary to improve the utilization efficiency of irrigation water and fertilizer, and the
intelligent level of irrigation and fertilization system. We have built tomato fertilizer deficiency
and fertilization decision model based on leaf images and deep learning, this paper develops an
Raspberry Pi-embedded intelligent control system for irrigation and fertilization based on
previous deep learning models. The system included sensors, image acquisition, control part,
control panel and remote control, the type of main hardware and sensors were selected, and the
circuit of the system were designed. The C language is used to compile the source code of the
deep learning framework, and the Python language is used to compress the deep learning
model. The result shows that the compression rate of the deep learning model can reach 36.7%
and the decision-making time can be shortened by 36% under the condition of ensuring the
model accuracy. The Raspberry Pi-embedded intelligent control system can help farmers
improve the utilization efficiency of irrigation and fertilizer.
1. Introduction
The eater consumption for agricultural irrigation is the largest among all production departments in
China, and China is the country with the largest consumption of fertilizer in the world. At the same
time, agricultural irrigation has the disadvantages of uneven distribution of time and space, prominent
contradiction between supply and demand, low utilization efficiency and waste. These shortcomings
further aggravate the shortage of water resources in China. In order to improve the utilization
efficiency of irrigation and fertilization, many irrigate water and fertilizer demand laws and prediction
models have been established, the intelligent irrigation and fertilization controller, control technology
and systems were developed.
Gmez-Chabl et al. [1] developed the irrigation and fertilizer pump control system by using Internet
of Things technology, machine learning algorithm and embedded technology, the system can improve
the efficiency of irrigation water use. Wang et al. [2] developed an irrigation control system based on
Arduino controller by measuring environmental temperature and soil humidity through corresponding
sensors. Kansara et al. [3] used automated technology (AT) command to transmit data collected by
environmental and soil sensors to SIM900A module, which made decisions and sent the remote
control commands for irrigation and fertilization after receiving the data, it can help farmers realize
Content from this work may be used under the terms of the Creative Commons Attribution 3.0 licence. Any further distribution
of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI.
Published under licence by IOP Publishing Ltd 1
ICCBDAI-2022 IOP Publishing
Journal of Physics: Conference Series 2504 (2023) 012034 doi:10.1088/1742-6596/2504/1/012034
remote control of irrigation and fertilization. Zhu Jiangbo et al. [4] developed an intelligent platform
for peanut particle image classification using improved neural network image classification algorithm
and support vector machine feature extraction algorithm, which based on Zynq SoC embedded
platform and (Field Programmable Gate Array) FPGA hardware acceleration method. The
experimental results show that the platform has excellent classification accuracy. Shi Xiang et al. [5]
established an irrigation and fertilization control system based on STM32 chip, the system includes the
farmer, control station and the controller. In order to realize variable irrigation, the crop
evapotranspiration is determined by fuzzy decision using the remote sensing data. Wei Leilei et al. [6]
developed a fast and efficient water and fertilizer irrigation control model based on STM32 controller
and the Simulink tool, and realized the automation and accuracy of embedded water and fertilizer
irrigation system by adopting fuzzy PID control method and gray decision-making method.
In general, water-saving irrigation control has made great progress in both theory and technology,
and related systems and equipment can basically realize water-saving irrigation. However, in the
embedded development of precision control system for field and greenhouse irrigation water and
fertilizer, the independent research and development ability of related technologies and systems is
weak, which is mainly reflected in the low precision of irrigation and fertilization decision-making and
control algorithm, and the low integration degree of decision control model and irrigation and
fertilization system. Therefore, the rapid development controller and decision algorithm and fusion
method still need further research.
Based on the images of tomato leaf, we have built a deep learning model for tomato leaf region
segmentation and region information extraction [7]. In order to further improve the integration of the
deep learning model and the irrigation and fertilization system, and improve the intelligent level of the
irrigation and fertilization control system, this paper, The Raspberry Pi-embedded intelligent control
system for irrigation and fertilization based on deep learning were developed. The main research and
development work includes: embedded system hardware and circuit design, hardware type selection
and system circuit design, embedded environment deployment, deep learning model migration and
model compression.
2
ICCBDAI-2022 IOP Publishing
Journal of Physics: Conference Series 2504 (2023) 012034 doi:10.1088/1742-6596/2504/1/012034
camera of the control chip collects crop leaf images, and inputs the images into the deep learning
fertilizer model to achieve the classification of crop leaf deficiency and leaf segmentation. These
sensors acquisition part includes temperature sensor, humidity sensor, water flow meter, pressure
sensor, Conductivity of electricity (EC) and PH sensor, etc. to obtain the information of irrigation site.
The on-site control mainly adopts the signal output of Raspberry Pi to control the electric valve, head
pump and frequency converter. The remote monitoring computer connects Raspberry Pi through
secure shell (SSH) protocol or virtual network console (VNC) technology, and remotely controls the
irrigation and fertilization process through Raspberry Pi.
Due to the limited computing and storage capacity of commonly used single chip computers, and
the difficulty in obtaining the low-level development authority of programmable logic controller (PLC)
controllers, the deep learning model cannot be embedded into these two controllers, resulting in the
low level of intelligence of the irrigation and fertilization system developed based on conventional
controllers. The controller model selected in this paper is Raspberry Pi 4B, the main frequency of this
controller reaches 1.5GHz, with 4G RAM and 400MHz Video Core IV GPU. The soil moisture sensor,
flow meter and pressure sensor measure the soil moisture, water transmission pipeline pressure and
flow, and transmit the detected analog signal to the controller through the AD module. When irrigation
and fertilization are required, the digital signal output by the controller is converted and transmitted to
the frequency converter through the DA module, and the frequency of the water pump is controlled by
adjusting the signal output to the frequency converter, the system realizes the regulation of irrigation
pipeline pressure and flow. At the same time, the controller outputs digital signals to the relay, which
controls the solenoid valve to achieve accurate control of fertilizer application. The models of relevant
hardware components are shown in Table 1:
Table 1. The main hardware type selection
Hardware type Product type Hardware type Product type
3
ICCBDAI-2022 IOP Publishing
Journal of Physics: Conference Series 2504 (2023) 012034 doi:10.1088/1742-6596/2504/1/012034
When the deployment of the OpenCV dependent environment and relevant tools is completed,
create a compilation target in the source code folder using the cmake tools. After creating a new build
folder, select the compilation method, installation directory and additional modules loaded, and then
use the sudo make command to compile. This process may take a long time, two hours later, the deep
learning fertilizer recognition model in the article was successfully complied to obtain binary files.
The compiled binary file is installed using the sudo make install command. After the installation is
successful, we use the Raspberry Pi to call the OpenCV library and test the RGB channel separation of
tomato leaf images, as shown in Figure 2, the results indicate that the separation was complete, which
indicating that the OpenCV environment is successfully deployed.
4
ICCBDAI-2022 IOP Publishing
Journal of Physics: Conference Series 2504 (2023) 012034 doi:10.1088/1742-6596/2504/1/012034
the website(https://pytorch.org/), and the dependency tools and third-party libraries that need to be
installed for FCN model are shown in Table 3:
Table 3. The tools and third-party libraries for the FCN
Tools & libraries Introduce
When these dependency libraries were installed, the official Python source code files were
download using the git command, The wheel environment file package were compiled using the
command of python3 setup.py bdist_wheel. These installation process also takes about five hours. The
Python environment deployment is completed after installing the compiled file. After the deployment
of Python and related dependent environments is completed, the FCN deep learning model were
migrated to the Raspberry Pi controller. The migrated model is used for static segmentation of blade
images. The successful segmentation of the image indicates that the embedded model environment
deployment and model migration have been completed.
5
ICCBDAI-2022 IOP Publishing
Journal of Physics: Conference Series 2504 (2023) 012034 doi:10.1088/1742-6596/2504/1/012034
The base networks of two deep learning models in this paper are VGG16, the base network
structure diagram of the VGG16 is shown in Figure 3. This study mainly tailors the basic network
layer of the FCN model and verifies the performance of the trimmed model.
The VGG16 network has five convolution blocks, and the naming method is "convolution block
number-convolution layer number in the block". In this study, the name of the second convolution
layer in the third convolution block was named Conv3-2. The Inter-layer clipping starts from the
deepest Conv5-3 convolution layer, and clipping layer by layer to the shallow layer, one more layer is
clipped each time until the Conv4-1 convolution layer. The total pruning group have 6 groups, a total
of 7 groups with the original model without pruning. The model size, mIou, mPA, and operation time
of deep learning models with different structures were compared, the performance statistical results of
different compression models are as follows shown in Table 4.
Table 4. The performance statistical results of different compression models
Pruning Stratege Size (M) Ratio (%) mIoU mPA Time (s)
According to the above table, the size of the model gradually decreases and the operation time
decreases accordingly with the layer-by-layer pruning of the convolution layer. At the same time, the
model performance parameters of both the mIou and mPA decrease to varying degrees. In the control
group, the size of the original model of the first group is 71.1M, and the calculation time of a single
image of the embedded system is 12.6s. When the seventh group is trimmed to 4-1 layers, the model
size is the smallest among seven models, and the compression rate is 24.1%, the minimum operation
time of a single image was 7.7s. The corresponding mIoU and mPA are 0.84 and 0.86, respectively,
these are 0.07 and 0.08 smaller than the data of original model, respectively, and the model accuracy is
seriously reduced, the result shows that the 4-1 convolution layer has a significant impact on the
model performance. The FCN model of group 6 has constructed 4-2 convolution layer, the mIoU and
mPA of the model are 0.90 and 0.92, respectively, which are 0.01 and 0.02 lower than those of the
original model, respectively. The ratio of the model size compression is 36.7%, but the running speed
of the model was increased by 35.7%. This drop of model accuracy is within acceptable limits, and the
model size and computation time are significantly reduced.
In general, the deep learning model has a large number parameters in the deep layer, while some
parameters of the deep model have little impact on the performance of the model, so some parameters
and convolution layers of the model are redundant, this result is consistent with the conclusion drawn
by Wei Yue[11]. For different data sets, different model compression strategies can be used to
eliminate unnecessary parameters in the model, and lightweight deployment of deep learning models
can be realized in embedded systems.
5. Conclusions
Based on tomato fertilizer deficiency classification and fertilization decision model based on leaf
images and deep learning, an Raspberry Pi-Embedded intelligent control system for irrigation and
fertilization based on deep learning was developed, which mainly completes the following tasks:
6
ICCBDAI-2022 IOP Publishing
Journal of Physics: Conference Series 2504 (2023) 012034 doi:10.1088/1742-6596/2504/1/012034
1) Main hardware type of control system was selection, which including camera, sensors, head
water pump, frequency converter, solenoid valve. The circuit of control system were designed, which
mainly includes the main waterway circuit connection design and AD/DA module.
2) The application of deep learning model in the controller is completed. The mainly specific
methods of the Opencv and Python environment deployment are described, and the OpenCV and
third-party libraries for two deep models were installed. The source code of these two models were
complied using the C language, and the model environment and migrated were successfully deployed.
3) In order to solve the problems of slow running speed, poor real-time performance and high
computing pressure of deep learning recognition model, the relationship between model compression
and accuracy is studied. The model space compression ratio is 36.7%, and the computing speed is
increased by 35.7%, which makes the deep learning model run faster and more accurately in the
controller.
The research object of this control system is tomato, later research can build deep learning models
for different crops and study different types of fertilizer deficiency. At the same time, the compression
method of deep learning model needs further research.
Acknowledgments
The authors wish to thank the other team-mates for useful comments and discussions. We would also
like to thank the anonymous reviewers for their comments. The work was partially supported by the
Shaanxi Province Key Research and Development Project [2022ZDLNY03-032].
References
[1] Gómez-Chabla R, Real-Avilés K, Morán C, et al. 2019.IoT applications in agriculture: a
systematic literature review[M]: ICT for Agriculture and Environment,2019.
[2] Wang E, Attard S, Linton A, et al. Development of a closed-loop irrigation system for
sugarcane farms using the Internet of Things[J]. Computers and Electronics in
Agriculture,2020,172.
[3] Kansara K, Zaveri V, Shah S, et al. Sensor based automated irrigation system with IOT: a
technical review[J].2015,6(6):5331-5333.
[4] Zhu jiangbo, Research on image classification algorithm of granular crops based on embedded
platform[D]. Harbin Institute of Technology,2019.
[5] Xiang Shi, Development of variable rate irrigation system based on uav remote sensing and
ground monitoring data[D]. Northwest A&F University,2020.
[6] Leilei Wei, Zhengying Wei, Yubin Zhang,et al. The rapid development of fertilizer irrigation
controller baded on MBD[J]. Water Saving irrigation, 2017(7):124-129.
[7] Weibing Jia, Haoran Wei, Zhengying Wei. Tomato fertilizer deficiency classification and
fertilization decision model based on leaf images and deep learning[C]. International
Conference on Computer, Artficial Intelligence, and Control Engineering(CAICE 2022),
doi:10.1117/12.2640974.
[8] N. Bharathiraja, Pydimarri Padmaja, S. B. Rajeshwari, Jagadish S. Kallimani, Ahmed Mateen
Buttar, T. Bheema Lingaiah, "Elite Oppositional Farmland Fertility Optimization Based
Node Localization Technique for Wireless Networks", Wireless Communications and
Mobile Computing, vol. 2022, Article ID 5290028, 9 pages, 2022.
[9] Bharathiraja N,Ravindhar N V, Joel John M, Pradeepa K , Gopirajan PV, & Nagu, B. . (2021).
Predictive analysis of agricultural crops in cloud computing using sensor networks. Solid
State Technology, 63(2S), 5461-5477.
[10] Bharathiraja, N. , Shobana, M. , Manokar, S. , Kathiravan, M. , Irumporai, A. , & Kavitha, S. .
(2023). The smart automotive webshop using high end programming technologies.
[11] Yue Wei, Shichao Chen, Fenghua Zhu, et al. Pruning Method for Convolutional Neural
Network Models Based on Sparse Regularization[J]. Computer Engineering,
2021,47(10):61-66.