Report ai project monitoring the health of cows using iot devices combined with lstm model for real data in agriculture

41 0 0
Report ai project monitoring the health of cows using iot devices combined with lstm model for real data in agriculture

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

HCMC UNIVERSITY OF TECHNOLOGY AND EDUCATIONFACULTY OF MECHANICAL ENGINEERING REPORTAI PROJECTMonitoring the health of cows using IoT devices combinedwith LSTM model for real data in Agri

Trang 1

HCMC UNIVERSITY OF TECHNOLOGY AND EDUCATIONFACULTY OF MECHANICAL ENGINEERING

REPORTAI PROJECT

Monitoring the health of cows using IoT devices combinedwith LSTM model for real data in Agriculture.

Instructor: Bui Ha Đuc Student:

1 Nguyen Tan Hoang 20134015 2 Nguyen Cong Quy

Trang 3

Monitoring the health of cows using IoT devices combinedwith LSTM model for real data in Agriculture.

In the increasingly developing world of technology, the application of IoT and artificial intelligence in agriculture has opened up new opportunities To take advantage of the strengths in the field of technology and the increasingly expanding development of AI, this report will focus on monitoring the health of cows in agriculture through the use of IoT technology and the LSTM model Firstly, the report will introduce the importance of monitoring cow health and how IoT can be applied in agriculture Next, it describes in detail the designed system, including the types of sensors used, the configuration of the device box, and the process of data collection and transmission The report continues to focus on data analysis and prediction of cow behavior The report introduces the AI LSTM model and how it is applied to predict behavior based on data from acceleration sensors The results from the AI model are analyzed and explained Then it describes the process of sending data to the web and how information is presented on the user interface To visualize and have accurate conclusions, an experiment is deployed, which describes the process of testing the system in a real environment and evaluates the performance and reliability of the system Finally, the report summarizes the main findings and proposes future directions.

1 Introduction

Agriculture plays a crucial role in the economy and development of every country Among this, cattle farming is an indispensable part, especially in providing quality food sources for humans Healthy cows will reproduce and produce milk more effectively Moreover, monitoring the health of cows also helps reduce labor costs and antibiotic use, while improving the sustainability of the farm However, traditional cow health monitoring is often costly and ineffective This is the main motivation to seek a new

Trang 4

solution, using IoT technology and LSTM models, to monitor cow health more effectively.

The main goal of this project is to apply IoT technology and LSTM models to monitor the health of cows, aiming to improve the quality of farming, reduce health risks, and optimize business performance The student research team hopes to create an effective, accurate, and reliable cow health monitoring system, contributing to the development of the agricultural sector in the future.

2 Overview of the topic 2.1 Livestock monitoring system

The livestock monitoring system, especially for cows, plays an important role in ensuring the health and productivity of the herd These systems use IoT devices attached to cows to collect data on their location, temperature, blood pressure, and heart rate This data is then sent to the farmer’s computer almost in real time

The benefits of using a livestock monitoring system include the ability to accurately track the health and activity of cows, detect early signs of disease, and optimize the farming process This not only helps increase productivity and profits, but also helps improve the lives of cows

To get a broader overview of the livestock monitoring system market, we can refer to some products currently on the market that are widely used and applied As well as looking at some products combined with the integrated technology structure inside those complete products.

First is Allflex Livestock Intelligence: They provide advanced livestock monitoring solutions to collect and analyze important data for each tagged animal Their technology monitors millions of animals worldwide Allflex’s dairy cow monitoring solutions provide actionable information based on data, based on superior temperature detection and real-time reproduction and health monitoring, for optimal productivity and management Their monitoring technology is used daily to observe millions of cows, with settings at tens of thousands of farms worldwide Allflex’s beef cattle monitoring solution helps producers increase the reproduction rate and maintain herd health By leveraging

Trang 5

superior estrus detection capabilities, producers can increase the fertilization rate, monitor reproductive status, and identify reliable replacement pigs

Allflex Livestock Intelligence uses a range of technologies to build their livestock monitoring system Allflex uses physical and electronic identification technology to identify each animal in a herd This technology includes the use of tags with multiple colors and printing options, as well as the use of RFID technology Allflex also uses tissue sampling technology to collect biological samples from livestock ears Information from biological samples can reveal the health status of each animal And based on livestock monitoring technology to collect and analyze important data for each tagged animal This technology helps manage reproduction, health, and nutrition.

Figure 1.

Secondly, I would like to mention SAS for Livestock Monitoring: SAS’s livestock monitoring system, supported by Microsoft Azure, helps large-scale livestock producers and buyers (for example, retail food chains) optimize the growth cycle, productivity, and quality of animals with improved health monitoring across all locations

SAS’s livestock monitoring system uses a range of advanced technologies: Easily deployable sensors combined with AI to collect data from livestock These sensors can

Trang 6

track growth, physical activity and characteristics, as well as livestock’s digestive output This system also uses AI to analyze data collected from sensors AI helps detect physiological abnormalities (for example, diseases and stress), providing important information for livestock health management Predictive analysis based on the cloud to monitor livestock effectively This technology helps improve quality, reduce costs, and predict output Automatic alerts: This system provides automatic alerts when systems are not restarted and optimizes plans and schedules for feeding Use real-time available information to improve supply and demand forecasts.

Figure 2.

And finally, I would like to mention a product from AWS - AGCO Livestock Health and Quality of Life Monitoring system With leading cloud technology, AWS has integrated many core services to optimize the livestock monitoring system AGCO is developing a smarter platform to empower farmers and integrators with the insights they need There are three major components to the platform:

Trang 7

Figure 3.

Load sensors on poultry feed containers and the Cumberland Broiler Hanging Scales platform transmit data to the central controller A receiving system to process data, run models, and estimate target indicators A self-service dashboard with detailed information, alerts, and predictions

2.2 Main components

The cattle monitoring system comprises four key components working together to enable remote health monitoring and data analytics.

• The wearable device fixed on the cow contains a set of sensors to measure vital parameters like motion, temperature, and location

• The microcontroller acts as the main processor on the device to acquire, process, and transmit sensor data wirelessly to the farm gateway

• Wireless technology is used for long-range communication between the on-animal device and the farm gateway.

• The cloud platform stores the data and runs analytics applications like machine learning to detect cattle health indicators The dashboard allows farmers to monitor key metrics and receive alerts.

This modular architecture with well-defined components working in conjunction enables the building of an extensible cattle monitoring IoT system for the farm Next, we dive into the details of each main component.

Trang 8

The wearable device fixed on the animal contains a variety of sensors to measure vital health parameters Motion sensors like accelerometers and gyroscopes can track the cow's movements and activities like standing, lying down, walking, etc Location sensors like GPS provide positioning coordinates and trace the animal's movement Biometric sensors like heart rate monitors, temperature sensors, etc give insights into internal health The number and types of sensors can be chosen based on monitoring requirements.

2.2.2 Processor

The wearable device contains an onboard processor like a microcontroller unit (MCU) or system-on-chip (SoC) The processor continually polls the integrated sensors, processes the incoming data, packages it into transmission packets, and outputs to the wireless module It provides the necessary computing capabilities for executing the device application firmware and algorithms Different MCUs offer varying processing power, flash storage, interfaces, power consumption, etc.

2.2.3 Communication

A wireless communication module on the wearable device transmits sensor data to the farm gateways Different protocols like WiFi, Bluetooth, Sigfox, NB-IoT, LoRa, etc can be chosen based on bandwidth, range, power, and cost needs For large farm scales, low-power wide area networks allow long range The gateways are equipped with compatible wireless technology to receive data.

2.2.4 Server

The sensor data from cattle is aggregated and forwarded by the farm gateways to a cloud-based server The server provides data storage in time-series databases, runs analytics applications like ML models for health monitoring, and hosts web dashboards The modular backend infrastructure enables storing high volumes of historical data, and on-demand analytics and provides access from anywhere.

2.3 General data processing

The main goal of the developed prediction framework is to build behavior recognition models in order to analyze the dairy cows’ behavior This framework includes two phases: training and validation The goal of the training phase (Figure3) is to create

Trang 9

supervised prediction models that can be applied to new sensor data, which are unknown to the model In this phase, the sensor data from a field experiment are labeled by a domain expert who observed the videos that were made during the experiment.

Figure 4 Procedure of two steps: preprocessing and model training

Since the data coming from sensors contain noisy data or inconsistent timestamps, they require the application of preprocessing techniques These techniques:

• Cleaning: The initial step involves cleaning the data to remove any inaccuracies or irrelevant information or missing value

• Normalization: Data from different sensors may be normalized to ensure consistency in scale and format, making it easier for analysis.

• Balance dataset: A balanced dataset is one where the target variable (or variables) has approximately the same number of instances across its different classes.

• Extract features: Key parameters that indicate cattle behavior or health status are identified

For instance, patterns in movement data from accelerometers might indicate grazing, resting, or abnormal behavior are needed to create necessary datasets for training and to enhance the accuracy of the learned models During the training of the model, the data are classified by a learning algorithm where the classes are the different behavioral patterns of dairy cows (Labels) The output of the training phase consists of learned models, which were created after the model training These models comprise training dataset specifications, which include the following:

• Which preprocessing techniques were applied • What should be predicted ( cow’s behavior ) • Which learning algorithm is executed • Which dataset is used for testing

Trang 10

• The result achieved (e.g., 90% accuracy)

2.3.1 What should be predicted

An example of timely disease prediction in cattle due to continuous behavior classification by a monitoring system can be described as follows:

Imagine a dairy farm that has implemented a sophisticated behavior classification system, equipped with sensors and machine learning algorithms, to monitor the health of its herd This system continuously tracks various indicators of cow behavior, such as activity levels, feeding patterns, and rumination times.

One evening, the system observes that Cow #47, usually active and with consistent rumination cycles, is suddenly showing a sharp decrease in rumination and an unusual increase in laying down time These behavior changes trigger an alert in the system Because the monitoring is continuous, the alert is immediately sent to the farmer's mobile device, signaling a potential health issue.

The farmer reviews the data and notices that Cow #47's behavior deviates significantly from her normal pattern and that of the herd Drawing on the insights provided by the system, which correlates such behavior with the early onset of mastitis, the farmer decides to conduct a physical examination of Cow #47 the next morning.

Upon examination, early signs of mastitis are indeed found, and immediate treatment is initiated The timely intervention, guided by the predictive alert from the behavior classification system, allows for a quick response that prevents the condition from worsening, promoting a faster recovery for Cow #47 and preventing the spread of infection to other animals in the herd.

This scenario showcases the critical role of continuous behavior classification in early disease detection, enabling proactive health management and minimizing the impact of diseases on cattle farms.

The ability to accurately classify the behavior of cows through a monitoring system holds immense value, particularly in facilitating rapid and precise diagnoses of health conditions by professionals By effectively identifying and interpreting various behavioral indicators, such as changes in activity levels or rumination patterns, specialists can

Trang 11

quickly detect anomalies that may signal health issues, including estrus and critical diseases like mastitis This proactive approach allows for timely intervention, which is crucial in managing the health and well-being of the herd, ensuring both the animals' welfare and the economic viability of farming operations With the aid of advanced monitoring tools that provide real-time data and historical analysis, experts can make informed decisions, optimizing the treatment process and potentially improving the overall health management of the livestock.

2.3.2 Which learning algorithm is executed

Long Short Term Memory networks – usually just called “LSTMs” – are a special kind of RNN, capable of learning long-term dependencies They were introduced by Hochreiter & Schmidhuber (1997), and were refined and popularized by many people in following work They work tremendously well on a large variety of problems, and are now widely used.

LSTMs are explicitly designed to avoid the long-term dependency problem Remembering information for long periods of time is practically their default behavior, not something they struggle to learn!

All recurrent neural networks have the form of a chain of repeating modules of neural network In standard RNNs, this repeating module will have a very simple structure, such as a single tanh layer.

The Core Idea Behind LSTMs

The key to LSTMs is the cell state, the horizontal line running through the top of the diagram.

The cell state is kind of like a conveyor belt It runs straight down the entire chain, with only some minor linear interactions It’s very easy for information to just flow along it unchanged.

Trang 12

Figure 5.The repeating module in a standard RNN contains a single layer

LSTMs also have this chain like structure, but the repeating module has a different structure Instead of having a single neural network layer, there are four, interacting in a very special way.

Figure 6.The repeating module in an LSTM contains four interacting layers.

The Core Idea Behind LSTMs

The key to LSTMs is the cell state, the horizontal line running through the top of the diagram.

The cell state is kind of like a conveyor belt It runs straight down the entire chain, with only some minor linear interactions It’s very easy for information to just flow along it unchanged.

Trang 13

Figure 7.

The LSTM does have the ability to remove or add information to the cell state, carefully regulated by structures called gates.

Gates are a way to optionally let information through They are composed out of a sigmoid neural net layer and a pointwise multiplication operation.

Figure 8

The sigmoid layer outputs numbers between zero and one, describing how much of each component should be let through A value of zero means “let nothing through,” while a value of one means “let everything through!”

An LSTM has three of these gates, to protect and control the cell state.

Step-by-Step LSTM Walk Through

The first step in our LSTM is to decide what information we’re going to throw away from the cell state This decision is made by a sigmoid layer called the “forget gate layer.” It looks at ht−1 and xt, and outputs a number between 0 and 1 for each number in the cell

Trang 14

state Ct−1 A 1 represents “completely keep this” while a 0 represents “completely get rid of this.”

Let’s go back to our example of a language model trying to predict the next word based on all the previous ones In such a problem, the cell state might include the gender of the present subject, so that the correct pronouns can be used When we see a new subject, we want to forget the gender of the old subject.

Figure 9

The next step is to decide what new information we’re going to store in the cell state This has two parts First, a sigmoid layer called the “input gate layer” decides which values we’ll update Next, a tanh layer creates a vector of new candidate values, that could be added to the state In the next step, we’ll combine these two to create an update to the state.

In the example of our language model, we’d want to add the gender of the new subject to the cell state, to replace the old one we’re forgetting.

Figure 10

It’s now time to update the old cell state, Ct−1, into the new cell state Ct The previous steps already decided what to do, we just need to actually do it.

Trang 15

We multiply the old state by ft, forgetting the things we decided to forget earlier.

Then we add This is the new candidate values, scaled by how much we decided to update each state value.

In the case of the language model, this is where we’d actually drop the information about the old subject’s gender and add the new information, as we decided in the previous steps.

Figure 11

Finally, we need to decide what we’re going to output This output will be based on our cell state, but will be a filtered version First, we run a sigmoid layer which decides what parts of the cell state we’re going to output Then, we put the cell state through tanh (to push the values to be between −1 and 1) and multiply it by the output of the sigmoid gate, so that we only output the parts we decided to.

For the language model example, since it just saw a subject, it might want to output information relevant to a verb, in case that’s what is coming next For example, it might output whether the subject is singular or plural, so that we know what form a verb should be conjugated into if that’s what follows next.

Figure 12

Trang 16

3 Module Design

3.1 Technical Requirements

Parameters to measure:

Motion - A 3-axis accelerometer is required to track the full motion along the X, Y, and Z axes The measurement range should be ±16g or more Resolution of 12-bit or higher provides adequate motion sensing sensitivity.

Location - A module GPS provides location accuracy up to 2.5 meters

Temperature - A digital temperature sensor with ±0.2°C accuracy, 0.1°C resolution, and fast response time below 5 seconds is needed to monitor body surface temperature The measurement range should cover at least 30°C to +50°C.

Sensor placement:

The sensor module will be housed in a rigid enclosure attached to a collar worn around the cow's neck This allows for sensing the movements of the cow.

Based on the parameters and sensor placement, we can derive the following device requirements:

• Size - The module should be compact and lightweight to fit on a collar A target size of 118x55x58 cm or less and weight under 200 gm is estimated.

• Power - a battery power source with multi-day operation Low-power sensors and processing will maximize operation time.

• Communication - Wireless protocols like LoRa allow data transfer to the farm gateway from the collar-mounted device Range, bandwidth, and power consumption

Trang 17

Figure 13

3.3 Calculation of component selection 3.3.1 Power block

In the farm environment, to save energy as well as timely data supply for diagnosis and abnormal detection, we can choose the measurement cycle is 5 minutes and each measurement is 1 second Based on this, we will calculate the battery capacity needed for each monitoring box along with the accompanying devices Based on the information searched through the technical parameters:

MPU9250 (Accelerometer, Gyroscope, Magnetometer): Normal operating current of Accelerometer: 450µA When in standby mode, MPU9250 consumes about 8µA Operating time in each cycle: 1 second / 5 minutes

NEO-6M GPS Module: Average current consumption: about 45mA or 67mA depending on the operating mode When in standby mode, NEO-6M consumes about 6mA Operating time in each cycle: 1 second / 5 minutes

NTC Thermistor Sensor: Average current consumption: very low consumption and does not affect the normal working current Operating time in each cycle: 1 second / 5 minutes

Trang 18

LoRa RA-01 Module with SX1278: Average receiving current: less than 10.8mA Average transmitting current: less than 120mA When in standby mode, LoRa RA-01 consumes about 1.6mA Operating time in each cycle: 1 second / 5 minutes

Arduino Uno: Average current consumption: about 120mA When in standby mode, Arduino consumes about 19 mA Operating time in each cycle: 1 second / 5 minutes

And based on the current demand based on the battery to be able to supply the monitoring box is not constrained space proposed with lithium-ion battery current about 5V And assuming the Battery will operate within 1 month Then the operating time in 1 hour will be 12 seconds

Energy Demand (Wh) in an Operating Cycle:

E activity=P activity×t activity

E activity = EMPU9250+EGPS+EThermistor+ELoRa+ERaspberry Pi E activity = (0.00045+0.045+ 0 +0.0108+0.12)×5× 3001 = 0.00294 Wh E activity : Energy needed for each operating cycle (Wh)

P activity : Power consumption in each operating cycle (W) t activity : Operating time in each cycle (h)

Energy Demand (Wh) in Standby Mode:

E standby= standby× standbyP t

E standby = (0.000008+0.006+0.0016+0.019)×5× 299300 = 0.1326 Wh E standby: Energy needed in standby mode (Wh)

P standby : Power consumption in standby mode (W) t standby : Standby time in each cycle (h) Total Energy Demand (Wh) in a Cycle:

E total=E activity+E standby = 0.1355Wh ETotal : Total energy needed in each cycle (Wh)

Trang 19

Battery Life (Number of Operating Cycles before Battery Replacement): (assuming 2000mAh Battery)

Battery Life= Battery Capacity / E Total= 2000 mAh× 5 V0.1355Wh =74period ≈ 6.17h Battery Life: Battery life is measured by the number of operating cycles before the battery needs to be replaced (cycle)

So if we want to use it for 1 month (30 x 24 hours) Required Battery Capacity (Ah):

Battery Capacity= Etotal × Battery LifeBattery Voltage = 0.1355 7205× = 19.512 Ah Battery Capacity: Required battery capacity (Ah)

Battery Voltage: Battery voltage (V)

But with this project to continuously deploy for easy data monitoring, data will be taken every 1 second

3.3.3 Wireless communication block

To choose the appropriate wireless communication technology for the project, the following 5 evaluation criteria are considered:

Coverage and range: The range and coverage of wireless technology greatly affect the operation of the monitoring system

Compatibility with other devices: The technology should not be compatible with other devices in the system such as the central processor, sensor block

Cost and complexity of development: The cost must be suitable for a whole system of receiving and transmitting devices And the complexity of upgrading the system when wanting to optimize performance later

Trang 20

Security and reliability: Security is also an important factor when choosing wireless technology, choosing a type of communication with safe security with data as well as high data reliability

Scalability: Wireless technology should allow the system to be easily expanded when

necessary, as the number of dairy cows can increase or decrease at each stage 

 Based on these criteria and analysis of a popular wireless communication typeLoRa.

Figure 14

Coverage and range: LoRa (Long Range) is a wireless communication technology

developed to create wide-area, energy-efficient networks necessary for Internet of Things applications LoRa can transmit data over large distances, which is very important for monitoring livestock on a large scale

Energy saving: IoT devices often operate for a long time without needing to be charged or have their batteries replaced LoRa is an energy-saving technology, which helps extend the battery life of IoT devices

Scalability: LoRa supports networks with a large number of devices, which is very useful when you want to expand your system

Reliability: The reliability of wireless connections is very important, especially when monitoring the health of livestock LoRa provides reliable wireless connections, even in harsh environmental conditions

Ngày đăng: 09/04/2024, 16:12

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan