SlideShare a Scribd company logo
1 of 8
Download to read offline
What is the UML Class diagram for accident detection using CNN.
i have make the class diagram which is not sufficient to my guide.
Class diagram: .
SYSTEM ARCHITECTURE:
Code for the accident detection:-
from tkinter import messagebox
from tkinter import *
from tkinter import simpledialog
import tkinter
from tkinter import filedialog
from tkinter.filedialog import askopenfilename
import time
import cv2
import tensorflow as tf
from collections import namedtuple
import numpy as np
import winsound
main = tkinter.Tk()
main.title("Accident Detection")
main.geometry("1300x1200")
net =
cv2.dnn.readNetFromCaffe("model/MobileNetSSD_deploy.prototxt.txt","model/MobileNetSSD
_deploy.caffemodel")
CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat",
"bottle", "bus", "car", "cat", "chair", "cow", "diningtable",
"dog", "horse", "motorbike", "person", "pottedplant", "sheep",
"sofa", "train", "tvmonitor"]
COLORS = np.random.uniform(0, 255, size=(len(CLASSES), 3))
global filename
global detectionGraph
global msg
def loadModel():
global detectionGraph
detectionGraph = tf.Graph()
with detectionGraph.as_default():
od_graphDef = tf.compat.v1.GraphDef()
with tf.compat.v2.io.gfile.GFile('model/frozen_inference_graph.pb', 'rb') as file:
serializedGraph = file.read()
od_graphDef.ParseFromString(serializedGraph)
tf.import_graph_def(od_graphDef, name='')
messagebox.showinfo("Training model loaded","Training model loaded")
def beep():
frequency = 2500 # Set Frequency To 2500 Hertz
duration = 1000 # Set Duration To 1000 ms == 1 second
winsound.Beep(frequency, duration)
def uploadVideo():
global filename
filename = filedialog.askopenfilename(initialdir="videos")
pathlabel.config(text=filename)
text.delete('1.0', END)
text.insert(END,filename+" loadedn");
def calculateCollision(boxes,classes,scores,image_np):
global msg
#cv2.putText(image_np, "NORMAL!", (230, 50), cv2.FONT_HERSHEY_SIMPLEX, 1.0, (255,
255, 255), 2, cv2.LINE_AA)
for i, b in enumerate(boxes[0]):
if classes[0][i] == 3 or classes[0][i] == 6 or classes[0][i] == 8:
if scores[0][i] > 0.5:
for j, c in enumerate(boxes[0]):
if (i != j) and (classes[0][j] == 3 or classes[0][j] == 6 or classes[0][j] == 8) and scores[0][j]> 0.5:
Rectangle = namedtuple('Rectangle', 'xmin ymin xmax ymax')
ra = Rectangle(boxes[0][i][3], boxes[0][i][2], boxes[0][i][1], boxes[0][i][3])
rb = Rectangle(boxes[0][j][3], boxes[0][j][2], boxes[0][j][1], boxes[0][j][3])
ar = rectArea(boxes[0][i][3], boxes[0][i][1],boxes[0][i][2],boxes[0][i][3])
col_threshold = 0.6*np.sqrt(ar)
area(ra, rb)
if (area(ra,rb)<col_threshold) :
print('accident')
msg = 'ACCIDENT!'
beep()
return True
else:
return False
def rectArea(xmax, ymax, xmin, ymin):
x = np.abs(xmax-xmin)
y = np.abs(ymax-ymin)
return x*y
def load_image_into_numpy_array(image):
(im_width, im_height) = image.size
return np.array(image.getdata()).reshape((im_height, im_width, 3)).astype(np.uint8)
def area(a, b): # returns None if rectangles don't intersect
dx = min(a.xmax, b.xmax) - max(a.xmin, b.xmin)
dy = min(a.ymax, b.ymax) - max(a.ymin, b.ymin)
return dx*dy
def detector():
global msg
msg = ''
cap = cv2.VideoCapture(filename)
with detectionGraph.as_default():
with tf.compat.v1.Session(graph=detectionGraph) as sess:
while True:
ret, image_np = cap.read()
(h, w) = image_np.shape[:2]
blob = cv2.dnn.blobFromImage(cv2.resize(image_np, (300, 300)),0.007843, (300, 300), 127.5)
net.setInput(blob)
detections = net.forward()
for i in np.arange(0, detections.shape[2]):
confidence = detections[0, 0, i, 2]
if confidence > 0.2:
idx = int(detections[0, 0, i, 1])
box = detections[0, 0, i, 3:7] * np.array([w, h, w, h])
(startX, startY, endX, endY) = box.astype("int")
if (confidence * 100) > 50:
label = "{}: {:.2f}%".format(CLASSES[idx],confidence * 100)
cv2.rectangle(image_np, (startX, startY), (endX, endY),COLORS[idx], 2)
y = startY - 15 if startY - 15 > 15 else startY + 15
image_np_expanded = np.expand_dims(image_np, axis=0)
image_tensor = detectionGraph.get_tensor_by_name('image_tensor:0')
boxes = detectionGraph.get_tensor_by_name('detection_boxes:0')
scores = detectionGraph.get_tensor_by_name('detection_scores:0')
classes = detectionGraph.get_tensor_by_name('detection_classes:0')
num_detections = detectionGraph.get_tensor_by_name('num_detections:0')
if image_np_expanded[0] is not None:
(boxes, scores, classes, num_detections) = sess.run([boxes, scores, classes, num_detections],
feed_dict={image_tensor: image_np_expanded})
calculateCollision(boxes, classes, scores, image_np)
cv2.putText(image_np, msg, (230, 50), cv2.FONT_HERSHEY_SIMPLEX, 1.0, (255, 0, 0), 2,
cv2.LINE_AA)
cv2.imshow('Accident Detection', image_np)
if cv2.waitKey(5) & 0xFF == ord('q'):
cv2.destroyAllWindows()
break
def exit():
main.destroy()
font = ('times', 16, 'bold')
title = Label(main, text='Accident Detection')
title.config(bg='light cyan', fg='pale violet red')
title.config(font=font)
title.config(height=3, width=120)
title.place(x=0,y=5)
font1 = ('times', 13, 'bold')
uploadButton = Button(main, text="Load & Generate CNN Model", command=loadModel)
uploadButton.place(x=50,y=100)
uploadButton.config(font=font1)
pathlabel = Label(main)
pathlabel.config(bg='light cyan', fg='pale violet red')
pathlabel.config(font=font1)
pathlabel.place(x=460,y=100)
webcamButton = Button(main, text="Browse System Videos", command=uploadVideo)
webcamButton.place(x=50,y=150)
webcamButton.config(font=font1)
webcamButton = Button(main, text="Start Accident Detector", command=detector)
webcamButton.place(x=50,y=200)
webcamButton.config(font=font1)
exitButton = Button(main, text="Exit", command=exit)
exitButton.place(x=330,y=250)
exitButton.config(font=font1)
font1 = ('times', 12, 'bold')
text=Text(main,height=20,width=150)
scroll=Scrollbar(text)
text.configure(yscrollcommand=scroll.set)
text.place(x=10,y=250)
text.config(font=font1)
main.config(bg='snow3')
main.mainloop()
an 4.1 SYSTEM ARCHITECTTRE: 4.2 DATA FLOW DIAGRAM: 1. The DFD is also called
as bubble chart. It is a simple graphical formalism that can be used to represent a system in terms
of input data to the system, various processing carried out on this data, and the output data is
What is the UML Class diagram for accident detection using CNN- i have.pdf

More Related Content

Similar to What is the UML Class diagram for accident detection using CNN- i have.pdf

Python program to build deep learning algorithm using a CNNs model to.docx
Python program to build deep learning algorithm using a CNNs model to.docxPython program to build deep learning algorithm using a CNNs model to.docx
Python program to build deep learning algorithm using a CNNs model to.docxLukeQVdGrantg
 
Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)
Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)
Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)Thomas Fan
 
Hybrid quantum classical neural networks with pytorch and qiskit
Hybrid quantum classical neural networks with pytorch and qiskitHybrid quantum classical neural networks with pytorch and qiskit
Hybrid quantum classical neural networks with pytorch and qiskitVijayananda Mohire
 
Deep learning with C++ - an introduction to tiny-dnn
Deep learning with C++  - an introduction to tiny-dnnDeep learning with C++  - an introduction to tiny-dnn
Deep learning with C++ - an introduction to tiny-dnnTaiga Nomi
 
Gaussian Image Blurring in CUDA C++
Gaussian Image Blurring in CUDA C++Gaussian Image Blurring in CUDA C++
Gaussian Image Blurring in CUDA C++Darshan Parsana
 
Using the code below- I need help with the following 3 things- 1) Writ.pdf
Using the code below- I need help with the following 3 things- 1) Writ.pdfUsing the code below- I need help with the following 3 things- 1) Writ.pdf
Using the code below- I need help with the following 3 things- 1) Writ.pdfacteleshoppe
 
Python과 node.js기반 데이터 분석 및 가시화
Python과 node.js기반 데이터 분석 및 가시화Python과 node.js기반 데이터 분석 및 가시화
Python과 node.js기반 데이터 분석 및 가시화Tae wook kang
 
Hangman Code.pdf
Hangman Code.pdfHangman Code.pdf
Hangman Code.pdfkyakarega1
 
[Paper] learning video representations from correspondence proposals
[Paper]  learning video representations from correspondence proposals[Paper]  learning video representations from correspondence proposals
[Paper] learning video representations from correspondence proposalsSusang Kim
 
Denis Sergienko "Pip install driven deep learning"
Denis Sergienko "Pip install driven deep learning"Denis Sergienko "Pip install driven deep learning"
Denis Sergienko "Pip install driven deep learning"Fwdays
 
You are task to add a yawning detection to the programme below;i.pdf
You are task to add a yawning detection to the programme below;i.pdfYou are task to add a yawning detection to the programme below;i.pdf
You are task to add a yawning detection to the programme below;i.pdfsales223546
 
Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report Alamgir Hossain
 
Machine Learning - Introduction
Machine Learning - IntroductionMachine Learning - Introduction
Machine Learning - IntroductionEmpatika
 
6.3.2 CLIMADA model demo
6.3.2 CLIMADA model demo6.3.2 CLIMADA model demo
6.3.2 CLIMADA model demoNAP Events
 
DeepLearning ハンズオン資料 20161220
DeepLearning ハンズオン資料 20161220DeepLearning ハンズオン資料 20161220
DeepLearning ハンズオン資料 20161220Mutsuyuki Tanaka
 
Parallel R in snow (english after 2nd slide)
Parallel R in snow (english after 2nd slide)Parallel R in snow (english after 2nd slide)
Parallel R in snow (english after 2nd slide)Cdiscount
 

Similar to What is the UML Class diagram for accident detection using CNN- i have.pdf (20)

Python program to build deep learning algorithm using a CNNs model to.docx
Python program to build deep learning algorithm using a CNNs model to.docxPython program to build deep learning algorithm using a CNNs model to.docx
Python program to build deep learning algorithm using a CNNs model to.docx
 
Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)
Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)
Pydata DC 2018 (Skorch - A Union of Scikit-learn and PyTorch)
 
Hybrid quantum classical neural networks with pytorch and qiskit
Hybrid quantum classical neural networks with pytorch and qiskitHybrid quantum classical neural networks with pytorch and qiskit
Hybrid quantum classical neural networks with pytorch and qiskit
 
Deep learning with C++ - an introduction to tiny-dnn
Deep learning with C++  - an introduction to tiny-dnnDeep learning with C++  - an introduction to tiny-dnn
Deep learning with C++ - an introduction to tiny-dnn
 
Gaussian Image Blurring in CUDA C++
Gaussian Image Blurring in CUDA C++Gaussian Image Blurring in CUDA C++
Gaussian Image Blurring in CUDA C++
 
Python OpenCV Real Time projects
Python OpenCV Real Time projectsPython OpenCV Real Time projects
Python OpenCV Real Time projects
 
Using the code below- I need help with the following 3 things- 1) Writ.pdf
Using the code below- I need help with the following 3 things- 1) Writ.pdfUsing the code below- I need help with the following 3 things- 1) Writ.pdf
Using the code below- I need help with the following 3 things- 1) Writ.pdf
 
Python과 node.js기반 데이터 분석 및 가시화
Python과 node.js기반 데이터 분석 및 가시화Python과 node.js기반 데이터 분석 및 가시화
Python과 node.js기반 데이터 분석 및 가시화
 
Hangman Code.pdf
Hangman Code.pdfHangman Code.pdf
Hangman Code.pdf
 
[Paper] learning video representations from correspondence proposals
[Paper]  learning video representations from correspondence proposals[Paper]  learning video representations from correspondence proposals
[Paper] learning video representations from correspondence proposals
 
Denis Sergienko "Pip install driven deep learning"
Denis Sergienko "Pip install driven deep learning"Denis Sergienko "Pip install driven deep learning"
Denis Sergienko "Pip install driven deep learning"
 
TVM VTA (TSIM)
TVM VTA (TSIM) TVM VTA (TSIM)
TVM VTA (TSIM)
 
You are task to add a yawning detection to the programme below;i.pdf
You are task to add a yawning detection to the programme below;i.pdfYou are task to add a yawning detection to the programme below;i.pdf
You are task to add a yawning detection to the programme below;i.pdf
 
Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report
 
Machine Learning - Introduction
Machine Learning - IntroductionMachine Learning - Introduction
Machine Learning - Introduction
 
6.3.2 CLIMADA model demo
6.3.2 CLIMADA model demo6.3.2 CLIMADA model demo
6.3.2 CLIMADA model demo
 
alexnet.pdf
alexnet.pdfalexnet.pdf
alexnet.pdf
 
Computer vision
Computer vision Computer vision
Computer vision
 
DeepLearning ハンズオン資料 20161220
DeepLearning ハンズオン資料 20161220DeepLearning ハンズオン資料 20161220
DeepLearning ハンズオン資料 20161220
 
Parallel R in snow (english after 2nd slide)
Parallel R in snow (english after 2nd slide)Parallel R in snow (english after 2nd slide)
Parallel R in snow (english after 2nd slide)
 

More from anilagarwal8880432

What is the mechanistic basis for proteins interacting with other mole.pdf
What is the mechanistic basis for proteins interacting with other mole.pdfWhat is the mechanistic basis for proteins interacting with other mole.pdf
What is the mechanistic basis for proteins interacting with other mole.pdfanilagarwal8880432
 
What is the main challenge-s of NLP- Handling Tokenization Handling PO.pdf
What is the main challenge-s of NLP- Handling Tokenization Handling PO.pdfWhat is the main challenge-s of NLP- Handling Tokenization Handling PO.pdf
What is the main challenge-s of NLP- Handling Tokenization Handling PO.pdfanilagarwal8880432
 
What is the main point of each paragraph- Main point of paragraph 1-.pdf
What is the main point of each paragraph- Main point of paragraph 1-.pdfWhat is the main point of each paragraph- Main point of paragraph 1-.pdf
What is the main point of each paragraph- Main point of paragraph 1-.pdfanilagarwal8880432
 
What is the mechanistic basis for protein-protein interactions- Polype.pdf
What is the mechanistic basis for protein-protein interactions- Polype.pdfWhat is the mechanistic basis for protein-protein interactions- Polype.pdf
What is the mechanistic basis for protein-protein interactions- Polype.pdfanilagarwal8880432
 
What is the main principle of Boyle's Law that applies to the respirat.pdf
What is the main principle of Boyle's Law that applies to the respirat.pdfWhat is the main principle of Boyle's Law that applies to the respirat.pdf
What is the main principle of Boyle's Law that applies to the respirat.pdfanilagarwal8880432
 
what is the income tax payments for Coca-Cola and PepsiCo- The financi.pdf
what is the income tax payments for Coca-Cola and PepsiCo- The financi.pdfwhat is the income tax payments for Coca-Cola and PepsiCo- The financi.pdf
what is the income tax payments for Coca-Cola and PepsiCo- The financi.pdfanilagarwal8880432
 
What is the main advantage of using random forest (RF) over a single d.pdf
What is the main advantage of using random forest (RF) over a single d.pdfWhat is the main advantage of using random forest (RF) over a single d.pdf
What is the main advantage of using random forest (RF) over a single d.pdfanilagarwal8880432
 
What is the largest drawback from having researchers post original dat.pdf
What is the largest drawback from having researchers post original dat.pdfWhat is the largest drawback from having researchers post original dat.pdf
What is the largest drawback from having researchers post original dat.pdfanilagarwal8880432
 
What is the entry returned by the peek method after the following stac.pdf
What is the entry returned by the peek method after the following stac.pdfWhat is the entry returned by the peek method after the following stac.pdf
What is the entry returned by the peek method after the following stac.pdfanilagarwal8880432
 
What is the effect on the accounting equation when a company records a.pdf
What is the effect on the accounting equation when a company records a.pdfWhat is the effect on the accounting equation when a company records a.pdf
What is the effect on the accounting equation when a company records a.pdfanilagarwal8880432
 
What is the entire series of events through a three-neuron loop- inclu.pdf
What is the entire series of events through a three-neuron loop- inclu.pdfWhat is the entire series of events through a three-neuron loop- inclu.pdf
What is the entire series of events through a three-neuron loop- inclu.pdfanilagarwal8880432
 
What is the difference tetwent a defred name with giobal scepe and ane.pdf
What is the difference tetwent a defred name with giobal scepe and ane.pdfWhat is the difference tetwent a defred name with giobal scepe and ane.pdf
What is the difference tetwent a defred name with giobal scepe and ane.pdfanilagarwal8880432
 
What is the difference between inheritance and polymorphism-provide ex.pdf
What is the difference between inheritance and polymorphism-provide ex.pdfWhat is the difference between inheritance and polymorphism-provide ex.pdf
What is the difference between inheritance and polymorphism-provide ex.pdfanilagarwal8880432
 
What is the difference between a midrib and a vein in a leaf-answer co.pdf
What is the difference between a midrib and a vein in a leaf-answer co.pdfWhat is the difference between a midrib and a vein in a leaf-answer co.pdf
What is the difference between a midrib and a vein in a leaf-answer co.pdfanilagarwal8880432
 
What is the difference between formal and informal groups- Informal te.pdf
What is the difference between formal and informal groups- Informal te.pdfWhat is the difference between formal and informal groups- Informal te.pdf
What is the difference between formal and informal groups- Informal te.pdfanilagarwal8880432
 
What is the internal growth rate for Orange Corporation- Use Exhibit I.pdf
What is the internal growth rate for Orange Corporation- Use Exhibit I.pdfWhat is the internal growth rate for Orange Corporation- Use Exhibit I.pdf
What is the internal growth rate for Orange Corporation- Use Exhibit I.pdfanilagarwal8880432
 
what is the importance of understanding the characteristics of multimo.pdf
what is the importance of understanding the characteristics of multimo.pdfwhat is the importance of understanding the characteristics of multimo.pdf
what is the importance of understanding the characteristics of multimo.pdfanilagarwal8880432
 
What is the importance of reproductive isolation to the biological spe.pdf
What is the importance of reproductive isolation to the biological spe.pdfWhat is the importance of reproductive isolation to the biological spe.pdf
What is the importance of reproductive isolation to the biological spe.pdfanilagarwal8880432
 
What is the external financing needed- (Do not round intermediate calc.pdf
What is the external financing needed- (Do not round intermediate calc.pdfWhat is the external financing needed- (Do not round intermediate calc.pdf
What is the external financing needed- (Do not round intermediate calc.pdfanilagarwal8880432
 
What is the difference between the peripheral and central nervous syst.pdf
What is the difference between the peripheral and central nervous syst.pdfWhat is the difference between the peripheral and central nervous syst.pdf
What is the difference between the peripheral and central nervous syst.pdfanilagarwal8880432
 

More from anilagarwal8880432 (20)

What is the mechanistic basis for proteins interacting with other mole.pdf
What is the mechanistic basis for proteins interacting with other mole.pdfWhat is the mechanistic basis for proteins interacting with other mole.pdf
What is the mechanistic basis for proteins interacting with other mole.pdf
 
What is the main challenge-s of NLP- Handling Tokenization Handling PO.pdf
What is the main challenge-s of NLP- Handling Tokenization Handling PO.pdfWhat is the main challenge-s of NLP- Handling Tokenization Handling PO.pdf
What is the main challenge-s of NLP- Handling Tokenization Handling PO.pdf
 
What is the main point of each paragraph- Main point of paragraph 1-.pdf
What is the main point of each paragraph- Main point of paragraph 1-.pdfWhat is the main point of each paragraph- Main point of paragraph 1-.pdf
What is the main point of each paragraph- Main point of paragraph 1-.pdf
 
What is the mechanistic basis for protein-protein interactions- Polype.pdf
What is the mechanistic basis for protein-protein interactions- Polype.pdfWhat is the mechanistic basis for protein-protein interactions- Polype.pdf
What is the mechanistic basis for protein-protein interactions- Polype.pdf
 
What is the main principle of Boyle's Law that applies to the respirat.pdf
What is the main principle of Boyle's Law that applies to the respirat.pdfWhat is the main principle of Boyle's Law that applies to the respirat.pdf
What is the main principle of Boyle's Law that applies to the respirat.pdf
 
what is the income tax payments for Coca-Cola and PepsiCo- The financi.pdf
what is the income tax payments for Coca-Cola and PepsiCo- The financi.pdfwhat is the income tax payments for Coca-Cola and PepsiCo- The financi.pdf
what is the income tax payments for Coca-Cola and PepsiCo- The financi.pdf
 
What is the main advantage of using random forest (RF) over a single d.pdf
What is the main advantage of using random forest (RF) over a single d.pdfWhat is the main advantage of using random forest (RF) over a single d.pdf
What is the main advantage of using random forest (RF) over a single d.pdf
 
What is the largest drawback from having researchers post original dat.pdf
What is the largest drawback from having researchers post original dat.pdfWhat is the largest drawback from having researchers post original dat.pdf
What is the largest drawback from having researchers post original dat.pdf
 
What is the entry returned by the peek method after the following stac.pdf
What is the entry returned by the peek method after the following stac.pdfWhat is the entry returned by the peek method after the following stac.pdf
What is the entry returned by the peek method after the following stac.pdf
 
What is the effect on the accounting equation when a company records a.pdf
What is the effect on the accounting equation when a company records a.pdfWhat is the effect on the accounting equation when a company records a.pdf
What is the effect on the accounting equation when a company records a.pdf
 
What is the entire series of events through a three-neuron loop- inclu.pdf
What is the entire series of events through a three-neuron loop- inclu.pdfWhat is the entire series of events through a three-neuron loop- inclu.pdf
What is the entire series of events through a three-neuron loop- inclu.pdf
 
What is the difference tetwent a defred name with giobal scepe and ane.pdf
What is the difference tetwent a defred name with giobal scepe and ane.pdfWhat is the difference tetwent a defred name with giobal scepe and ane.pdf
What is the difference tetwent a defred name with giobal scepe and ane.pdf
 
What is the difference between inheritance and polymorphism-provide ex.pdf
What is the difference between inheritance and polymorphism-provide ex.pdfWhat is the difference between inheritance and polymorphism-provide ex.pdf
What is the difference between inheritance and polymorphism-provide ex.pdf
 
What is the difference between a midrib and a vein in a leaf-answer co.pdf
What is the difference between a midrib and a vein in a leaf-answer co.pdfWhat is the difference between a midrib and a vein in a leaf-answer co.pdf
What is the difference between a midrib and a vein in a leaf-answer co.pdf
 
What is the difference between formal and informal groups- Informal te.pdf
What is the difference between formal and informal groups- Informal te.pdfWhat is the difference between formal and informal groups- Informal te.pdf
What is the difference between formal and informal groups- Informal te.pdf
 
What is the internal growth rate for Orange Corporation- Use Exhibit I.pdf
What is the internal growth rate for Orange Corporation- Use Exhibit I.pdfWhat is the internal growth rate for Orange Corporation- Use Exhibit I.pdf
What is the internal growth rate for Orange Corporation- Use Exhibit I.pdf
 
what is the importance of understanding the characteristics of multimo.pdf
what is the importance of understanding the characteristics of multimo.pdfwhat is the importance of understanding the characteristics of multimo.pdf
what is the importance of understanding the characteristics of multimo.pdf
 
What is the importance of reproductive isolation to the biological spe.pdf
What is the importance of reproductive isolation to the biological spe.pdfWhat is the importance of reproductive isolation to the biological spe.pdf
What is the importance of reproductive isolation to the biological spe.pdf
 
What is the external financing needed- (Do not round intermediate calc.pdf
What is the external financing needed- (Do not round intermediate calc.pdfWhat is the external financing needed- (Do not round intermediate calc.pdf
What is the external financing needed- (Do not round intermediate calc.pdf
 
What is the difference between the peripheral and central nervous syst.pdf
What is the difference between the peripheral and central nervous syst.pdfWhat is the difference between the peripheral and central nervous syst.pdf
What is the difference between the peripheral and central nervous syst.pdf
 

Recently uploaded

Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 

Recently uploaded (20)

Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 

What is the UML Class diagram for accident detection using CNN- i have.pdf

  • 1. What is the UML Class diagram for accident detection using CNN. i have make the class diagram which is not sufficient to my guide. Class diagram: . SYSTEM ARCHITECTURE: Code for the accident detection:- from tkinter import messagebox from tkinter import * from tkinter import simpledialog import tkinter from tkinter import filedialog from tkinter.filedialog import askopenfilename import time import cv2 import tensorflow as tf from collections import namedtuple import numpy as np import winsound main = tkinter.Tk() main.title("Accident Detection") main.geometry("1300x1200") net = cv2.dnn.readNetFromCaffe("model/MobileNetSSD_deploy.prototxt.txt","model/MobileNetSSD _deploy.caffemodel") CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat",
  • 2. "bottle", "bus", "car", "cat", "chair", "cow", "diningtable", "dog", "horse", "motorbike", "person", "pottedplant", "sheep", "sofa", "train", "tvmonitor"] COLORS = np.random.uniform(0, 255, size=(len(CLASSES), 3)) global filename global detectionGraph global msg def loadModel(): global detectionGraph detectionGraph = tf.Graph() with detectionGraph.as_default(): od_graphDef = tf.compat.v1.GraphDef() with tf.compat.v2.io.gfile.GFile('model/frozen_inference_graph.pb', 'rb') as file: serializedGraph = file.read() od_graphDef.ParseFromString(serializedGraph) tf.import_graph_def(od_graphDef, name='') messagebox.showinfo("Training model loaded","Training model loaded") def beep(): frequency = 2500 # Set Frequency To 2500 Hertz duration = 1000 # Set Duration To 1000 ms == 1 second winsound.Beep(frequency, duration) def uploadVideo():
  • 3. global filename filename = filedialog.askopenfilename(initialdir="videos") pathlabel.config(text=filename) text.delete('1.0', END) text.insert(END,filename+" loadedn"); def calculateCollision(boxes,classes,scores,image_np): global msg #cv2.putText(image_np, "NORMAL!", (230, 50), cv2.FONT_HERSHEY_SIMPLEX, 1.0, (255, 255, 255), 2, cv2.LINE_AA) for i, b in enumerate(boxes[0]): if classes[0][i] == 3 or classes[0][i] == 6 or classes[0][i] == 8: if scores[0][i] > 0.5: for j, c in enumerate(boxes[0]): if (i != j) and (classes[0][j] == 3 or classes[0][j] == 6 or classes[0][j] == 8) and scores[0][j]> 0.5: Rectangle = namedtuple('Rectangle', 'xmin ymin xmax ymax') ra = Rectangle(boxes[0][i][3], boxes[0][i][2], boxes[0][i][1], boxes[0][i][3]) rb = Rectangle(boxes[0][j][3], boxes[0][j][2], boxes[0][j][1], boxes[0][j][3]) ar = rectArea(boxes[0][i][3], boxes[0][i][1],boxes[0][i][2],boxes[0][i][3]) col_threshold = 0.6*np.sqrt(ar) area(ra, rb) if (area(ra,rb)<col_threshold) : print('accident') msg = 'ACCIDENT!' beep()
  • 4. return True else: return False def rectArea(xmax, ymax, xmin, ymin): x = np.abs(xmax-xmin) y = np.abs(ymax-ymin) return x*y def load_image_into_numpy_array(image): (im_width, im_height) = image.size return np.array(image.getdata()).reshape((im_height, im_width, 3)).astype(np.uint8) def area(a, b): # returns None if rectangles don't intersect dx = min(a.xmax, b.xmax) - max(a.xmin, b.xmin) dy = min(a.ymax, b.ymax) - max(a.ymin, b.ymin) return dx*dy def detector(): global msg msg = '' cap = cv2.VideoCapture(filename) with detectionGraph.as_default(): with tf.compat.v1.Session(graph=detectionGraph) as sess: while True: ret, image_np = cap.read() (h, w) = image_np.shape[:2]
  • 5. blob = cv2.dnn.blobFromImage(cv2.resize(image_np, (300, 300)),0.007843, (300, 300), 127.5) net.setInput(blob) detections = net.forward() for i in np.arange(0, detections.shape[2]): confidence = detections[0, 0, i, 2] if confidence > 0.2: idx = int(detections[0, 0, i, 1]) box = detections[0, 0, i, 3:7] * np.array([w, h, w, h]) (startX, startY, endX, endY) = box.astype("int") if (confidence * 100) > 50: label = "{}: {:.2f}%".format(CLASSES[idx],confidence * 100) cv2.rectangle(image_np, (startX, startY), (endX, endY),COLORS[idx], 2) y = startY - 15 if startY - 15 > 15 else startY + 15 image_np_expanded = np.expand_dims(image_np, axis=0) image_tensor = detectionGraph.get_tensor_by_name('image_tensor:0') boxes = detectionGraph.get_tensor_by_name('detection_boxes:0') scores = detectionGraph.get_tensor_by_name('detection_scores:0') classes = detectionGraph.get_tensor_by_name('detection_classes:0') num_detections = detectionGraph.get_tensor_by_name('num_detections:0') if image_np_expanded[0] is not None: (boxes, scores, classes, num_detections) = sess.run([boxes, scores, classes, num_detections], feed_dict={image_tensor: image_np_expanded}) calculateCollision(boxes, classes, scores, image_np)
  • 6. cv2.putText(image_np, msg, (230, 50), cv2.FONT_HERSHEY_SIMPLEX, 1.0, (255, 0, 0), 2, cv2.LINE_AA) cv2.imshow('Accident Detection', image_np) if cv2.waitKey(5) & 0xFF == ord('q'): cv2.destroyAllWindows() break def exit(): main.destroy() font = ('times', 16, 'bold') title = Label(main, text='Accident Detection') title.config(bg='light cyan', fg='pale violet red') title.config(font=font) title.config(height=3, width=120) title.place(x=0,y=5) font1 = ('times', 13, 'bold') uploadButton = Button(main, text="Load & Generate CNN Model", command=loadModel) uploadButton.place(x=50,y=100) uploadButton.config(font=font1) pathlabel = Label(main) pathlabel.config(bg='light cyan', fg='pale violet red') pathlabel.config(font=font1) pathlabel.place(x=460,y=100) webcamButton = Button(main, text="Browse System Videos", command=uploadVideo)
  • 7. webcamButton.place(x=50,y=150) webcamButton.config(font=font1) webcamButton = Button(main, text="Start Accident Detector", command=detector) webcamButton.place(x=50,y=200) webcamButton.config(font=font1) exitButton = Button(main, text="Exit", command=exit) exitButton.place(x=330,y=250) exitButton.config(font=font1) font1 = ('times', 12, 'bold') text=Text(main,height=20,width=150) scroll=Scrollbar(text) text.configure(yscrollcommand=scroll.set) text.place(x=10,y=250) text.config(font=font1) main.config(bg='snow3') main.mainloop() an 4.1 SYSTEM ARCHITECTTRE: 4.2 DATA FLOW DIAGRAM: 1. The DFD is also called as bubble chart. It is a simple graphical formalism that can be used to represent a system in terms of input data to the system, various processing carried out on this data, and the output data is