-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFinalTriple.py
More file actions
39 lines (39 loc) · 1.28 KB
/
FinalTriple.py
File metadata and controls
39 lines (39 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from imageai.Detection import ObjectDetection
from matplotlib import pyplot as plt
from keras.preprocessing.image import load_img
import cv2
import Challan
def main(FrameNumber):
persontriplecount=0
detector= ObjectDetection()
detector.setModelTypeAsYOLOv3()
detector.setModelPath("yolov3.pt")
detector.loadModel()
input = "OutPut/Finalnew/Full/full-"+str(FrameNumber)+".jpg"
custom=detector.CustomObjects(person=True)
plt.show()
detections=detector.detectObjectsFromImage(custom_objects=custom, input_image=input,output_image_path="OutPut/FinalOutput/Triple.jpg",minimum_percentage_probability=90)
count=0
imjh=load_img(input)
plt.figure()
plt.imshow(imjh)
plt.show()
for eachObject in detections:
print(eachObject["name"]," : ",eachObject["percentage_probability"]," : ",eachObject["box_points"])
print("_______________________")
count+=1
print("No of person : ",count)
imjhout=load_img("OutPut/FinalOutput/Triple.jpg")
plt.figure()
plt.imshow(imjhout)
plt.show()
plt.pause(0.1)
persontriplecount=count
if count>=3 :
print("Triple Riding.")
print("go for autochallan")
Challan.main(FrameNumber)
else:
print("No Triple Ride")
if __name__=="__main__":
main()