Professional Documents
Culture Documents
AGRICULTURAL LAND
A PROJECT REPORT
Submitted by
SHANMUGAVEL M 414216205080
JAWAHAR M 412416205026
KATHIRAVAN A 412416205032
of
BACHELOR OF ENGINEERING
in
INFORMATION TECHNOLOGY
2019-2020
BONAFIDE CERTIFICATE
SIGNATURE SIGNATURE
Submitted for the viva voice-examination held on 22/09/2020 at Sri Sai Ram
Institute of Technology, Chennai-44.
The Report of the project work submitted by the above students in partial fulfillment
for the award of Bachelor of Technology Degree in Information technology of
Anna University, Chennai were evaluated and confirmed to be report of the work
done by the above students.
Submitted for Anna University Project Viva Voce held on 22/09/2020.
"A successful man is one who can lay a firm foundation with the bricks others have
thrown at him." -- David Brinkley
Such a successful personality is our beloved founder Chairman, Thiru. MJF. Ln.
LEO MUTHU. At the outset, we express our sincere gratitude to our beloved
Chairman through prayers, who is in the form of the Guiding Star and who has
spread his wings of eternal support with immortal blessings.
We express our gratitude to our Chief Executive Officer Mr. J. SAI PRAKASH
LEO MUTHU and our Trustee Ms. J. SHARMILA RAJAA for their constant
support to complete the project making the resources available at right time.
We express our solemn thanks to our beloved Principal,
Dr. K. PALANIKUMAR for having given us spontaneous and wholehearted
encouragement for completing this project.
We are indebted to our Head of the Department Dr. V. BRINDHA DEVI for her
support during the entire course of this project work.
We express our gratitude and sincere thanks to our guide R. SHOBANALAKSHMI
for her valuable suggestions and insights leading to the successful completion of this
project.
Our sincere thanks to our project coordinator, Dr. R. MURUGARADHA
DEVI, Associate Professor – I for his support and guidance in bringing out this
project successfully.
We thank all the Teaching and Non-Teaching staff members of the Department
of Information Technology and all others who contributed directly or indirectly for
the successful completion of the project.
CONTENTS
1
5. System Environment 15
5.1 Raspberry Pi 15
5.2 PIR Motion Detecting Sensor 16
5.3 CCTV 18
5.4 Python 19
5.5 TensorFlow 19
6. Algorithm 20
7. System Design
9. Development process
3
ABSTRACT
In the field of agriculture, the loss of crops by animal attack is the one
of the major problem faced by the farmers. In order to protect the agricultural land
and to protect the animal from the electric fences. To avoid these problem a system
is developed to intimate the farmer about the animal movement and produce siren to
repel the animal from the agricultural land before the farmer reach the agricultural.
This methodology used is developed existed in the detection of animal in the
highways to help the auto driving system using the image processing techniques.
The system we developed detects the animal near the protected land in the live video
streaming from the CCTV camera using the tensorflow lite model and compare
detected object with the list class objects the can detect if the class found and check
whether the detected class of object is vulnerable to the agricultural land if yes, it
produces the siren to repel animal from the protected land in order to save the land
and it can also be used to save animals from electric fences.
4
LIST OF FIGUREURES
Existing method.
5
LIST OF TABLES
6
LIST OF ABBREVIATION
7
INTRODUCTION
8
CHAPTER 2
LITREATURE SURVEY
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 clip so animals on highways with varying vehicle speed.
9
2.2 DETECTION, IDENTIFICATION AND TRACKING OF OBJECTS
DURING THE MOTION
11
3.2 PROPOSED SYSTEM
You may have heard about the loss of agricultural lands and the crops and the
animal died due to the electric fences in the agricultural lands. The system we
developed will alert the farmer or the owner of the land when the arrival of animal
is noticed in the area where the system is implemented. The System finds the animals
by using object detection technology using the video from the camera. The working
methodology of the system is as follows. The passive motion detector sensor placed
in the agricultural land senses the movement of living things in the land. When the
movement is diagnosed it sends the signal to the raspberry pi which acts as
processing system turn on the camera and start recording the live recording of the
land. The TensorFlow lite models for object detection algorithm is used to detect the
image and check whether the detected object is harmful to the agricultural land then
the alarm gets activated to repel the animal from the desired land and send the
notification to the owner of the land to give notification about the arrival of animal
to the land.
12
Example Output of System Processed:
13
CHAPTER 4
4.1 SOFTWARE REQUIREMENTS
Python
Open CV
TensorFlow
Raspbian OS
Raspberry pi 2GB(Min)
Bread Board
Speaker
Emergency Light
Connecting Wires
14
CHAPTER 5
SYSTEM ENVIRONMENT
5.1 Raspberry Pi
16
either broad coverage (110° wide) or very narrow "curtain" coverage, or with
individually selectable segments to "shape" the coverage.
17
5.3 CCTV
18
5.4 Python
5.5 TENSORFLOW
19
CHAPTER 6
ALGORITHM
In this project the algorithm and the methodology used are based on the
TensorFlow lite models for the object detection and the classification of detected
objects. When the system gets activated the motion detector connected with the
raspberry pi detects movement in the desired land it’s sends the signal to the system
and the system activate the camera to record the video and the TensorFlow lite model
identifies the objects in the video and then send the notification to the users mobile
via the GSM module from the raspberry pi to the users mobile and the SMS. The
notification will be like an emergency call.
Here, we going to train the model with the image dataset which contains more than
ten different objects for e.g: cow, elephant, dog, sheep, horse and more animals
which is harmful to the agricultural land. Hence when our model gets activated
videos from the camera are analyzed and the objected is detected if the detected
object is harmful to the agriculture then the alarm gets activated and the notification
is send to the user’s mobile with the help of GSM module.
20
CHAPTER 7
SYSTEM DESIGN
21
CHAPTER 8
22
When the system gets activated the motion detector connected with the raspberry pi
detects movement in the desired land it’s sends the signal to the system and the
system activate the camera to record the video. Given a video stream, an object
detection model can identify which of a known set of objects might be present and
provide information about their positions within the image. An object detection
model is trained to detect the presence and location of multiple classes of objects in
the video stream. For example, a model might be trained with images that contain
various objects, along with a label that specifies the class of objects they represent
(e.g. an elephant, deer, cow, sheep), and data specifying where each object appears
in the image. When we subsequently provide an image to the model, it will output a
list of the objects it detects, the location of a bounding box that contains each object,
and a score that indicates the confidence that detection was correct. The score
determines the objects accuracy. When the detected object is harmful to the land
then the siren gets turned on and plays a horrible sound to stop the animal
approaching the land and save it from the electric fences. This methodology includes
the preprocessing of the image to avoid the noises shadows and the unwanted pixels
which reduces the accuracy of the object detection.
23
8.2 Mechanism of Object Detection
24
CHAPTER 9
DEVELOPMENT PROCESS
25
9.2 DEVELOPMENT MODEL
Waterfall Model
Planning the development process involves several important
considerations. The first consideration is to define a product life-cycle model. A
software LIFE-CYCLE model encompasses all activities required to define, test, and
develop.
26
9.3 FEASIBILITY STUDY
27
9.5 SECURITY FEASIBILITY
The security of the data logged is the same as any of the other data in
the user’s device. It is very important that user should keep their data secure,
especially if they share important personal data at any cost.
28
9.8 TECHNICAL FEASIBILITY
Technical Feasibility involves financial considerations to accommodate
technical enhancement. If the budget is a serious constraint, then the project is judged
‘not feasible’. Here the cost incurred by searching an appropriate s/w which may
handle by some few people and hidden to others, but it reduces the searching time,
so it technically fit. The module reduce the work load of different end user, and gives
a clear picture about the s/w required so the user use this module, hence this system
is operationally feasible.
29
9.11 REQUIREMENT ANALYSIS AND SPECIFICATION
1) Requirements Gathering:
This activity typically involves interviewing the farmers and
agriculturalist and studying the existing documents and problems in real time to
collect all possible information regarding the system. If the project involves
automating some existing procedures, then the task of the system analyst becomes a
little easier as he can obtain the input and the output data formats and the details of
the nation and creativity on the part of the system analyst is required.
30
2) Analysis of Gathered Requirements:
The main purpose to this activity is to clearly understand the exact
problem in the agricultural lands due to animals. The following basic questions
pertaining to the project should be clearly understood by the analyst in order to
obtain a good grasp of the problem:
What is the problem?
What are the possible solutions to the problem?
What exactly are the data inputs to the system and what exactly are the data
outputs required of the system?
What are the likely complexities that might arise while solving the problem?
If there are external software or hardware with which the developed
software has to interface, then what exactly would the data interchange
formats with the external system.
31
9.12 DESIGN
Software design deals with transforming the customer requirements, as
described in the SRS document, into a form that is implement able using a
programming language, for a design to be easily implement able using a
programming language, the following items must be designed during the
design phase:
Different modules required implementing the design solution by interacting
hardware components with each other.
Design, Interaction and the implementation of the individual modules.
Algorithms required implementing the individual modules.
Algorithm which is used to implement the customer requirements.
32
CHAPTER 10
SYSTEM TESTING
34
APPENDIX I
PYTHON CODE:
# Import packages
import os
import argparse
import cv2
import numpy as np
import sys
import time
from threading import Thread
import importlib.util
from gpiozero import LED
from gpiozero import MotionSensor
from playsound import playsound
#import time
# Define VideoStream class to handle streaming of video from webcam in separate process
ing thread
# Source -
Adrian Rosebrock, PyImageSearch: https://www.pyimagesearch.com/2015/12/28/increasing-
raspberry-pi-fps-with-python-and-opencv/
class VideoStream:
def start(self):
# Start the thread that reads frames from the video stream
Thread(target=self.update,args=()).start()
return self
35
def update(self):
# Keep looping indefinitely until the thread is stopped
while True:
# If the camera is stopped, stop the thread
if self.stopped:
# Close camera resources
self.stream.release()
return
def read(self):
# Return the most recent frame
return self.frame
def stop(self):
# Indicate that the camera and thread should be stopped
self.stopped = True
args = parser.parse_args()
36
MODEL_NAME = args.modeldir
GRAPH_NAME = args.graph
LABELMAP_NAME = args.labels
min_conf_threshold = float(args.threshold)
resW, resH = args.resolution.split('x')
imW, imH = int(resW), int(resH)
use_TPU = args.edgetpu
# Path to .tflite file, which contains the model that is used for object detection
PATH_TO_CKPT = os.path.join(CWD_PATH,MODEL_NAME,GRAPH_NAME)
# Have to do a weird fix for label map if using the COCO "starter model" from
# https://www.tensorflow.org/lite/models/object_detection/overview
# First label is '???', which has to be removed.
if labels[0] == '???':
37
del(labels[0])
interpreter.allocate_tensors()
input_mean = 127.5
input_std = 127.5
ms = MotionSensor(4)
while True:
print("Ready for Motion")
ms.wait_for_motion()
print("Motion Detected")
# Initialize video stream
videostream = VideoStream(resolution=(imW,imH),framerate=30).start()
time.sleep(1)
timeout = time.time() + 10
#for frame1 in camera.capture_continuous(rawCapture, format="bgr",use_video_port=Tr
ue):
while True:
if time.time() > timeout:
print("timeout exit")
break
38
# Start timer (for calculating frame rate)
t1 = cv2.getTickCount()
# Perform the actual detection by running the model with the image as input
interpreter.set_tensor(input_details[0]['index'],input_data)
interpreter.invoke()
def detect(objectName):
led = LED(17)
# Indicate that the camera and thread should be stopped
if(objectName == "cow" or objectName == "elephant" or objectName == "horse"
or objectName == "sheep"):
led.on()
time.sleep(0.5)
playsound('audio.mp3')
else:
led.off()
# Loop over all detections and draw detection box if confidence is above minimu
m threshold
39
for i in range(len(scores)):
if ((scores[i] > min_conf_threshold) and (scores[i] <= 1.0)):
# Draw label
object_name = labels[int(classes[i])] # Look up object name from "label
s" array using class index
print("Object detected: " + object_name)
detect(object_name)
label = '%s: %d%%' % (object_name, int(scores[i]*100)) # Example: 'pers
on: 72%'
labelSize, baseLine = cv2.getTextSize(label, cv2.FONT_HERSHEY_SIMPLEX,
0.7, 2) # Get font size
label_ymin = max(ymin, labelSize[1] + 10) # Make sure not to draw label
too close to top of window
cv2.rectangle(frame, (xmin, label_ymin-labelSize[1]-
10), (xmin+labelSize[0], label_ymin+baseLine-
10), (255, 255, 255), cv2.FILLED) # Draw white box to put label text in
cv2.putText(frame, label, (xmin, label_ymin-
7), cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 0, 0), 2) # Draw label text
# All the results have been drawn on the frame, so it's time to display it.
cv2.imshow('Object detector', frame)
# Calculate framerate
t2 = cv2.getTickCount()
time1 = (t2-t1)/freq
frame_rate_calc= 1/time1
40
# Clean up
cv2.destroyAllWindows()
videostream.stop()
41
APPENDIX II
SCREENSHOTS
The System is initialized and before any motion is detected in the Sensor
Screenshot 1: When the motion is detected and the animal elephant is found in the
Image
After PIR Sensor Detects the movements and object is detected by the
system and shows what object it detected.
42
Elephant movement is detected in the land. The Elephant need to be stay from the
land hence the system plays the horrible sound to make the stay away from the
land.
43
Screenshot 3: Showing accuracy of the object detected is Cow
44
Screenshot 4: Showing the accuracy of the object detected 75% and it is Dog.
45
CHAPTER 11
CONCLUSION:
We proposed an alert system that helps the farmer to safeguard the crops and
land from the animal attacks and preventing the animal death from electric fences.
This system will be very helpful when it is implemented as the real time
application in the agricultural lands. It can also be used in the people living in the
mountains range who suffer from animal attacks in their living area. In this area the
alert system can also be used for their safety purpose to safeguard their living area.
FUTURE WORK:
Possible ideas of for future includes implementing the system more number
of cameras and more sensors to cover the large area. Another idea is to add the
temperature sensor to rescue animal from forest fire by alert the animal using the
horrible sound based on the temperature of the temperature sensor. Importing the
GSM module to connect the users’ mobile to notify the movements animals in the
agricultural lands and animals reaching the electric fences.
46