Răsfoiți Sursa

平台搭设逻辑修改

dxc 7 luni în urmă
părinte
comite
2d89a9b950
4 a modificat fișierele cu 252 adăugiri și 156 ștergeri
  1. 3 2
      config.py
  2. 1 1
      equipment_cleaning_detect.py
  3. 127 81
      platform_remove_detect.py
  4. 121 72
      platform_setup_detect.py

+ 3 - 2
config.py

@@ -83,10 +83,11 @@ PLATFORM_CH4_RTSP='rtsp://admin:yaoan1234@172.16.22.233/cam/realmonitor?channel=
 
 PLATFORM_CH1_MODEL='/mnt/xcd/code/ai_test/weights/platform_ch1_wearing.pt'
 
-PLATFORM_SETUP_MODEL='/mnt/xcd/code/ai_test/weights/obb830.pt'
+PLATFORM_SETUP_MODEL='/mnt/xcd/code/ai_test/weights/obb_9_2.pt'
 PLATFORM_SETUP_VIDEO_SOURCES=[PLATFORM_CH2_RTSP,
                               #PLATFORM_CH3_RTSP,
-                              PLATFORM_CH4_RTSP]
+                              PLATFORM_CH4_RTSP
+]
 
 PLATFORM_WEARING_MODEL=[
     HUMAN_DETECTION_MODEL,

+ 1 - 1
equipment_cleaning_detect.py

@@ -159,7 +159,7 @@ def process_video(model_path, video_source,start_event):
                             is_inside = any(point_in_region(point,EQUIPMENT_CLEANING_OPERATION_REGION) for point in points)#刷子是否在指定区域
                             if is_inside:
                                 equipment_cleaning_flag[9]=True
-
+            
             if model_path==EQUIPMENT_CLEANING_MODEL_SOURCES[0]:
                 if equipment_cleaning_flag[0] and not redis_client.exists("equipment_step_1"):
                     save_image_and_redis(redis_client, results, "equipment_step_1", SAVE_IMG_PATH, POST_IMG_PATH6)

+ 127 - 81
platform_remove_detect.py

@@ -1,6 +1,7 @@
 import cv2
 import torch
 import time
+import math
 from shapely.geometry import box, Polygon
 import threading
 import numpy as np
@@ -45,18 +46,19 @@ def init_platform_remove_detection():
 
 def start_platform_remove_detection(start_events):
     threads = []
-    model_path = PLATFORM_SETUP_MODEL
-    video_source = PLATFORM_SETUP_VIDEO_SOURCES
-    event = threading.Event()
-    start_events.append(event)
-    thread = threading.Thread(target=process_video, args=(model_path, video_source, event))
-    threads.append(thread)
-    thread.daemon = True
-    thread.start()
+    for video_source in PLATFORM_SETUP_VIDEO_SOURCES:
+        event = threading.Event()
+        start_events.append(event)
+        thread = threading.Thread(target=process_video, args=(PLATFORM_SETUP_MODEL,video_source,event))
+        threads.append(thread)
+        thread.daemon=True
+        thread.start()
 
-    # Wait for the thread to complete
-    thread.join()
-    print("搭设线程运行结束")
+
+    # Wait for all threads to complete
+    for thread in threads:
+        thread.join()
+        print("平台拆除子线程启动")
 
 
 
@@ -101,6 +103,7 @@ def process_video(model_path, video_source,start_event):
 
             for r in results:
                 boxes=r.obb.xyxyxyxy
+                boxes1=r.obb.xywhr
                 confidences=r.obb.conf
                 classes=r.obb.cls
                 
@@ -129,6 +132,8 @@ def process_video(model_path, video_source,start_event):
                 # 13=纵向水平杆3
                 # 14=横向水平杆3
                 platform_remove_steps = [0] * 14
+                hengxianggan=0
+                zongxinaggan=0
                 for i in range(len(boxes)):
                     confidence = confidences[i].item()
                     cls = int(classes[i].item())
@@ -139,92 +144,133 @@ def process_video(model_path, video_source,start_event):
                     x_center = (box_coords[0][0] + box_coords[1][0]+box_coords[2][0]+box_coords[3][0]) / 4
                     y_center=(box_coords[0][1] + box_coords[1][1]+box_coords[2][1]+box_coords[3][1]) / 4
                     center_point = (int(x_center), int(y_center))
+                    rotation= math.degrees(boxes1[i][4])
+
                     if label=="wheel":#轮子
-                        platform_remove_steps_detect_num[0]+=1
-                        if platform_remove_steps_detect_num[0]>3:
-                            platform_remove_steps[0]+=1
-
-                    elif label=="montant":#立杆
-                        platform_remove_steps_detect_num[1]+=1
-                        if platform_remove_steps_detect_num[1]>3:
-                            platform_remove_steps[1]+=1
-                    elif label=="vertical_bar":#水平横杆,纵杆
+                        # platform_remove_steps_detect_num[0]+=1
+                        # if platform_remove_steps_detect_num[0]>3:
+                        platform_remove_steps[0]+=1
+                    elif label=="bar":#立杆
+                        # platform_setup_steps_detect_num[1]+=1
+                        # if platform_setup_steps_detect_num[1]>3:
+                        #     platform_setup_steps[1]+=1
+                        if video_source == PLATFORM_SETUP_VIDEO_SOURCES[0]:
+                            if 70 < rotation < 110:
+                                platform_remove_steps[1] += 1  # 立杆
+                            elif rotation < 10 or rotation > 170:
+                                hengxianggan += 1  # 横向杆
+                            elif 135 < rotation < 150:
+                                platform_remove_steps[8] += 1  # 斜杆
+                            else:
+                                zongxinaggan += 1  # 纵向杆
+                        elif video_source == PLATFORM_SETUP_VIDEO_SOURCES[1]:
+                            if 70 < rotation < 110:
+                                platform_remove_steps[1] += 1  # 立杆
+                            elif 5 < rotation < 25:
+                                hengxianggan += 1  # 横向杆
+                            elif 40 < rotation < 60:
+                                platform_remove_steps[8] += 1  # 斜杆
+                            else:
+                                zongxinaggan += 1  # 纵向杆
+                    # elif label=="montant":#立杆
+                    #     platform_remove_steps_detect_num[1]+=1
+                    #     if platform_remove_steps_detect_num[1]>3:
+                    #         platform_remove_steps[1]+=1
+                    # elif label=="vertical_bar":#水平横杆,纵杆
                         
 
-                        is_inside0 = cv2.pointPolygonTest(LEVLEL0_REGION.reshape((-1, 1, 2)), center_point, False)
-                        is_inside1 = cv2.pointPolygonTest(LEVLEL1_REGION.reshape((-1, 1, 2)), center_point, False)
-                        is_inside2 = cv2.pointPolygonTest(LEVLEL2_REGION.reshape((-1, 1, 2)), center_point, False)
-                        is_inside3 = cv2.pointPolygonTest(LEVLEL3_REGION.reshape((-1, 1, 2)), center_point, False)
-                        #print(is_inside)
-                        if is_inside0>=0 :
-                            platform_remove_steps_detect_num[2]+=1
-                            if platform_remove_steps_detect_num[2]>3:
-                                platform_remove_steps[2]+=1 #表示纵向扫地杆
-                        elif is_inside1>=0:
-                            platform_remove_steps_detect_num[4]+=1
-                            if platform_remove_steps_detect_num[4]>3:
-                                platform_remove_steps[4]+=1#5=纵向水平杆1
-                        elif is_inside2>=0:
-                            platform_remove_steps_detect_num[6]+=1
-                            if platform_remove_steps_detect_num[6]>3:
-                                platform_remove_steps[6]+=1#7=纵向水平杆2
-                        elif is_inside3>=0:
-                            platform_remove_steps_detect_num[12]+=1
-                            if platform_remove_steps_detect_num[12]>3:
-                                platform_remove_steps[12]+=1#13=纵向水平杆3
+                    #     is_inside0 = cv2.pointPolygonTest(LEVLEL0_REGION.reshape((-1, 1, 2)), center_point, False)
+                    #     is_inside1 = cv2.pointPolygonTest(LEVLEL1_REGION.reshape((-1, 1, 2)), center_point, False)
+                    #     is_inside2 = cv2.pointPolygonTest(LEVLEL2_REGION.reshape((-1, 1, 2)), center_point, False)
+                    #     is_inside3 = cv2.pointPolygonTest(LEVLEL3_REGION.reshape((-1, 1, 2)), center_point, False)
+                    #     #print(is_inside)
+                    #     if is_inside0>=0 :
+                    #         platform_remove_steps_detect_num[2]+=1
+                    #         if platform_remove_steps_detect_num[2]>3:
+                    #             platform_remove_steps[2]+=1 #表示纵向扫地杆
+                    #     elif is_inside1>=0:
+                    #         platform_remove_steps_detect_num[4]+=1
+                    #         if platform_remove_steps_detect_num[4]>3:
+                    #             platform_remove_steps[4]+=1#5=纵向水平杆1
+                    #     elif is_inside2>=0:
+                    #         platform_remove_steps_detect_num[6]+=1
+                    #         if platform_remove_steps_detect_num[6]>3:
+                    #             platform_remove_steps[6]+=1#7=纵向水平杆2
+                    #     elif is_inside3>=0:
+                    #         platform_remove_steps_detect_num[12]+=1
+                    #         if platform_remove_steps_detect_num[12]>3:
+                    #             platform_remove_steps[12]+=1#13=纵向水平杆3
                         
 
-                    elif label=="horizontal_bar":#水平纵杆
-
-                        is_inside0 = cv2.pointPolygonTest(LEVLEL0_REGION.reshape((-1, 1, 2)), center_point, False)
-                        is_inside1 = cv2.pointPolygonTest(LEVLEL1_REGION.reshape((-1, 1, 2)), center_point, False)
-                        is_inside2 = cv2.pointPolygonTest(LEVLEL2_REGION.reshape((-1, 1, 2)), center_point, False)
-                        is_inside3 = cv2.pointPolygonTest(LEVLEL3_REGION.reshape((-1, 1, 2)), center_point, False)
-                        #print(is_inside)
-                        if is_inside0>=0 :
-                            platform_remove_steps_detect_num[3]+=1
-                            if platform_remove_steps_detect_num[3]>3:
-                                platform_remove_steps[3]+=1#4=横向扫地杆
-                        elif is_inside1>=0:
-                            platform_remove_steps_detect_num[5]+=1
-                            if platform_remove_steps_detect_num[5]>3:
-                                platform_remove_steps[5]+=1#6=横向水平杆1
-                        elif is_inside2>=0:
-                            platform_remove_steps_detect_num[7]+=1
-                            if platform_remove_steps_detect_num[7]>3:
-                                platform_remove_steps[7]+=1# 8=横向水平杆2
-                        elif is_inside3>=0:
-                            platform_remove_steps_detect_num[13]+=1
-                            if platform_remove_steps_detect_num[13]>3:
-                                platform_remove_steps[13]+=1#14=横向水平杆3
-
-                    elif label=="diagonal":#斜撑
-
-                        is_inside = cv2.pointPolygonTest(DIAGONAL_REGION.reshape((-1, 1, 2)), center_point, False)
-                        if is_inside>=0:
-                            platform_remove_steps_detect_num[8]+=1
-                            if platform_remove_steps_detect_num[8]>3:
-                                platform_remove_steps[8]+=1# 9=斜撑
+                    # elif label=="horizontal_bar":#水平纵杆
+
+                    #     is_inside0 = cv2.pointPolygonTest(LEVLEL0_REGION.reshape((-1, 1, 2)), center_point, False)
+                    #     is_inside1 = cv2.pointPolygonTest(LEVLEL1_REGION.reshape((-1, 1, 2)), center_point, False)
+                    #     is_inside2 = cv2.pointPolygonTest(LEVLEL2_REGION.reshape((-1, 1, 2)), center_point, False)
+                    #     is_inside3 = cv2.pointPolygonTest(LEVLEL3_REGION.reshape((-1, 1, 2)), center_point, False)
+                    #     #print(is_inside)
+                    #     if is_inside0>=0 :
+                    #         platform_remove_steps_detect_num[3]+=1
+                    #         if platform_remove_steps_detect_num[3]>3:
+                    #             platform_remove_steps[3]+=1#4=横向扫地杆
+                    #     elif is_inside1>=0:
+                    #         platform_remove_steps_detect_num[5]+=1
+                    #         if platform_remove_steps_detect_num[5]>3:
+                    #             platform_remove_steps[5]+=1#6=横向水平杆1
+                    #     elif is_inside2>=0:
+                    #         platform_remove_steps_detect_num[7]+=1
+                    #         if platform_remove_steps_detect_num[7]>3:
+                    #             platform_remove_steps[7]+=1# 8=横向水平杆2
+                    #     elif is_inside3>=0:
+                    #         platform_remove_steps_detect_num[13]+=1
+                    #         if platform_remove_steps_detect_num[13]>3:
+                    #             platform_remove_steps[13]+=1#14=横向水平杆3
+
+                    # elif label=="diagonal":#斜撑
+
+                    #     is_inside = cv2.pointPolygonTest(DIAGONAL_REGION.reshape((-1, 1, 2)), center_point, False)
+                    #     if is_inside>=0:
+                    #         platform_remove_steps_detect_num[8]+=1
+                    #         if platform_remove_steps_detect_num[8]>3:
+                    #             platform_remove_steps[8]+=1# 9=斜撑
                     
 
                     elif label=="ladder":#梯子
                         #10=爬梯
-                        platform_remove_steps_detect_num[9]+=1
-                        if platform_remove_steps_detect_num[9]>3:
-                            platform_remove_steps[9]+=1
+                        # platform_remove_steps_detect_num[9]+=1
+                        # if platform_remove_steps_detect_num[9]>3:
+                        platform_remove_steps[9]+=1
                         
                     elif label=="scaffold":#脚手板
                         #11=脚手板
-                        platform_remove_steps_detect_num[10]+=1
-                        if platform_remove_steps_detect_num[10]>3:
-                            platform_remove_steps[10]+=1
+                        # platform_remove_steps_detect_num[10]+=1
+                        # if platform_remove_steps_detect_num[10]>3:
+                        platform_remove_steps[10]+=1
 
 
                     elif label=="toe_board":#档脚板
                         #12=挡脚板
-                        platform_remove_steps_detect_num[11]+=1
-                        if platform_remove_steps_detect_num[11]>3:
-                            platform_remove_steps[11]+=1
+                        # platform_remove_steps_detect_num[11]+=1
+                        # if platform_remove_steps_detect_num[11]>3:
+                        platform_remove_steps[11]+=1
+
+                if hengxianggan >= 2:
+                    platform_remove_steps[3] = 2
+                if hengxianggan >= 4:
+                    platform_remove_steps[5] = 2
+                if hengxianggan >= 6:
+                    platform_remove_steps[7] = 2
+                if hengxianggan >= 8:
+                    platform_remove_steps[13] = 2
+                
+                if zongxinaggan>=2:
+                    platform_remove_steps[2]=2
+                if zongxinaggan>=4:
+                    platform_remove_steps[4]=2
+                if zongxinaggan>=6:
+                    platform_remove_steps[6]=2
+                if zongxinaggan>=8:
+                    platform_remove_steps[12]=2
 
 
                 update_detection_status(platform_remove_steps)

+ 121 - 72
platform_setup_detect.py

@@ -3,6 +3,7 @@ import torch
 from shapely.geometry import box, Polygon
 import threading
 import numpy as np
+import math
 from datetime import datetime
 from ultralytics import YOLO
 
@@ -81,6 +82,7 @@ def process_video(model_path, video_source,start_event):
 
             for r in results:
                 boxes=r.obb.xyxyxyxy
+                boxes1=r.obb.xywhr
                 confidences=r.obb.conf
                 classes=r.obb.cls
                 
@@ -109,6 +111,8 @@ def process_video(model_path, video_source,start_event):
                 # 13=纵向水平杆3
                 # 14=横向水平杆3
                 platform_setup_steps = [0] * 14
+                hengxianggan=0
+                zongxinaggan=0
                 for i in range(len(boxes)):
                     confidence = confidences[i].item()
                     cls = int(classes[i].item())
@@ -120,94 +124,139 @@ def process_video(model_path, video_source,start_event):
                     y_center=(box_coords[0][1] + box_coords[1][1]+box_coords[2][1]+box_coords[3][1]) / 4
                     center_point = (int(x_center), int(y_center))
 
-                    
+                    rotation= math.degrees(boxes1[i][4])
+
+
                     if label=="wheel":#轮子
-                        platform_setup_steps_detect_num[0]+=1
-                        if platform_setup_steps_detect_num[0]>3:
-                            platform_setup_steps[0]+=1
-
-                    elif label=="montant":#立杆
-                        platform_setup_steps_detect_num[1]+=1
-                        if platform_setup_steps_detect_num[1]>3:
-                            platform_setup_steps[1]+=1
-                    elif label=="vertical_bar":#水平横杆,纵杆
+                        # platform_setup_steps_detect_num[0]+=1
+                        # if platform_setup_steps_detect_num[0]>3:
+                        #     platform_setup_steps[0]+=1
+                        platform_setup_steps[0]+=1
+                        #print(f"轮子{rotation}")
+
+                    elif label=="bar":#立杆
+                        # platform_setup_steps_detect_num[1]+=1
+                        # if platform_setup_steps_detect_num[1]>3:
+                        #     platform_setup_steps[1]+=1
+                        if video_source == PLATFORM_SETUP_VIDEO_SOURCES[0]:
+                            if 70 < rotation < 110:
+                                platform_setup_steps[1] += 1  # 立杆
+                            elif rotation < 10 or rotation > 170:
+                                hengxianggan += 1  # 横向杆
+                            elif 135 < rotation < 150:
+                                platform_setup_steps[8] += 1  # 斜杆
+                            else:
+                                zongxinaggan += 1  # 纵向杆
+                        elif video_source == PLATFORM_SETUP_VIDEO_SOURCES[1]:
+                            if 70 < rotation < 110:
+                                platform_setup_steps[1] += 1  # 立杆
+                            elif 5 < rotation < 25:
+                                hengxianggan += 1  # 横向杆
+                            elif 40 < rotation < 60:
+                                platform_setup_steps[8] += 1  # 斜杆
+                            else:
+                                zongxinaggan += 1  # 纵向杆
+
+
+
+                    # elif label=="vertical_bar":#水平横杆,纵杆
                         
 
-                        is_inside0 = cv2.pointPolygonTest(LEVLEL0_REGION.reshape((-1, 1, 2)), center_point, False)
-                        is_inside1 = cv2.pointPolygonTest(LEVLEL1_REGION.reshape((-1, 1, 2)), center_point, False)
-                        is_inside2 = cv2.pointPolygonTest(LEVLEL2_REGION.reshape((-1, 1, 2)), center_point, False)
-                        is_inside3 = cv2.pointPolygonTest(LEVLEL3_REGION.reshape((-1, 1, 2)), center_point, False)
-                        #print(is_inside)
-                        if is_inside0>=0 :
-                            platform_setup_steps_detect_num[2]+=1
-                            if platform_setup_steps_detect_num[2]>3:
-                                platform_setup_steps[2]+=1 #表示纵向扫地杆
-                        elif is_inside1>=0:
-                            platform_setup_steps_detect_num[4]+=1
-                            if platform_setup_steps_detect_num[4]>3:
-                                platform_setup_steps[4]+=1#5=纵向水平杆1
-                        elif is_inside2>=0:
-                            platform_setup_steps_detect_num[6]+=1
-                            if platform_setup_steps_detect_num[6]>3:
-                                platform_setup_steps[6]+=1#7=纵向水平杆2
-                        elif is_inside3>=0:
-                            platform_setup_steps_detect_num[12]+=1
-                            if platform_setup_steps_detect_num[12]>3:
-                                platform_setup_steps[12]+=1#13=纵向水平杆3
+                    #     is_inside0 = cv2.pointPolygonTest(LEVLEL0_REGION.reshape((-1, 1, 2)), center_point, False)
+                    #     is_inside1 = cv2.pointPolygonTest(LEVLEL1_REGION.reshape((-1, 1, 2)), center_point, False)
+                    #     is_inside2 = cv2.pointPolygonTest(LEVLEL2_REGION.reshape((-1, 1, 2)), center_point, False)
+                    #     is_inside3 = cv2.pointPolygonTest(LEVLEL3_REGION.reshape((-1, 1, 2)), center_point, False)
+                    #     #print(is_inside)
+                    #     if is_inside0>=0 :
+                    #         platform_setup_steps_detect_num[2]+=1
+                    #         if platform_setup_steps_detect_num[2]>3:
+                    #             platform_setup_steps[2]+=1 #表示纵向扫地杆
+                    #     elif is_inside1>=0:
+                    #         platform_setup_steps_detect_num[4]+=1
+                    #         if platform_setup_steps_detect_num[4]>3:
+                    #             platform_setup_steps[4]+=1#5=纵向水平杆1
+                    #     elif is_inside2>=0:
+                    #         platform_setup_steps_detect_num[6]+=1
+                    #         if platform_setup_steps_detect_num[6]>3:
+                    #             platform_setup_steps[6]+=1#7=纵向水平杆2
+                    #     elif is_inside3>=0:
+                    #         platform_setup_steps_detect_num[12]+=1
+                    #         if platform_setup_steps_detect_num[12]>3:
+                    #             platform_setup_steps[12]+=1#13=纵向水平杆3
                         
 
-                    elif label=="horizontal_bar":#水平纵杆
-
-                        is_inside0 = cv2.pointPolygonTest(LEVLEL0_REGION.reshape((-1, 1, 2)), center_point, False)
-                        is_inside1 = cv2.pointPolygonTest(LEVLEL1_REGION.reshape((-1, 1, 2)), center_point, False)
-                        is_inside2 = cv2.pointPolygonTest(LEVLEL2_REGION.reshape((-1, 1, 2)), center_point, False)
-                        is_inside3 = cv2.pointPolygonTest(LEVLEL3_REGION.reshape((-1, 1, 2)), center_point, False)
-                        #print(is_inside)
-                        if is_inside0>=0 :
-                            platform_setup_steps_detect_num[3]+=1
-                            if platform_setup_steps_detect_num[3]>3:
-                                platform_setup_steps[3]+=1#4=横向扫地杆
-                        elif is_inside1>=0:
-                            platform_setup_steps_detect_num[5]+=1
-                            if platform_setup_steps_detect_num[5]>3:
-                                platform_setup_steps[5]+=1#6=横向水平杆1
-                        elif is_inside2>=0:
-                            platform_setup_steps_detect_num[7]+=1
-                            if platform_setup_steps_detect_num[7]>3:
-                                platform_setup_steps[7]+=1# 8=横向水平杆2
-                        elif is_inside3>=0:
-                            platform_setup_steps_detect_num[13]+=1
-                            if platform_setup_steps_detect_num[13]>3:
-                                platform_setup_steps[13]+=1#14=横向水平杆3
-
-                    elif label=="diagonal":#斜撑
-
-                        is_inside = cv2.pointPolygonTest(DIAGONAL_REGION.reshape((-1, 1, 2)), center_point, False)
-                        if is_inside>=0:
-                            platform_setup_steps_detect_num[8]+=1
-                            if platform_setup_steps_detect_num[8]>3:
-                                platform_setup_steps[8]+=1# 9=斜撑
+                    # elif label=="horizontal_bar":#水平纵杆
+
+                    #     is_inside0 = cv2.pointPolygonTest(LEVLEL0_REGION.reshape((-1, 1, 2)), center_point, False)
+                    #     is_inside1 = cv2.pointPolygonTest(LEVLEL1_REGION.reshape((-1, 1, 2)), center_point, False)
+                    #     is_inside2 = cv2.pointPolygonTest(LEVLEL2_REGION.reshape((-1, 1, 2)), center_point, False)
+                    #     is_inside3 = cv2.pointPolygonTest(LEVLEL3_REGION.reshape((-1, 1, 2)), center_point, False)
+                    #     #print(is_inside)
+                    #     if is_inside0>=0 :
+                    #         platform_setup_steps_detect_num[3]+=1
+                    #         if platform_setup_steps_detect_num[3]>3:
+                    #             platform_setup_steps[3]+=1#4=横向扫地杆
+                    #     elif is_inside1>=0:
+                    #         platform_setup_steps_detect_num[5]+=1
+                    #         if platform_setup_steps_detect_num[5]>3:
+                    #             platform_setup_steps[5]+=1#6=横向水平杆1
+                    #     elif is_inside2>=0:
+                    #         platform_setup_steps_detect_num[7]+=1
+                    #         if platform_setup_steps_detect_num[7]>3:
+                    #             platform_setup_steps[7]+=1# 8=横向水平杆2
+                    #     elif is_inside3>=0:
+                    #         platform_setup_steps_detect_num[13]+=1
+                    #         if platform_setup_steps_detect_num[13]>3:
+                    #             platform_setup_steps[13]+=1#14=横向水平杆3
+
+                    # elif label=="diagonal":#斜撑
+
+                    #     is_inside = cv2.pointPolygonTest(DIAGONAL_REGION.reshape((-1, 1, 2)), center_point, False)
+                    #     if is_inside>=0:
+                    #         platform_setup_steps_detect_num[8]+=1
+                    #         if platform_setup_steps_detect_num[8]>3:
+                    #             platform_setup_steps[8]+=1# 9=斜撑
                     
 
                     elif label=="ladder":#梯子
                         #10=爬梯
-                        platform_setup_steps_detect_num[9]+=1
-                        if platform_setup_steps_detect_num[9]>3:
-                            platform_setup_steps[9]+=1
+                        # platform_setup_steps_detect_num[9]+=1
+                        # if platform_setup_steps_detect_num[9]>3:
+                        platform_setup_steps[9]+=1
                         
                     elif label=="scaffold":#脚手板
                         #11=脚手板
-                        platform_setup_steps_detect_num[10]+=1
-                        if platform_setup_steps_detect_num[10]>3:
-                            platform_setup_steps[10]+=1
+                        # platform_setup_steps_detect_num[10]+=1
+                        # if platform_setup_steps_detect_num[10]>3:
+                        platform_setup_steps[10]+=1
 
 
                     elif label=="toe_board":#档脚板
                         #12=挡脚板
-                        platform_setup_steps_detect_num[11]+=1
-                        if platform_setup_steps_detect_num[11]>3:
-                            platform_setup_steps[11]+=1
-
+                        # platform_setup_steps_detect_num[11]+=1
+                        # if platform_setup_steps_detect_num[11]>3:
+                        platform_setup_steps[11]+=1
+
+                if hengxianggan >= 2:
+                    platform_setup_steps[3] = 2
+                if hengxianggan >= 4:
+                    platform_setup_steps[5] = 2
+                if hengxianggan >= 6:
+                    platform_setup_steps[7] = 2
+                if hengxianggan >= 8:
+                    platform_setup_steps[13] = 2
+                
+                if zongxinaggan>=2:
+                    platform_setup_steps[2]=2
+                if zongxinaggan>=4:
+                    platform_setup_steps[4]=2
+                if zongxinaggan>=6:
+                    platform_setup_steps[6]=2
+                if zongxinaggan>=8:
+                    platform_setup_steps[12]=2
+
+                # print(hengxianggan)
+                # print(zongxinaggan)
                 #print(platform_setup_steps)
                 #print('----------------------')
                 # Print the platform setup steps