Commit 310b078e authored by Sikhin VC's avatar Sikhin VC

rtsp changed

parent 28552503
import os import os
# os.environ["config"]="{\"TZ\": \"Asia/Kolkata\", \"MONGO_URI\": \"mongodb://svc-ilens:svc2345@192.168.3.220:21017\", \"MONGO_DATABASE\": \"ilens_wps\", \"MONGO_COLLECTION\": \"janusDeployment\", \"MONGO_KEY\": \"deploymentId\", \"MONGO_VALUE\": \"rahul_12345\", \"MONGO_COLL\": \"serviceConfiguration\", \"MONGO_DB\": \"ilens_wps\"}" # os.environ["config"]="{\"TZ\": \"Asia/Kolkata\", \"MONGO_URI\": \"mongodb://svc-ilens:svc2345@192.168.3.220:21017\", \"MONGO_DATABASE\": \"ilens_wps\", \"MONGO_COLLECTION\": \"janusDeployment\", \"MONGO_KEY\": \"deploymentId\", \"MONGO_VALUE\": \"rahul_12345\", \"MONGO_COLL\": \"serviceConfiguration\", \"MONGO_DB\": \"ilens_wps\"}"
# os.environ["config"]="{\"TZ\": \"Asia/Kolkata\", \"MONGO_URI\": \"mongodb://admin:iLens$HPCLv605@10.5.2.91:2717\", \"MONGO_DATABASE\": \"ilens_ai\", \"MONGO_COLLECTION\": \"janusDeployment\", \"MONGO_KEY\": \"deploymentId\", \"MONGO_VALUE\": \"hpcl_cctv_ppe\", \"MONGO_COLL\": \"serviceConfiguration\", \"MONGO_DB\": \"ilens_ai\"}" # os.environ["config"]="{\"TZ\": \"Asia/Kolkata\", \"MONGO_URI\": \"mongodb://admin:iLens$HPCLv605@10.5.2.91:2717\", \"MONGO_DATABASE\": \"ilens_ai\", \"MONGO_COLLECTION\": \"janusDeployment\", \"MONGO_KEY\": \"deploymentId\", \"MONGO_VALUE\": \"hpcl_cctv_ppe\", \"MONGO_COLL\": \"serviceConfiguration\", \"MONGO_DB\": \"ilens_ai\"}"
os.environ["config"]="{\"TZ\": \"Asia/Kolkata\", \"MONGO_URI\": \"mongodb://admin:iLens$1234@192.168.3.181:2717/admin\", \"MONGO_DATABASE\": \"ilens_ai\", \"MONGO_COLLECTION\": \"janusDeployment\", \"MONGO_KEY\": \"deploymentId\", \"MONGO_VALUE\": \"aarti_ppe\", \"MONGO_COLL\": \"serviceConfiguration\", \"MONGO_DB\": \"ilens_ai\"}" # os.environ["config"]="{\"TZ\": \"Asia/Kolkata\", \"MONGO_URI\": \"mongodb://admin:iLens$1234@192.168.3.181:2717/admin\", \"MONGO_DATABASE\": \"ilens_ai\", \"MONGO_COLLECTION\": \"janusDeployment\", \"MONGO_KEY\": \"deploymentId\", \"MONGO_VALUE\": \"aarti_ppe\", \"MONGO_COLL\": \"serviceConfiguration\", \"MONGO_DB\": \"ilens_ai\"}"
from edge_engine.edge_processor import ExecutePipeline from edge_engine.edge_processor import ExecutePipeline
from edge_engine.edge_processor import Pubs from edge_engine.edge_processor import Pubs
from scripts import Ppe from scripts import Ppe
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -40,3 +40,13 @@ cba5d9e8-2138-4a53-b845-600ffd9ac6c41673945027.7105763.webm ...@@ -40,3 +40,13 @@ cba5d9e8-2138-4a53-b845-600ffd9ac6c41673945027.7105763.webm
3291b3cf-0b04-48f8-993a-c754176c6ca81673945088.4803202.webm 3291b3cf-0b04-48f8-993a-c754176c6ca81673945088.4803202.webm
20a8f4c9-c315-4f3b-b4c7-5028856290ce1673945118.7755.webm 20a8f4c9-c315-4f3b-b4c7-5028856290ce1673945118.7755.webm
13159e47-a9e3-46c2-a611-24eda50329171673945149.1806812.webm 13159e47-a9e3-46c2-a611-24eda50329171673945149.1806812.webm
4667ce2e-598f-4974-9568-2523a03937cf1674613867.1548927.webm
427204c0-7231-47d2-a754-f6495db4dee61674614099.3403118.webm
93dd7783-f0d3-448f-8939-f1279ca908851674614129.876808.webm
341bd053-6817-4d90-a935-0d28c69707201674614160.6690917.webm
1d4fb86c-d147-4b43-a9c3-34d8d1c29cf01674614191.5612426.webm
eae32a35-16aa-4411-a0a5-453a090e3aee1674614222.4885771.webm
4eabe757-497e-476d-83ba-f99d6e0677051674614253.061201.webm
ed6e86fb-391f-4f81-94e8-ce04aca0a93f1674614442.5539196.webm
cbb8ecea-5a6b-4303-9464-dc1acacf10891674614473.4363682.webm
0f4aa969-1ae3-4e6d-b524-29a9e29fe3851674614504.0250866.webm
...@@ -94,7 +94,8 @@ class Ppe(ModelWrapper): ...@@ -94,7 +94,8 @@ class Ppe(ModelWrapper):
self.reported_violation_ids = {} self.reported_violation_ids = {}
self.violation_count = {"Air Breathing Mask": [] , "Safety helmet": [], "Hand gloves": [], "coverall suit": []} self.violation_count = {"Air Breathing Mask": [] , "Safety helmet": [], "Hand gloves": [], "coverall suit": []}
self.uri = "postgres://postgres:postgres@192.168.3.181:5432/postgres?sslmode=disable" #self.uri = "postgres://postgres:postgres@192.168.3.181:5432/postgres?sslmode=disable"
self.uri = "postgres://vision_user:Vision#4321@192.168.0.237:30009/ilens_vision_aarti?sslmode=disable"
self.payload_classes = {"Air Breathing Mask": "air_breathing_mask_violation", "Safety helmet": "helmet_violation", "Hand gloves": "glove_violation", "coverall suit": "coverall_suit_violation"} self.payload_classes = {"Air Breathing Mask": "air_breathing_mask_violation", "Safety helmet": "helmet_violation", "Hand gloves": "glove_violation", "coverall suit": "coverall_suit_violation"}
# connect to the PostgreSQL server # connect to the PostgreSQL server
...@@ -447,7 +448,7 @@ class Ppe(ModelWrapper): ...@@ -447,7 +448,7 @@ class Ppe(ModelWrapper):
# rec_inf[1].release() # rec_inf[1].release()
temp_v_list = rec_inf[3] temp_v_list = rec_inf[3]
print(temp_v_list) print(temp_v_list)
cv2.waitKey(1) # cv2.waitKey(1)
for v in temp_v_list: for v in temp_v_list:
# try: # try:
...@@ -502,7 +503,7 @@ class Ppe(ModelWrapper): ...@@ -502,7 +503,7 @@ class Ppe(ModelWrapper):
# result = self.video_write(frame, unique_id) # result = self.video_write(frame, unique_id)
requests.post('http://192.168.3.181:2328/items/', json={ requests.post('http://192.168.3.181:2328/items/', json={
"rtsp": "rtsp://192.168.3.181:8554/stream", "rtsp": "rtsp://admin:Admin@123@117.222.36.90:10556",
"name": str(unique_id) "name": str(unique_id)
}) })
...@@ -522,7 +523,7 @@ class Ppe(ModelWrapper): ...@@ -522,7 +523,7 @@ class Ppe(ModelWrapper):
cur = self.conn.cursor() cur = self.conn.cursor()
# cur.execute("ROLLBACK") # cur.execute("ROLLBACK")
frame_count = self.frame_id frame_count = self.frame_id
cur.execute(sql, [4, frame_count, datetime.datetime.now(), v]) cur.execute(sql, [1, frame_count, datetime.datetime.now(), v])
self.conn.commit() self.conn.commit()
cur.close() cur.close()
...@@ -534,7 +535,7 @@ class Ppe(ModelWrapper): ...@@ -534,7 +535,7 @@ class Ppe(ModelWrapper):
cur = self.conn.cursor() cur = self.conn.cursor()
frame_count = self.frame_id frame_count = self.frame_id
file_path = "/home/administrator/aarti_violation_videos/" + str(unique_id) + ".webm" file_path = "/home/administrator/aarti_violation_videos/" + str(unique_id) + ".webm"
cur.execute(sql, [frame_count, 4, str(unique_id), datetime.datetime.now(), file_path, v]) cur.execute(sql, [frame_count, 1, str(unique_id), datetime.datetime.now(), file_path, v])
self.conn.commit() self.conn.commit()
cur.close() cur.close()
except: except:
...@@ -593,7 +594,7 @@ class Ppe(ModelWrapper): ...@@ -593,7 +594,7 @@ class Ppe(ModelWrapper):
# rec_inf[1].release() # rec_inf[1].release()
temp_v_list = rec_inf[3] temp_v_list = rec_inf[3]
print(temp_v_list) print(temp_v_list)
cv2.waitKey(1) # cv2.waitKey(1)
for v in temp_v_list: for v in temp_v_list:
# # try: # # try:
# #
...@@ -654,7 +655,7 @@ class Ppe(ModelWrapper): ...@@ -654,7 +655,7 @@ class Ppe(ModelWrapper):
# f.write("\n") # f.write("\n")
# result = self.video_write(frame, unique_id) # result = self.video_write(frame, unique_id)
requests.post('http://192.168.3.181:2328/items/', json={ requests.post('http://192.168.3.181:2328/items/', json={
"rtsp": "rtsp://192.168.3.181:8554/stream", "rtsp": "rtsp://admin:Admin@123@117.222.36.90:10556",
"name": str(unique_id) "name": str(unique_id)
}) })
print("unique id is:: ", str(unique_id)) print("unique id is:: ", str(unique_id))
...@@ -670,7 +671,7 @@ class Ppe(ModelWrapper): ...@@ -670,7 +671,7 @@ class Ppe(ModelWrapper):
# present_event_id = 'SELECT "event_id" FROM aarti_violation_event_table' # present_event_id = 'SELECT "event_id" FROM aarti_violation_event_table'
cur = self.conn.cursor() cur = self.conn.cursor()
frame_count = self.frame_id frame_count = self.frame_id
cur.execute(sql, [4, frame_count, datetime.datetime.now(), v]) cur.execute(sql, [1, frame_count, datetime.datetime.now(), v])
self.conn.commit() self.conn.commit()
cur.close() cur.close()
try: try:
...@@ -682,7 +683,7 @@ class Ppe(ModelWrapper): ...@@ -682,7 +683,7 @@ class Ppe(ModelWrapper):
# cur.execute("ROLLBACK") # cur.execute("ROLLBACK")
frame_count = self.frame_id frame_count = self.frame_id
file_path = "/home/administrator/aarti_violation_videos/" + str(unique_id) + ".webm" file_path = "/home/administrator/aarti_violation_videos/" + str(unique_id) + ".webm"
cur.execute(sql, [frame_count, 4, str(unique_id), datetime.datetime.now(), file_path, v]) cur.execute(sql, [frame_count, 1, str(unique_id), datetime.datetime.now(), file_path, v])
self.conn.commit() self.conn.commit()
cur.close() cur.close()
except: except:
...@@ -698,7 +699,7 @@ class Ppe(ModelWrapper): ...@@ -698,7 +699,7 @@ class Ppe(ModelWrapper):
# rec_inf[1].release() # rec_inf[1].release()
temp_v_list = rec_inf[3] temp_v_list = rec_inf[3]
print(temp_v_list) print(temp_v_list)
cv2.waitKey(1) # cv2.waitKey(1)
for v in temp_v_list: for v in temp_v_list:
# try: # try:
...@@ -798,7 +799,7 @@ class Ppe(ModelWrapper): ...@@ -798,7 +799,7 @@ class Ppe(ModelWrapper):
# f.write("\n") # f.write("\n")
# result = self.video_write(frame, unique_id) # result = self.video_write(frame, unique_id)
requests.post('http://192.168.3.181:2328/items/', json={ requests.post('http://192.168.3.181:2328/items/', json={
"rtsp": "rtsp://192.168.3.181:8554/stream", "rtsp": "rtsp://admin:Admin@123@117.222.36.90:10556",
"name": str(unique_id) "name": str(unique_id)
}) })
print("unique id is:: ", str(unique_id)) print("unique id is:: ", str(unique_id))
...@@ -814,7 +815,7 @@ class Ppe(ModelWrapper): ...@@ -814,7 +815,7 @@ class Ppe(ModelWrapper):
# present_event_id = 'SELECT "event_id" FROM aarti_violation_event_table' # present_event_id = 'SELECT "event_id" FROM aarti_violation_event_table'
cur = self.conn.cursor() cur = self.conn.cursor()
frame_count = self.frame_id frame_count = self.frame_id
cur.execute(sql, [4, frame_count, datetime.datetime.now(), v]) cur.execute(sql, [1, frame_count, datetime.datetime.now(), v])
self.conn.commit() self.conn.commit()
cur.close() cur.close()
try: try:
...@@ -826,7 +827,7 @@ class Ppe(ModelWrapper): ...@@ -826,7 +827,7 @@ class Ppe(ModelWrapper):
# cur.execute("ROLLBACK") # cur.execute("ROLLBACK")
frame_count = self.frame_id frame_count = self.frame_id
file_path = "/home/administrator/aarti_violation_videos/" + str(unique_id) + ".webm" file_path = "/home/administrator/aarti_violation_videos/" + str(unique_id) + ".webm"
cur.execute(sql, [frame_count, 4, str(unique_id), datetime.datetime.now(), file_path, v]) cur.execute(sql, [frame_count, 1, str(unique_id), datetime.datetime.now(), file_path, v])
self.conn.commit() self.conn.commit()
cur.close() cur.close()
except: except:
...@@ -1085,8 +1086,8 @@ class Ppe(ModelWrapper): ...@@ -1085,8 +1086,8 @@ class Ppe(ModelWrapper):
# frame = cv2.polylines(frame, self.polygon, # frame = cv2.polylines(frame, self.polygon,
# True, (255, 255, 255), 2) # True, (255, 255, 255), 2)
bbox, frame, class_name, other_class_name, other_centroid = self.inference(frame, class_list) bbox, frame, class_name, other_class_name, other_centroid = self.inference(frame, class_list)
cv2.imshow("out", cv2.resize(frame, (900, 600))) # cv2.imshow("out", cv2.resize(frame, (900, 600)))
cv2.waitKey(1) # cv2.waitKey(1)
# frame = self.draw_line_over_image(frame) # frame = self.draw_line_over_image(frame)
# if [True for e in dets if e['class'] == 'cement_bag']: # if [True for e in dets if e['class'] == 'cement_bag']:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment