SlideShare a Scribd company logo
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
Ad

More Related Content

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

This face recognition attendance system code for face recogn.pdf
This face recognition attendance system code for face recogn.pdfThis face recognition attendance system code for face recogn.pdf
This face recognition attendance system code for face recogn.pdf
adislifestyle
 
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
LukeQVdGrantg
 
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
 
assignment_7_sc report for soft comptuing
assignment_7_sc report for soft comptuingassignment_7_sc report for soft comptuing
assignment_7_sc report for soft comptuing
SainadhReddySyamalaA
 
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
Vijayananda Mohire
 
Introduction to Artificial intelligence Master Class.pptx
Introduction to Artificial intelligence Master Class.pptxIntroduction to Artificial intelligence Master Class.pptx
Introduction to Artificial intelligence Master Class.pptx
krishan8018
 
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
Taiga 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
 
Python OpenCV Real Time projects
Python OpenCV Real Time projectsPython OpenCV Real Time projects
Python OpenCV Real Time projects
Amarjeetsingh Thakur
 
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
acteleshoppe
 
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.pdf
kyakarega1
 
[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
Susang Kim
 
2.3 SciPy library explained detialed 1.pptx
2.3 SciPy library explained detialed 1.pptx2.3 SciPy library explained detialed 1.pptx
2.3 SciPy library explained detialed 1.pptx
RaveshRawal
 
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
 
TVM VTA (TSIM)
TVM VTA (TSIM) TVM VTA (TSIM)
TVM VTA (TSIM)
Mr. Vengineer
 
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
sales223546
 
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 - Introduction
Empatika
 
6.3.2 CLIMADA model demo
6.3.2 CLIMADA model demo6.3.2 CLIMADA model demo
6.3.2 CLIMADA model demo
NAP Events
 
This face recognition attendance system code for face recogn.pdf
This face recognition attendance system code for face recogn.pdfThis face recognition attendance system code for face recogn.pdf
This face recognition attendance system code for face recogn.pdf
adislifestyle
 
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
LukeQVdGrantg
 
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
 
assignment_7_sc report for soft comptuing
assignment_7_sc report for soft comptuingassignment_7_sc report for soft comptuing
assignment_7_sc report for soft comptuing
SainadhReddySyamalaA
 
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
Vijayananda Mohire
 
Introduction to Artificial intelligence Master Class.pptx
Introduction to Artificial intelligence Master Class.pptxIntroduction to Artificial intelligence Master Class.pptx
Introduction to Artificial intelligence Master Class.pptx
krishan8018
 
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
Taiga 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.pdf
acteleshoppe
 
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.pdf
kyakarega1
 
[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
Susang Kim
 
2.3 SciPy library explained detialed 1.pptx
2.3 SciPy library explained detialed 1.pptx2.3 SciPy library explained detialed 1.pptx
2.3 SciPy library explained detialed 1.pptx
RaveshRawal
 
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.pdf
sales223546
 
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 - Introduction
Empatika
 
6.3.2 CLIMADA model demo
6.3.2 CLIMADA model demo6.3.2 CLIMADA model demo
6.3.2 CLIMADA model demo
NAP Events
 

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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
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.pdf
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
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
anilagarwal8880432
 
Ad

Recently uploaded (20)

How to Use Upgrade Code Command in Odoo 18
How to Use Upgrade Code Command in Odoo 18How to Use Upgrade Code Command in Odoo 18
How to Use Upgrade Code Command in Odoo 18
Celine George
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
IMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERS
IMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERSIMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERS
IMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERS
rajaselviazhagiri1
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
Final Evaluation.docx...........................
Final Evaluation.docx...........................Final Evaluation.docx...........................
Final Evaluation.docx...........................
l1bbyburrell
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
Nguyen Thanh Tu Collection
 
libbys peer assesment.docx..............
libbys peer assesment.docx..............libbys peer assesment.docx..............
libbys peer assesment.docx..............
19lburrell
 
LDMMIA Reiki Yoga S6 Free Workshop Money Pt 2
LDMMIA Reiki Yoga S6 Free Workshop Money Pt 2LDMMIA Reiki Yoga S6 Free Workshop Money Pt 2
LDMMIA Reiki Yoga S6 Free Workshop Money Pt 2
LDM & Mia eStudios
 
How to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 WebsiteHow to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 Website
Celine George
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
Bipolar Junction Transistors (BJTs): Basics, Construction & Configurations
Bipolar Junction Transistors (BJTs): Basics, Construction & ConfigurationsBipolar Junction Transistors (BJTs): Basics, Construction & Configurations
Bipolar Junction Transistors (BJTs): Basics, Construction & Configurations
GS Virdi
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
GENERAL QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 4 MARCH 2025 .pdf
GENERAL QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 4 MARCH 2025 .pdfGENERAL QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 4 MARCH 2025 .pdf
GENERAL QUIZ PRELIMS | QUIZ CLUB OF PSGCAS | 4 MARCH 2025 .pdf
Quiz Club of PSG College of Arts & Science
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-14-2025 .pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-14-2025  .pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-14-2025  .pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-14-2025 .pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
Dr. Nasir Mustafa
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...
parmarjuli1412
 
Pope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptxPope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptx
Martin M Flynn
 
How to Use Upgrade Code Command in Odoo 18
How to Use Upgrade Code Command in Odoo 18How to Use Upgrade Code Command in Odoo 18
How to Use Upgrade Code Command in Odoo 18
Celine George
 
E-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26ASE-Filing_of_Income_Tax.pptx and concept of form 26AS
E-Filing_of_Income_Tax.pptx and concept of form 26AS
Abinash Palangdar
 
IMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERS
IMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERSIMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERS
IMPACT_OF_SOCIAL-MEDIA- AMONG- TEENAGERS
rajaselviazhagiri1
 
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
Mental Health Assessment in 5th semester bsc. nursing and also used in 2nd ye...
parmarjuli1412
 
Final Evaluation.docx...........................
Final Evaluation.docx...........................Final Evaluation.docx...........................
Final Evaluation.docx...........................
l1bbyburrell
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
BÀI TẬP BỔ TRỢ TIẾNG ANH 9 THEO ĐƠN VỊ BÀI HỌC - GLOBAL SUCCESS - CẢ NĂM (TỪ...
Nguyen Thanh Tu Collection
 
libbys peer assesment.docx..............
libbys peer assesment.docx..............libbys peer assesment.docx..............
libbys peer assesment.docx..............
19lburrell
 
LDMMIA Reiki Yoga S6 Free Workshop Money Pt 2
LDMMIA Reiki Yoga S6 Free Workshop Money Pt 2LDMMIA Reiki Yoga S6 Free Workshop Money Pt 2
LDMMIA Reiki Yoga S6 Free Workshop Money Pt 2
LDM & Mia eStudios
 
How to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 WebsiteHow to Configure Extra Steps During Checkout in Odoo 18 Website
How to Configure Extra Steps During Checkout in Odoo 18 Website
Celine George
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
Bipolar Junction Transistors (BJTs): Basics, Construction & Configurations
Bipolar Junction Transistors (BJTs): Basics, Construction & ConfigurationsBipolar Junction Transistors (BJTs): Basics, Construction & Configurations
Bipolar Junction Transistors (BJTs): Basics, Construction & Configurations
GS Virdi
 
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Redesigning Education as a Cognitive Ecosystem: Practical Insights into Emerg...
Leonel Morgado
 
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales moduleHow To Maximize Sales Performance using Odoo 18 Diverse views in sales module
How To Maximize Sales Performance using Odoo 18 Diverse views in sales module
Celine George
 
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
Dr. Nasir Mustafa
 
Search Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo SlidesSearch Matching Applicants in Odoo 18 - Odoo Slides
Search Matching Applicants in Odoo 18 - Odoo Slides
Celine George
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...Classification of mental disorder in 5th semester bsc. nursing and also used ...
Classification of mental disorder in 5th semester bsc. nursing and also used ...
parmarjuli1412
 
Pope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptxPope Leo XIV, the first Pope from North America.pptx
Pope Leo XIV, the first Pope from North America.pptx
Martin M Flynn
 
Ad

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
  翻译: