When the Automobile Driver Is Wearing Spectacles. 38 7.3
Total Page:16
File Type:pdf, Size:1020Kb
VISVESVARAYA TECHNOLOGICAL UNIVERSITY “Jnana Sangama”, Belagavi– 590 018 A PROJECT REPORT ON “MONITORING DRIVER'S ATTENTION LEVEL” Submitted in partial fulfillment for the award of the degree of BACHELOR OF ENGINEERING IN COMPUTER SCIENCE AND ENGINEERING BY SISIR DAS K (1NH12CS118) SIDDHARTHKUMAR PATEL (1NH12CS117) Under the guidance of Ms.Pramilarani K (Senior Assistant Professor, Dept. of CSE, NHCE) DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING NEW HORIZON COLLEGE OF ENGINEERING (ISO-9001:2000 certified, Accredited by NAAC ‘A’, Permanently affiliated to VTU) Outer Ring Road, Panathur Post, Near Marathalli, Bangalore – 560103 NEW HORIZON COLLEGE OF ENGINEERING (ISO-9001:2000 certified, Accredited by NAAC ‘A’ Permanently affiliated to VTU) Outer Ring Road, Panathur Post, Near Marathalli, Bangalore-560 103 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CERTIFICATE Certified that the project work entitled “MONITORING DRIVER’S ATTENTION LEVEL” carried out by SISIR DAS K (1NH12CS118) and SIDDHARTHKUMAR PATEL (1NH12CS117) bonafide students of NEW HORIZON COLLEGE OF ENGINEERING in partial fulfilment for the award of Bachelor Of Engineering in Computer Science and Engineering of the Visvesvaraya Technological University, Belgavi during the year 2015-2016. It is certified that all corrections/suggestions indicated for Internal Assessment have been incorporated in the report deposited in the department library. The project report has been approved as it satisfies the academic requirements in respect of Project work prescribed for the said Degree. Name & Signature of Guide Name & Signature of HOD Signature of Principal (Ms. K Pramilarani) (Dr.Prashanth C.S.R.) (Dr.Manjunatha) External Viva Name of Examiner Signature with date 1. 2. ACKNOWLEDGEMENT The satisfaction and euphoria that accompany the successful completion of any task would be, but impossible without the mention of the people who made it possible, whose constant guidance and encouragement crowned our efforts with success. We thank the management, Dr. Mohan Manghnani, Chairman of NEW HORIZON EDUCATIONAL INSTITUTIONS for providing necessary infrastructure and creating good environment. We also record here the constant encouragement and facilities extended to us by Dr.Manjunatha, Principal, NHCE and Dr.Prashanth.C.S.R, Dean Academics, Head of the Department of Computer Science and Engineering. We extend our sincere gratitude to them. We express our gratitude to Ms. K Pramilarani, our project guide for constantly monitoring the development of the project and setting up precise deadlines. Her valuable suggestions were the motivating factors in completing the work. We would also like to express our gratitude to NHCE and to all our external guides at NHCE for their continuous guidance and motivation. Finally a note of thanks to the teaching and non-teaching staff of Computer Science and Engineering Department for their cooperation extended to us and our friends, who helped us directly or indirectly in the course of the project work. SISIR DAS K (1NH12CS118) SIDDHARTHKUMAR PATEL (1NH12CS117) i ABSTRACT There are many instances of road accidents round the world due to a driver’s lack of attention while driving. One of the prime reasons can be drowsiness. For this project, we have created a system that detects if a driver’s eyes are opened or closed using a cascade trained by us. This cascade is trained using a training tool that is present in the openCV library, it’s called ‘traincascade.exe’. An audible alert is triggered in the system to acknowledge if the eyes of the driver are closed for a certain amount of time. The training is done using a tool from the openCV library. Since it is processing thousands of images it takes a lot of time, mostly hours to days depending on the power and capacity of the system. We have created an interface for the project that is coded in Javafx. The backend of the project is coded using C and C++ languages ii CONTENTS ACKNOWLEDGEMENT I ABSTRACT II 1. INTRODUCTION 1.1. PROBLEM STATEMENT 2 1.2. PROJECT FEATURES 2 1.3. PROJECT PURPOSE 3 2. LITERATURE SURVEY 2.1. IMAGE PROCESSING 4 2.2. EXISTING SYSTEM 6 2.3. PROPOSED SYSTEM 6 2.4. SOFTWARE DESCRIPTION 7 3. REQUIREMENT ANALYSIS 3.1. FUNCTIONAL REQUIREMENTS 13 3.2. NON FUNCTIONAL REQUIREMENTS 13 3.3. HARDWARE REQUIREMENTS 14 3.4. SOFTWARE REQUIREMENTS 14 4. CASCADE TRAINNING APPROACH 4.1. ENSEMBLE LEARNING 17 4.2. CASCADE CLASSIFIER 18 4.3. OPENCV 18 4.4. HAAR TRAINING 19 4.5. TEMPALTE MATHCING 21 4.6. SMOOTHENING OF THE CAPTURED IMAGE 21 4.7. HAAR LIKE FEATURES 22 iii 5. SYSTEM DESIGN 24 6. IMPLEMENTATION 6.1. VIDEO ACQUISITION 28 6.2. DIVIDING INTO FRAMES 28 6.3. FACE DETECTION 29 6.4. EYE DETECTION 29 6.5. SLEEPINESS DETECTION 30 6.6. CODE IMPLEMENTATION 31 7. TESTING 7.1. TEST CASE 1: WHEN THERE IS AMBIENT LIGHT. 37 7.2. TEST CASE 2: WHEN THE AUTOMOBILE DRIVER IS WEARING SPECTACLES. 38 7.3. TEST CASE 3 : WHEN THE AUTOMOBILE DRIVER’S HEAD IS TILTED. 39 8. SNAPSHOT 41 9. FUTURE WORK AND CONCLUSION 8.1 FUTURE WORK 44 8.2 CONCLUSION 44 BIBLIOGRAPHY 46 iv LIST OF FIGURES Fig. 4.1: A nonintrusive eye detection system. 17 Fig. 4.2: 3*3 pixel grid. 21 Fig. 4.3: 14 types of features 22 Fig. 5.1: Proposed System Architecture 24 Fig. 5.2: High Level System Flow. 26 Fig. 7.1: Ambient lighting 37 Fig. 7.2: Ambient lighting 38 Fig. 7.3: Driver with spectacles 38 Fig. 7.4: Driver with spectacles 39 Fig. 7.5: Tilted head 39 Fig. 7.6: Tilted head 40 Fig. 8.1 Snapshot 41 Fig. 8.2 Snapshot 41 Fig. 8.3 Snapshot 42 Fig. 8.4 Snapshot 42 Fig. 8.5 Snapshot 43 v Monitoring driver’s attention level CHAPTER 1 INTRODUCTION A major share of road accidents that happen today are caused by the drowsiness of the driver. Many lives could be saved if there was a mechanism by which the drivers could be given an alert when they start feeling drowsy. Statistics indicate the need of a reliable driver drowsiness detection system which could alert the driver before a mishap happens. This project aims at developing such a system that can observe the mannerisms of the driver, obtain relevant data, process the information and produce the alert according to the situation at hand. Research has shown that there are basically three ways to determine drowsiness in a driver: vehicle-based measures, behavioural patterns, and physiological measures. This project uses an eye detection system of the driver to determine whether the driver is awake or not. We check if the driver’s eyes are closed for some time to judge if the driver is sleeping or not .When sleepy, every person has a tendency to blink frequently or to shut their eyelids in slow movements. Another behavioural measure displayed by human beings when drowsy is frequent yawning. Also, for most people, the manner in which their head is kept changes abruptly as they fall asleep. That is, our head tends to swing down a few angles in an instant when feeling drowsy. This project develops the software tools to detect and track only one of these behavioural patterns, that is to see if the eyes are closed for a longer than normal time. Most of the published studies on using behavioural approaches to determine drowsiness focus on blinking. This measurement has been found to be a reliable measure to predict sleepiness and has been used in several commercial products. However, it has been known to produce inaccurate results at times. This project puts forward a system that attempts to check whether the eyes are open or not. Dept. of CSE, NHCE Page 1 Monitoring driver’s attention level The system has been implemented using the input from a camera that is to be fixed in the car, in front of the driver. The camera records eyelid movements, after which this data is processed producing the corresponding output. Whenever the user closes his/her eyelids for more than a predefined period of time, the alert goes off. This is detected by comparing and matching the images used in the training phase of the system with the real time images captured by the camera. The comparison and matching is done after each frame, and the user is given an alert upon detection of closed eyelids in a certain number of continuous frames. 1.1 PROBLEM STATEMENT Road accident is global tragedy with over-rising trend. India suffers from the highest number of deaths –around 1,50,000 in absolute terms annually-due to road accidents in the world owing to the poor infrastructure and dangerous driving habit. The increasing number of traffic accidents due to a diminished driver’s vigilance level has become a serious problem for the society. Statistics show that 20% of all the traffic accidents and up to one-quarter of fatal and serious accidents are due to drivers with diminished vigilance level. Most motor vehicle crashes are caused by driver error (e.g. speeding) or poor operating practices including lack of seat belt use, distractions, fatigue, rash driving, and alcohol or drug use while driving. Most of the road users are quite well aware of the general rules and safety measures while using roads but it is only the laxity on part of road users, which cause accidents and crashes. Of all these issues, the most important issue to be considered is the driver’s concentration as well as driver’s inattention or distraction. 1.2 PROJECT FEATURES This project, ‘Monitoring a driver’s attention level’, will be featuring a front end and a back end. The back end is coded using C and some functions and API’s of C++.