You are on page 1of 36

ANIMAL DETECTION AND PREVENTION IN

AGRI FIELD USING IOT


ABSTRACT:
In this paper, Animal detection and prevention in agriculture .The animals

destroy the crops in agriculture land and farmers are suffer in huge level. This

proposed model presents the development of the Internet of Things and

Machine learning technique-based solutions to overcome this problem. Our aim

is to prevent these type of attack from the animals in agriculture land with the

help of certain sensors and buzzer compounds. The machine learning runs the

yolov3 darknet is a convolutional neural network that acts as a backbone for the

YOLOv3 object detection approach. These camera and sensor detects the

moment of animals in agriculture land if it detects the animals then sends the

alert message to the farm owners. And also make a sound to clear the animals in

farm, the sound is differ for each animals. The sound is depend on the animal

which cause damage in the agriculture area. The animal is detected by a sensor

and identified through the pre-loaded data sets in a raspberry pi and the certain

sound is made and also sent the alert notification along with the animal which

cause attack in agriculture land. The farmer can stop the buzzer sound through

his mobile application

KEYWORD: Animal detection, buzzer sound ,camera ,sensor, raspberry,


agriculture
CHAPTER 1
INTRODUCTION
Due to over population it takes place a deforestation this effects in
scarcity of food, water and refuge in wooded area regions. So, Animals
interference in residential regions is growing each day which influences human
existence and assets reasons human animal war however as in keeping with
nature’s rule each residing creature in this earth has vital function in eco-
system. Agriculture is the spine of the financial system however due to animal
interference in agricultural lands, there might be big lack of plants. Elephants
and different animals coming in to touch with humans, effect negatively in
diverse approach which include with the aid of using depredation of plants,
unfavourable grain stores, water supplies, homes and different assets, injuring
and demise of humans. Farmers in India face serious threats from pests, natural
calamities &damage by animals resulting in lower yields Traditional methods
followed by farmers are not that effective and it is not feasible to hire guards to
keep an eye on crops and prevent wild animals. Since safety of both human and
animal is equally vital. So, animal detection system is necessary in farm areas.
India is an agricultural country. Agriculture has continuously been India’s most
essential economic sector. Though most of the India’s population is predicated
upon on agriculture, there are however masses many issues faced via farmers.
Human animal conflict is a primary hassle wherein massive amount of property
is out of place and human life is in danger. In modern times the numbers of
these varieties of conflicts are increasing. So this region is to be monitored
continuously to prevent get admission to of this shape of animals or any other
unwanted intrusion. Human-animal conflicts arises due to encroachment and
poaching, people by skip into the wooded region to meet their livelihood, for
claiming of land for agricultural practices and speedy industrialization motives
spreading of metropolis ground and animals enter the nearby villages for water
in some unspecified time in the future of the summer season season due to
dryness in water body. Elephants or wild boar tramp the flowers in farm land in
need of nutritious food. Need of the animal or human positioned the alternative
in real danger, in this process, property are spoiled and occasionally even the
life is out of place. Human- elephant conflict is more in south Asia and in
Africa. Usually farms are included with electric powered fence, animal which
tries to enter the sector behave in odd manner.

IoT (Internet of Things) controls the Things that are connected to it and
transfers the data over the network. The IoT technology enables the collection
of real-time data from the farm field using Sensors and various electronic
components . In this work, we present the coordination of Pi Camera, LED, and
Buzzer interacting with the cloud a new service in the domain. The peripheral
part adopted wireless technologies such as WiFi for cooperating with the data
center by an advanced IoT gateway. Pi Camera is used to capture real-time
images in a farm field 24 × 7 i.e., day and night. The low cost and ease of
programming controller Raspberry Pi for coordination of hardware part and data
transferred through ESP8266 WiFi module, which uses TCP/IP protocol 

1.1 SCOPE OF THE PROJECT:

The main scope of this project is to develop an animal which cause the
damage agriculture land .The design system will not be dangerous to animal and
human being, and it protects farm.

1.2 OBJECTIVE OF THE PROJECT:

To protect the plants in agriculture land from the birds and animals, then
to video display units the agriculture area to prevent from the outside attacks
through animals and want to send the information to the farm owner .And the
immediate action to be taken for reduce the attack from the animals and also
now no longer to damage the animals physically.

CHAPTER 2
LITERATURE SURVEY
2.1 Introduction
The various research works on the existing animal detection model using
IoT are discussed and analysed.
1. TOPIC: Automatic Tracking and Alarm System for Eradication of Wild
Life Injury and Mortality
AUTHOR: Nirit Datta and Souvik Sarkar
This paper report explains the methodology to overcome the problem of human
and animal injury and mortality due to the straying of wild animals out of the
national parks and wildlife sanctuaries by the use of automatic tracking and alert
system. Automatic tracking and alert system has been implemented by
incorporating GSM and GPS technology in the form of a device that would be
attached to the body of an animal and would be continuously monitoring the
position of the animal with respect to the GPS defined boundaries set up inside
a wildlife sanctuary or national park. In case an animal strays out of the GPS
defined zone, an alarm system that will be installed in a human populated zone
will go off, informing people about the approaching danger. This system is
flexible, cost effective and easy to implement and can be beneficial for
monitoring wildlife related complexities like poaching, railway and roadway
accidents, train delays, destruction of vegetation and threat to human life on the
occasion of straying of wild animals out of their habitation zone.
2. TOPIC: A Practical Animal Detection and Collision Avoidance System
Using Computer Vision Technique
AUTHOR: Sachin umesh sharma and dharmesh j. Shah
One serious problem that all the developed nations are facing today is death and
injuries due to road accidents. The collision of an animal with the vehicle on the
highway is one such big issue, which leads to such road accidents. In this paper,
a simple and a low-cost approach for automatic animal detection on highways
for preventing animal-vehicle collision using computer vision techniques are
proposed. A method for finding the distance of the animal in real-world units
from the camera mounted vehicle is also proposed. The proposed system is
trained on more than 2200 images consisting of positive and negatives images
and tested on various video clips of animals on highways with varying vehicle
speed. As per the two-second rule, our proposed method can alert the driver
when the vehicle speed is up to 35 km/h. Beyond this speed, though the animal
gets detected correctly, the driver does not get enough time to prevent a
collision. An overall accuracy of almost 82.5% is achieved regarding detection
using our proposed method.
3. TOPIC : IoT based animal tracking and monitoring system in Zoo
AUTHOR: R.Shanmugasundaram and S.Pavithra
The goal of this project is to track the location of Animal in the zoo or national
parks. This system would include a temperature sensor and PIR sensor. The
temperature sensor senses the temperature of each animal and PIR sensor senses
the human presence inside the animal boundaries or restricted areas. Generally
every animal having particular range of body temperature. If the animal having
any wounds or fever, the body temperature will be automatically increased. To
monitor this, we are using temperature sensor. It continuously monitors the
animal‟s temperature. If any variation in the temperature, It will be displayed on
the LCD. The PIR sensor is used to monitor the human presence in restricted
areas or nearby the animal boundaries. When the human presence is detected,
the voice processor will give alert to the people through the pre-recorded voice.
The GPS receiver send the location, animal temperature to the controller and it
is interfaced with the IOT, It will give the complete information to the website
on PC or laptop
4. TOPIC: Animal Intrusion Detection System Using Wireless Sensor
Networks
AUTHOR: Dr. P. Uma Maheswari and Anjali Rose Rajan
The animal intrusion detection system is incredibly essential in numerous fields
like villages close to forests, roads through forests and agricultural fields.
Attacks from animals area unit common all told these fields. A system is created
victimization sensors to notice the tress passage of those animals. It helps to
induce privy to the encroaching of untamed animals and birds. The system for
birds is that the acoustic sounds area unit made within the encompassing area
factor of the agricultural fields wherever the arrival of birds area unit detected
and therefore the birds are unbroken removed from the realm. Once the
associate degreeimals arrive or trespasses an alert message is provided to few
individuals within the needed space who will lead the individuals around from
destruction. And that they can also take necessary actions to stop attacks of the
trespassers. Applications that area unit vital area unit preventing animal
bumping to vehicle on roads, preventing dangerous animal intrusion in
residential district, knowing locomotive behavioral of targeted animal and lots
of additional. Within the agricultural areas placed close to the forest several
animals destroys the crops or perhaps attack on individuals so there's a desire of
system that detects the animal presence and offers warning this within the read
of safety purpose. During this project the aim is to notice the animals who
crossing their boundary and offers the attentive to the system to require sure
action
5. TOPIC: A Literature Survey on Animal Detection Methods in Digital
Images
AUTHOR: Boon Tatt Koik and Haidi Ibrahim
Animal detection based researches are useful for many real life applications.
Animal detection methods are helpful on the research related to locomotive
behavioral of targeted animal and also to prevent dangerous animal intrusion in
residential area. There are a few branches of research related to animal
detection. Therefore, this paper will survey some of these branches. Researches
regarding animals in image processing have been an important field to
numerous applications. Many algorithms and methods have been developed by
human being in order to have a better understanding on animal behaviour.
Besides, these applications also can act as a warning system to human being
from intrusion of dangerous wild animal for early precaution measures. These
applications can be narrowed down to three main branches, namely detection,
tracking and identification of animal. This paper will give more attention and
review for animal detection methods. The review also limited to the methods
that use digital images or digital video. This review will be given in the next
section.
6. TOPIC: Moving object detection based on background extraction
AUTHOR: C. Peijiang
Moving object detection is a very important research topic of computer vision
and video processing areas. The process of moving object detection based on
the background extraction is divided into two steps, background extraction and
moving object detection. Improved method of obtaining background image
based on common region is cited. The basic idea is to capture a series of video
pictures of the scene at regular intervals, the picture is divided into of m*m
blocks which expectation and variance are calculated respectively to describe
the vector information of the region. A new acquiring threshold method is
brought forward when extracting the moving object. The arithmetic mean of
original iterative method is replaced by weighted mean and the average gray of
the foreground is higher than the average gray of background. Then, the
threshold is also increased to some extent. The introduction of the smoothing
coefficient can avoid the mutation of current threshold. The experiments show
that the scheme can realize the moving object detection effectively, and it has
high definition.
7. TOPIC: A dynamic RFID-based mobile monitoring system in animal care
management over a wireless network
AUTHOR: J. S. L. Ting, S. K. Kwok, W. B. Lee, H. C. A. Tsang, and B. C. F.
Cheung
Due to the increasing integration of animals into family lifestyles, animal care
management becomes an important issue as animals have a direct impact on
human psychological and physical health. Even though there are a lot of
solutions, maltreatment of animals and risks in animal health are increasing as
indicated in the newspapers and statistics. In addition, many identification
methods are not efficient and user-friendly. In this paper, an RFID-based mobile
monitoring system (RFID-MMS) is designed in helping users to better manage
the animals in dynamic information retrieving, location tracking, and behavior
analyzing over a wireless network. The proposed system, which is suitable for
using in all animals unities, enhances the companionship between humans and
animals.
2.2.EXISTING SYSTEM:
Raspberry pi4 is used to run a machine learning algorithm. Pi cam is used to
capture the intruder images entering the agricultural field. The images are then
analyzed by the machine learning algorithm running on the Raspberry pi board
and conclusions are drawn as an output of machine learning algorithm. If any
danger is sensed the Raspberry pi generates sounds of different frequencies with
the help of a buzzer and an input signal is sent to ESP8266 nodemcu which is in
communication with the firebase IoT cloud which sends messages to the farmer
through the android application . If the intruder is detected at night, the LED
lights and buzzer are triggered simultaneously to divert the intruder away from
the field.The module is made to identify the animals and start the buzzer sound
to alert farm owner.It helps the farm owner to know the incident took place in
their farming land and the measures can be taken.

CHAPTER 3
PROPOSED SYSTEM
3.1 PROPOSED SYSTEM:
The proposed model consists of two parts as Hardware and Software.
Raspberry pi acts like a heart for the hardware part and it is interfaced with
components like a voltage regulator, Pi Camera, WiFi, and Buzzer
The software part for the hardware is done through ANDROID application
animal prediction used machine learning models like darknet yolo v3 for object
detection and predicts the animals issue we proposed to designed a system
audio recorder and player is fixed the sound is differ for each animals. The
sound is depend on the animal in which sound is played. So that wild animals
will not enter into the farm. It will run away.
CLASSIFICATION OF CLASS MODEL
fig 1: classification of class model

DETECTION AND ALART


fig 2: detection and alart

WORKING
Our project aim to detect two type of animal, elephant and wild pig. These two
animals are entirely collapse the agri land and products. So our system used
surveillance based animal detection to avoid these kind of disasters
3.2 MODULES:
They are four modules
 Detection Module

 Alarm Module

 Connectivity Module

 Message Module

3.2.1. DETECTION MODULE


Here we used camera for detection and surveillance process. The yolov3
darknet based model have some pre- trained animal image like(dog, cat,
elephant,..) from this model we filtered two animals are elephant and wild pig.
Once elephant or wild pig entered in camera zone. The animal based on
unsupervised shape and it will be throw the class of the animal (or label). We
are find out the animal detection based on label

3.2.2. ALART MODULE


Here we applied alarting system incase animal detected on frame
We used two alartment
1. Audio playback
2. Whatapp message system
For audio play back system pygame and play sound library are used to playing
the background audio. The whatapp message which is used twilio protocol for
transtering the message once animal detected it will be to send the message like
“Alart animal detected”
3.2.3.CONNECTIVITY MODULE
The hardware compound is linked to the software for send message to the farm
owner,the blink software is used.The notification of animal detection is send to
farm owner by an raspberry pi with an blink software
3.2.4.MESSAGE MODULE
For the access of module the message is send to the farm owner.The raspberry
pi with an in built wifi module passes the data to the farm owner to know
situation
RASPBERRY PI 4:
 The raspberry pi4 are used for entire development
 The raspbian os are loaded as os

fig 3: Rasperry Pi.


CHAPTER 4
SOFTWARE SPECIFICATION
4.1 SOFTWARE REQUIREMENT

4.2 HARDWARE REQUIREMENT


CHAPTER 5
SOFTWARE ENVIRNOMENT
INTERNET OF THINGS (IoT)
5.1 INTRODUCTION
IoT systems allow users to achieve deeper automation, analysis, and
integration within a system. They improve the reach of these areas and their
accuracy. IoT utilizes existing and emerging technology for sensing,
networking, and robotics. IoT exploits recent advances in software, falling
hardware prices, and modern attitudes towards technology. Its new and
advanced elements bring major changes in the delivery of products, goods, and
services; and the social, economic, and political impact of those changes.

5.2. IoT − Key Features


The most important features of IoT include artificial intelligence,
connectivity, sensors, active engagement, and small device use. A brief review
of these features is given below:
 AI – IoT essentially makes virtually anything “smart”, meaning it enhances
every aspect of life with the power of data collection, artificial intelligence
algorithms, and networks. This can mean something as simple as enhancing
your refrigerator and cabinets to detect when milk and your favorite cereal run
low, and to then place an order with your preferred grocer.
 Connectivity – New enabling technologies for networking, and specifically
IoT networking, mean networks are no longer exclusively tied to major
providers. Networks can exist on a much smaller and cheaper scale while still
being practical. IoT creates these small networks between its system devices.
 Sensors – IoT loses its distinction without sensors. They act as defining
instruments which transform IoT from a standard passive network of devices
into an active system capable of real-world integration.
 Active Engagement – Much of today's interaction with connected technology
happens through passive engagement. IoT introduces a new paradigm for active
content, product, or service engagement.
 Small Devices – Devices, as predicted, have become smaller, cheaper, and
more powerful over time. IoT exploits purpose-built small devices to deliver its
precision, scalability, and versatility.

5.3. IoT – Advantages


The advantages of IoT span across every area of lifestyle and business.
Here is a list of some of the advantages that IoT has to offer:
 Improved Customer Engagement – Current analytics suffer from blind-
spots and significant flaws in accuracy; and as noted, engagement remains
passive. IoT completely transforms this to achieve richer and more effective
engagement with audiences.
 Technology Optimization – The same technologies and data which improve
the customer experience also improve device use, and aid in more potent
improvements to technology. IoT unlocks a world of critical functional and field
data.
 Reduced Waste – IoT makes areas of improvement clear. Current analytics
give us superficial insight, but IoT provides real-world information leading to
more effective management of resources.
 Enhanced Data Collection – Modern data collection suffers from its
limitations and its design for passive use. IoT breaks it out of those spaces, and
places it exactly where humans really want to go to analyze our world. It allows
an accurate picture of everything.

5.4 IoT − Disadvantages


Though IoT delivers an impressive set of benefits, it also presents a
significant set of challenges. Here is a list of some its major issues:
 Security – IoT creates an ecosystem of constantly connected devices
communicating over networks. The system offers little control despite any
security measures. This leaves users exposed to various kinds of attackers.
 Privacy – The sophistication of IoT provides substantial personal data in
extreme detail without the user's active participation.
 Complexity – Some find IoT systems complicated in terms of design,
deployment, and maintenance given their use of multiple technologies and a
large set of new enabling technologies.
 Flexibility – Many are concerned about the flexibility of an IoT system to
integrate easily with another. They worry about finding themselves with several
conflicting or locked systems.
 Compliance – IoT, like any other technology in the realm of business, must
comply with regulations. Its complexity makes the issue of compliance seem
incredibly challenging when many consider standard software compliance a
battle.

5.5. IoT SOFTWARE


IoT software addresses its key areas of networking and action through
platforms, embedded systems, partner systems, and middleware. These
individual and master applications are responsible for data collection, device
integration, real-time analytics, and application and process extension within the
IoT network. They exploit integration with critical business systems (e.g.,
ordering systems, robotics, scheduling, and more) in the execution of related
tasks.
5.5.1.Data Collection
This software manages sensing, measurements, light data filtering, light
data security, and aggregation of data. It uses certain protocols to aid sensors in
connecting with real-time, machine-to-machine networks. Then it collects data
from multiple devices and distributes it in accordance with settings. It also
works in reverse by distributing data over devices. The system eventually
transmits all collected data to a central server.
5.5.2.Device Integration
Software supporting integration binds (dependent relationships) all
system devices to create the body of the IoT system. It ensures the necessary
cooperation and stable networking between devices. These applications are the
defining software technology of the IoT network because without them, it is not
an IoT system. They manage the various applications, protocols, and limitations
of each device to allow communication.
5.5.3.Real-Time Analytics
These applications take data or input from various devices and convert it
into viable actions or clear patterns for human analysis. They analyze
information based on various settings and designs in order to perform
automation-related tasks or provide the data required by industry.
5.5.4.Application and Process Extension
These applications extend the reach of existing systems and software to
allow a wider, more effective system. They integrate predefined devices for
specific purposes such as allowing certain mobile devices or engineering
instruments access. It supports improved productivity and more accurate data
collection.

5.6. IoT − Technology and Protocols


IoT primarily exploits standard protocols and networking technologies.
However, the major enabling technologies and protocols of IoT are RFID, NFC,
low-energy Bluetooth, low-energy wireless, low-energy radio protocols, LTE-
A, and WiFi-Direct. These technologies support the specific networking
functionality needed in an IoT system in contrast to a standard uniform network
of common systems.
5.6.1 NFC and RFID
RFID (radio-frequency identification) and NFC (near-field
communication) provide simple, lowenergy, and versatile options for identity
and access tokens, connection bootstrapping, and payments.
 RFID technology employs 2-way radio transmitter-receivers to identify and
track tags associated with objects.
 NFC consists of communication protocols for electronic devices, typically a
mobile device and a standard device.
Low-Energy Bluetooth
This technology supports the low-power, long-use need of IoT function
while exploiting a standard technology with native support across systems.
Low-Energy Wireless
This technology replaces the most power hungry aspect of an IoT system.
Though sensors and other elements can power down over long periods,
communication links (i.e., wireless) must remain in listening mode. Low-energy
wireless not only reduces consumption, but also extends the life of the device
through less use.
Radio Protocols
ZigBee, Z-Wave, and Thread are radio protocols for creating low-rate
private area networks. These technologies are low-power, but offer high
throughput unlike many similar options. This increases the power of small local
device networks without the typical costs.
LTE-A
LTE-A, or LTE Advanced, delivers an important upgrade to LTE
technology by increasing not only its coverage, but also reducing its latency and
raising its throughput. It gives IoT a tremendous power through expanding its
range, with its most significant applications being vehicle, UAV, and similar
communication. WiFi-Direct WiFi-Direct eliminates the need for an access
point. It allows P2P (peer-to-peer) connections with the speed of WiFi, but with
lower latency.
WiFi-Direct
eliminates an element of a network that often bogs it down, and it does
not compromise on speed or throughput.

5.7. IoT − Common Uses


IoT has applications across all industries and markets. It spans user
groups from those who want to reduce energy use in their home to large
organizations who want to streamline their operations. It proves not just useful,
but nearly critical in many industries as technology advances and we move
towards the advanced automation imagined in the distant future.
Engineering, Industry, and Infrastructure
Applications of IoT in these areas include improving production,
marketing, service delivery, and safety. IoT provides a strong means of
monitoring various processes; and real transparency creates greater visibility for
improvement opportunities. The deep level of control afforded by IoT allows
rapid and more action on those opportunities, which include events like obvious
customer needs, nonconforming product, malfunctions in equipment, problems
in the distribution network, and more.
Example:Joan runs a manufacturing facility that makes shields for
manufacturing equipment. When regulations change for the composition and
function of the shields, the new appropriate requirements are automatically
programmed in production robotics, and engineers are alerted about their
approval of the changes.
Government and Safety
IoT applied to government and safety allows improved law enforcement,
defense, city planning, and economic management. The technology fills in the
current gaps, corrects many current flaws, and expands the reach of these
efforts. For example, IoT can help city planners have a clearer view of the
impact of their design, and governments have a better idea of the local
economy.
Example : Joan lives in a small city. She’s heard about a recent spike in crime
in her area, and worries about coming home late at night. Local law
enforcement has been alerted about the new “hot” zone through system flags,
and they’ve increases their presence. Area monitoring devices have detected
suspicious behavior, and law enforcement has investigated these leads to
prevent crimes.
Home and Office
In our daily lives, IoT provides a personalized experience from the home
to the office to the organizations we frequently do business with. This improves
our overall satisfaction, enhances productivity, and improves our health and
safety. For example, IoT can help us customize our office space to optimize our
work.
Example: Joan works in advertising. She enters her office, and it recognizes her
face. It adjusts the lighting and temperature to her preference. It turns on her
devices and opens applications to her last working points. Her office door
detected and recognized a colleague visiting her office multiple times before she
arrived. Joan’s system opens this visitor’s messages automatically.
Health and Medicine
IoT pushes us towards our imagined future of medicine which exploits a
highly integrated network of sophisticated medical devices. Today, IoT can
dramatically enhance medical research, devices, care, and emergency care. The
integration of all elements provides more accuracy, more attention to detail,
faster reactions to events, and constant improvement while reducing the typical
overhead of medical research and organizations.
Example: Joan is a nurse in an emergency room. A call has come in for a man
wounded in an altercation. The system recognized the patient and pulls his
records. On the scene, paramedic equipment captures critical information
automatically sent to the receiving parties at the hospital. The system analyzes
the new data and current records to deliver a guiding solution. The status of the
patient is updated every second in the system during his transport. The system
prompts Joan to approve system actions for medicine distribution and medical
equipment preparation
5.8. IoT − Environmental Monitoring
The applications of IoT in environmental monitoring are broad:
environmental protection, extreme weather monitoring, water safety,
endangered species protection, commercial farming, and more. In these
applications, sensors detect and measure every type of environmental change.
Air and Water Pollution
Current monitoring technology for air and water safety primarily uses
manual labor along with advanced instruments, and lab processing. IoT
improves on this technology by reducing the need for human labor, allowing
frequent sampling, increasing the range of sampling and monitoring, allowing
sophisticated testing on-site, and binding response efforts to detection systems.
This allows us to prevent substantial contamination and related disasters.
Extreme Weather
Though powerful, advanced systems currently in use allow deep
monitoring, they suffer from using broad instruments, such as radar and
satellites, rather than more granular solutions. Their instruments for smaller
details lack the same accurate targeting of stronger technology. New IoT
advances promise more fine-grained data, better accuracy, and flexibility.
Effective forecasting requires high detail and flexibility in range, instrument
type, and deployment. This allows early detection and early responses to
prevent loss of life and property.
Commercial Farming
Today's sophisticated commercial farms have exploited advanced
technology and biotechnology for quite some time, however, IoT introduces
more access to deeper automation and analysis. Much of commercial farming,
like weather monitoring, suffers from a lack of precision and requires human
labor in the area of monitoring. Its automation also remains limited. IoT allows
operations to remove much of the human intervention in system function,
farming analysis, and monitoring. Systems detect changes to crops, soil,
environment, and more. They optimize standard processes through analysis of
large, rich data collections. They also prevent health hazards (e.g., e.coli) from
happening and allow better control.

5.9 IoT − Manufacturing Applications


Manufacturing technology currently in use exploits standard technology
along with modern distribution and analytics. IoT introduces deeper integration
and more powerful analytics. This opens the world of manufacturing in a way
never seen before, as organizations become fully developed for product delivery
rather than a global network of suppliers, makers, and distributors loosely tied
together.
Intelligent Product Enhancements
Much like IoT in content delivery, IoT in manufacturing allows richer
insight in real-time. This dramatically reduces the time and resources devoted to
this one area, which traditionally requires heavy market research before, during,
and well after the products hit the market. IoT also reduces the risks associated
with launching new or modified products because it provides more reliable and
detailed information. The information comes directly from market use and
buyers rather than assorted sources of varied credibility.
Dynamic Response to Market Demands
Supplying the market requires maintaining a certain balance impacted by
a number of factors such as economy state, sales performance, season, supplier
status, manufacturing facility status, distribution status, and more. The expenses
associated with supply present unique challenges given today's global partners.
The associated potential or real losses can dramatically impact business and
future decisions. IoT manages these areas through ensuring fine details are
managed more at the system level rather than through human evaluations and
decisions. An IoT system can better assess and control the supply chain (with
most products), whether demands are high or low.
Lower Costs, Optimized Resource Use, and Waste
Reduction IoT offers a replacement for traditional labor and tools in a
production facility and in the overall chain which cuts many previously
unavoidable costs; for example, maintenance checks or tests traditionally
requiring human labor can be performed remotely with instruments and sensors
of an IoT system. IoT also enhances operation analytics to optimize resource
use and labor, and eliminate various types of waste, e.g., energy and materials.
It analyzes the entire process from the source point to its end, not just the
process at one point in a particular facility, which allows improvement to have a
more substantial impact. It essentially reduces waste throughout the network,
and returns those savings throughout.
Improved Facility Safety
A typical facility suffers from a number of health and safety hazards due to
risks posed by processes, equipment, and product handling. IoT aids in better
control and visibility. Its monitoring extends throughout the network of devices
for not only performance, but for dangerous malfunctions and usage. It aids (or
performs) analysis and repair, or correction, of critical flaws.
Product Safety
Even the most sophisticated system cannot avoid malfunctions,
nonconforming product, and other hazards finding their way to market.
Sometimes these incidents have nothing to do with the manufacturing process,
and result from unknown conflicts. In manufacturing, IoT helps in avoiding
recalls and controlling nonconforming or dangerous product distribution. Its
high level of visibility, control, and integration can better contain any issues that
appear.
YOLOV3 DARKNET
Introduction:
This piece of blog is written to share my experience with beginners for a
specific Machine Learning object detection case.
Deep learning is an advanced sub-field of Artificial Intelligence (AI) and
Machine Learning (ML) that stayed as a scholarly field for a long time. With
the abundance of data and exponential increase of computing power, we have
been seeing a proliferation of applied deep learning business cases across
disciplines. Also a lot of smart people choose to study AI/ML and many large
high tech companies (leading cloud ML platforms include AWS
SageMaker, Microsoft Azure AI, Google Cloud Platform
ML & TensorFlow etc) & start ups heavily invest in this most thriving domain
of our time.
There is already an abundance of public online trainings and resources available
for every AI/ML enthusiast as long as you have an internet connection in any
corner of the world. Thus no excuses to stay behind… (If you are a really
serious ML enthusiast, I think the best hard core one to start with is Andrew Ng
’s Coursera specializations.)
See my simple DIY demo videos to see the outcome of this piece after a few
hours effort: Video 1 and Video 2.
Convolutional Neural networks (CNN)

Source: Wikipedia
Convolutional neural networks (CNN) are deep artificial neural networks that
are used primarily to classify images (i.e. label what they see), cluster them by
similarity (i.e. photo search), and perform object recognition within scenes.
They are algorithms that can identify faces, individuals, street signs, cars,
animals, anomalies, tumors and many other aspects of visual data.
Convolution layers are used to extract the features from input training samples.
Each convolution layer has a set of filters that helps in feature extraction. In
general, as the depth of CNN model increases, complexity of features learnt by
convolution layers increases. You can learn more about CNN
at here, here or here. Andrej Karpathy has written a great write up at
this link for his earlier Stanford CNN course if you would like to academically
go deeper.

CNN is such a fascinating and disruptive domain that opened up possibilities


for face recognition, self driving cars, optical character recognition, automated
diagnosis of diseases, image-to-text conversions, neural art etc…
There are many further innovation opportunities out there from maybe helping
millions of people with visual impairment to further advances in preventive
medical diagnosis, drug discoveries, video games, omni-channel retailers’
shelves/products recognition… Sky is the limit :) These frameworks started
working on the edges as well. Edges could be iPhones, Android
gadgets, Amazon DeepLens etc. Do you get my drift?

Real time object detection with YOLO


You Only Look Once (YOLO) — What a cool name, huh? This object detection
algorithm is currently the state of art and is outperforming CNN and it’s
variants mentioned above. Maybe the founder was inspired by human eye/brain
as YOLO is looking at the whole image during the test time so its predictions
are informed by the global context in the image. It also makes predictions with a
single network evaluation unlike systems like R-CNN which require thousands
for a single image. YOLO V2 and V3 can detect a wide variety of object classes
in real-time. The latest YOLO V3 is even more than 1000 x faster than R-CNN
and 100 x faster than Fast R-CNN (Reference).
You can feed it with any major image/video types or real time video feed from a
webcam. YOLO is a convolutional network as well but it behaves in an
ingenious way. (Applauds to the original YOLO V2 article here)
YOLO has an efficient approach as it first predicts which parts of the image
contains required information and then runs the (CNN) classifiers on these parts
only. Simply put, YOLO divides up the images into a grid of 13 by 13 cells
which are further divided into 5 “bounding boxes”. A bounding box is a
rectangle that encloses an object. For each bounding box, it parallel runs a
recognition algorithm to identify which image class do they belong to. YOLO
eventually outputs a confidence (probability) score that tells us how certain it is
that the predicted bounding boxes actually encloses an object (image class).
Each input image is very fast taken thru this special CNN and results with a
matrix of (13 x 13 x 125) where each tensor carries unique information like x,y
parameters, width/length of bounding box rectangle, confidence score and
probability dist over the trained classes of images.
Our provided parameters ignore the low scored ones and pick the highest
probability specific object that comes from our trained image class library. Thus
we end up seeing very few bounding boxes with dogs, people, flowers, cars etc.
Thus if I may oversimplify, the YOLO process visually looks like below in a
flashing speed for each image grid. The right most picture shows the identified
image & label combinations with the highest box confidence scores.

The input image is divided into an 7 x 7 grid. Then bounding boxes are
predicted and a class is predicted among classification over the most confident
ones.
YOLO V2 is trained with the COCO (Common objects in Context) library that
has 100k images of 80 common classes plus it is complemented with a subset of
ImageNet. It has 80 image classes. As a reference ImageNet has 14 million
images and 22k classes. You can leverage other data sets or leverage Amazon
mechanical Turk like new crowd sourcing services for manual labeling work
and come up with your own data set!!
All code and environment is open source thus anyone can clone and modify the
work. I also made a small Python code modification to be able to use an
external webcam for my real time recording convenience while making my test
YouTube videos (so as not to carry my laptop around). You can do any editing
as long as you know some Python and understand the theory to some degree…

Most of the examples on the web are usually based on Linux or Mac though I
had to make this demo on my Lenovo Windows 10 machine with Intel core7.
Thus all below personal experience & guidance is fit for use on a Windows
environment.
Original YOLO authors created DarkNet in an OpenSource library using C and
CUDA. I chose to use Darkflow instead which is basically a translation of
DarkNet to the convenient Tensorflow version. Thus we will download and use
the DarkFlow version for this demo.
OK let’s get started… Dependencies
You need to have Python 3.5 or 3.6, Tensorflow, numPY, openCV on your
(laptop) environment to get started. Below is some guidance that has worked for
me on Windows.
Step 1 — Install the dependencies for Windows
For beginners you can install the following to have a clean slate of ready-to-go
personal computing environment for your future ML experiments.
1. Download & install Anaconda package 64-bit version and choose
the Python 3.6 version. (link to video tutorial) This automatically installs
Python and many popular data scientist/ML libraries (NumPy, Scikit-
Learn, Pandas, R, Matplotlib…), tools (Jupyter Notebook, RStudio) and
hundreds of other open source packages for your future projects. When
you start out, it feels like the closest thing to the holy grail of ML
packages… For example I still use the Anaconda Jupyter Notebook for
almost all my ML experiments mostly out of
convenience. openCV library is not included though and we will install it
separately as it is needed for real-time computer vision tasks. (Hint for
Anaconda folks!)
2. Install Tensorflow and Keras (optional). TensorFlow is the most popular
AI software library and is created/maintained by Google. Keras is another
highly popular & high-level neural networks API, written in Python and
capable of running on top of TensorFlow. It was developed with a focus
on enabling fast experimentation. When you feel like “quitting” after
going thru Andrew Ng ’s like really low level material, Keras feels like a
piece of cake! Because it is a high level language based on
Python. Someone else has done the hard work for you!
It is common to have issues while trying to install all these open source
packages especially if you are on a Windows machine. It takes a while to make
everything work and resolve all the version or conflict issues. My best practice
is to basically Google such issues and find solutions online. Websites
like stackoverflow are super helpful and save your time & sanity!
In general, I also find helpful to create a separate new conda virtual
environment to mitigate the Windows installation issues. More on that here.
Step 2 — Install the DarkNet/YOLA, Darkflow stuff
DarkNet: Originally, YOLO algorithm is implemented in DarkNet framework
by Joseph Redmon. Darknet is an open source custom neural network
framework written in C and CUDA. It is fast, easy to install, and supports both
CPU and GPU computations. You can find the open source on GitHub.
Darkflow: It is a nickname of an implementation of YOLO on TensorFlow.
Thanks to Trinh Hoang Trieu, Darknet models are converted to Tensorflow and
can be installed on both Linux and Windows environments. Lets do it!
# Open your anaconda prompt and clone the darkflow github repository. (You
may need to install Git Bash Windows for git command to work)
git clone https://github.com/thtrieu/darkflow
# Alternative is to basically go to the DarkFlow GitHub page and download
the master repository to your local (i.e. C:\users\user_name\darkflow)
# If you have not already created a new virtual environment in Step 1, then
create a conda environment for darkflow installation.
conda create -n your_env_name python=3.6
# Activate the new environment using anaconda prompt.
activate your_env_name
# You can install the needed OpenCV with a conda-forge repository. conda-
forge is a github organization containing repositories of conda libraries.
conda config --add channels conda-forge
conda install opencv
# Build the Cython extensions in place. This is a widely used Python to C
compiler and wrapper that helps us to call the DarkNet C-code from Python.
python setup.py build_ext --inplace
or try the following as alternative
pip install -e .
If you get an error, try changing the working directory to darkflow (cd
darkflow) first and re-run one of the above commands.
Cool. The above steps will hopefully setup a local environment to run darkflow
and perform object detection task on images or videos.
Lastly we need to download the CFG and WEIGHTS files. The pre-trained
model name is YOLOv2 that is trained on a COCO image data set containing 80
classes (image types like car, dog, person, aeroplane etc).
WEIGHTS file: Please download the yolov2.weights file from here. Pls create a
darkflow/bin directory for keeping these weights file.
CFG file: Create a yolo.cfg text file of corresponding model in the
existing darkflow/cfg directory under your local darkflow folder. Check here for
the source file. You can copy paste the raw GitHub content with a notepad if
you want. Also do not forget to have a look at Darkflow's command line help
options for future reference.
python flow --h
PS: I found this blog (Abhijeet Kumar) very helpful while i was figuring out the
needed installations.
We are all set.
Lets run Darkflow YOLO command line to render some video!
I fancy using the Anaconda command prompt to execute the following
commands. You can find it from the Windows Start menu via searching for
“Anaconda Prompt”. In the prompt window, activate your new Tensorflow
virtual environment via “activate your_environ_name” command. Then execute
the “cd darkflow” command to change the current working directory to your
local Darkflow repository. Then you can try the following commands to start
running DarkFlow to process images & videos.
1. For processing existing images, you can run the following command:
python flow --model cfg/yolo.cfg --load bin/yolov2.weights --imgdir
sample_img
Pls note that darkflow/sample_img is a directory with sample photos.
2. For processing a video file, you can move the to-be-rendered video file under
master darkflow folder and then use the following command:
python flow --model cfg/yolo.cfg --load bin/yolov2.weights --demo
samplename.mp4
Hint: If you append “ — saveVideo” at the end, you can save the processed
video under master folder as well.
3. For rendering a real time streaming video via your laptop camera:
python flow --model cfg/yolo.cfg --load bin/yolov2.weights --demo camera

How to Use YOLOv3 With Darknet in 4 Easy Steps


What is Darknet?

Darknet is an open-source neural network framework that features


YOLO.YoloV3 has been available for many years now and it is still widely
used.

What is YOLO?

YOLO stands for You Only Look Once and is a real-time object detection
system.
How to use YOLO for inference
There are several ways of using YOLO, the original way, is through Darknet
itself.
To use darknet we will need to do it through the terminal, and it is pretty easy to
do it.
Below are the steps we will need to follow.
Step 1: Clone Darknet from Github
git clone https://github.com/pjreddie/darknet

Step 2: Compile Darknet


We need to make use of ‘make’ to compile darknet, this will work out of the box
in MacOs and Linux, I’m doing this on macOS.
In Windows, you might need to do further research to see how you can use
‘make’ to compile it
cd darknet
make

Step 3: Download the YOLOv3 weights file

The weights file is around 248 MB and it is not included in the repository so we
will need to download it from a different URL.
You can either download it with a browser, but I prefer to do it directly in the
console like this:
wget https://pjreddie.com/media/files/yolov3.weights

Either way, you do it just make sure to place the weights file inside the darknet
repository so we can refer to it easily in the next step.
Step 4: Run YOLO to detect objects in an image
Now the moment of truth, we will run darknet to detect objects in an image.
To do it just execute this:

./darknet detect cfg/yolov3.cfg yolov3.weights data/dog.jpg

 ./darknet is the executable

 detect is the argument that says what we want to do


 cfg/yolov3.cfg is the path to the YOLOv3 config file that is included in the
repository
 yolov3.weights is the weights file we just downloaded above
 data/dog.jpg is the path to the image we want to analyze and it is also
included as part of the repository
After some seconds once it finishes running a file with the
name predictions.jpg will appear inside the darknet repository folder, this is the
image that will contain the annotations showing all the detected objects.

After 26.7 seconds, it finished!

This is the result, as you can see it contains the objects that were detected as we
can read in the terminal screenshot from above:

bicycle: 99% confidence


truck: 92% confidence
dog: 100% confidence
CONCLUSION:
In this project , rural parts of Indian farmers encounter severe threats such
as damage done by animals. Hence, to overcome this issue we have designed a
system in which sound is played and by using yolov3 darknet . So that wild
animals will not enter into the farm. It will run away. whatapp sends message to
the farmer to alert him. From this it is concluded that the design system is very
useful and affordable to the farmer. The design system will not be dangerous to
animal and human being, and it protects farm.

REFERENCE:
[1] Nirit Datta and Souvik Sarkar, “Automatic Tracking and Alarm System for
Eradication of Wild Life Injury and Mortality,” IEEE Conference, 2016.
[2] Sachin umesh sharma and dharmesh j. Shah, “A Practical Animal Detection
and Collision Avoidance System Using Computer Vision Technique,” Special
section on innovations in electrical and computer engineering education,”
September 27, 2016.
[3] R.Shanmugasundaram and S.Pavithra,, “IoT based animal tracking and
monitoring system in Zoo,” South Asian Journal of Engineering and
Technology , Vol.3, No.2, 2017.

[4] Dr. P. Uma Maheswari and Anjali Rose Rajan, “Animal Intrusion Detection
System Using Wireless Sensor Networks,” International
Journal of Advanced Research in Biology Engineering Science and Technology,
Vol. 2, March 2016.

[5]Boon Tatt Koik and Haidi Ibrahim,” A Literature Survey on Animal


Detection Methods in Digital Images”, International Journal of Future
Computer and Communication, Vol. 1, No. 1, June 2012.

[6]C. Peijiang, “Moving object detection based on background extraction,”


Computer Network and Multimedia Technology (CNMT), 2009.

[7] J. S. L. Ting, S. K. Kwok, W. B. Lee, H. C. A. Tsang, and B. C. F. Cheung,


“A dynamic RFID-based mobile monitoring system in animal care management
over a wireless network,” Wireless Communications Networking and Mobile
Computing, vol. 2, pp. 2085-2088, 2007.

[8] ArturFrankiewicz; RafałCupek.”Smart Passive Infrared Sensor - Hardware


Platform“ Year: 2013 IECON 2013 - 39th Annual Conference of the IEEE
Industrial Electronics Society Pages: 7543- 7547,

[9] DOI: 10.1109/IECON.2013.6700389 CITED BY: PAPERS (1)

[10] Hanshi Wang; Jingli Lu; Lizhen Liu; Wei Song; Zhaoxia Wang;
“Community Alarm System Design Based On MCU And GSM”
Year: 2015

[11] Volume:01 Pages:859-862, DOI:10.1109/ICCSNT.2015.7490876 ,


IEEE Conference Publications.
[12] Markus Borschbach; Navya Amin ,“Quality Of Obstacle Distance
Measurement Using Ultrasonic Sensor And Precision Of Two Computer
Vision-Based Obstacle Detection Approaches” Year: 2015, 2015 International
Conference on Smart Sensors and Systems (IC-SSS)
[13] Pages: 1-6, DOI: 10.1109/SMARTSENS.2015.7873595IEEE Conference
Publications

[14] Mustapha, Baharuddin, AladinZayegh, and Rezaul K. Begg. “Ultrasonic


And Infrared Sensors Performance In A Wireless Obstacle Detection System”
Artificial Intelligence, Modelling and Simulation (AIMS), 2013 1st
International Conference on. IEEE, 2013.

[15] Dr. Wilson, “Electric Fence” Handbook of Texas, Project report published
by the Texas State Historical Association. August 4, 2011

[16] T. Mohammad, “Using Ultrasonic And Infrared Sensors For Distance


Measurement” World Academy of Science, Engineering and Technology, pp.
293-298, 2009.

[17] Discant, A. Rogozan, C. Rusu and A. Bensrhair, “Sensors For Obstacle


Detection” 2007 30th International Spring Seminar on Electronics Technology
(ISSE), Cluj-Napoca, 2007, pp. 100-105. doi: 10.1109/ISSE.2007.4432828

You might also like