From 3c54c22b6880f357df498b1d7fa45702e1ae6c82 Mon Sep 17 00:00:00 2001 From: zhoushuliang Date: Fri, 4 Jul 2025 13:46:56 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20enums/ModelTypeEnum.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- enums/ModelTypeEnum.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/enums/ModelTypeEnum.py b/enums/ModelTypeEnum.py index 8168344..6f619f7 100644 --- a/enums/ModelTypeEnum.py +++ b/enums/ModelTypeEnum.py @@ -131,8 +131,7 @@ class ModelType(Enum): 'seg_nclass': 3, 'segRegionCnt': 2, 'segPar': { - #'modelSize': (640, 360), - 'modelSize': (1920, 1080), + 'modelSize': (640, 360), 'mean': (0.485, 0.456, 0.406), 'std': (0.229, 0.224, 0.225), 'predResize': True, @@ -141,8 +140,7 @@ class ModelType(Enum): 'mixFunction': { 'function': tracfficAccidentMixFunction, 'pars': { - #'modelSize': (640, 360), - 'modelSize': (1920,1080), + 'modelSize': (640, 360), 'RoadArea': 16000, 'roadVehicleAngle': 15, 'speedRoadVehicleAngleMax': 75, @@ -694,12 +692,13 @@ class ModelType(Enum): 'function': tracfficAccidentMixFunction, 'pars': { 'modelSize': (640, 360), - #'modelSize': (1920,1080), 'RoadArea': 16000, 'roadVehicleAngle': 15, 'speedRoadVehicleAngleMax': 75, 'roundness': 1.0, 'cls': 10, + 'CarId':1, + 'CthcId':1, 'vehicleFactor': 0.1, 'confThres': 0.25, 'roadIou': 0.6, -- 2.25.1 From 7a2616df6a6b45ceda41b336dfb897d2e8e3c21a Mon Sep 17 00:00:00 2001 From: zhoushuliang Date: Fri, 4 Jul 2025 13:49:34 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20util/ModelUtils.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- util/ModelUtils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/ModelUtils.py b/util/ModelUtils.py index 49478f1..9154274 100644 --- a/util/ModelUtils.py +++ b/util/ModelUtils.py @@ -608,8 +608,8 @@ MODEL_CONFIG = { ), # 加载交通模型 ModelType.TRAFFICFORDSJ_FARM_MODEL.value[1]: ( - lambda x, y, r, t, z, h: OneModel(x, y, r, ModelType.TRAFFIC_FARM_MODEL, t, z, h), - ModelType.TRAFFIC_FARM_MODEL, + lambda x, y, r, t, z, h: OneModel(x, y, r, ModelType.TRAFFICFORDSJ_FARM_MODEL, t, z, h), + ModelType.TRAFFICFORDSJ_FARM_MODEL, lambda x, y, z: one_label(x, y, z), lambda x: model_process(x) ), -- 2.25.1 From 9906a10a6615ca75f319c322da1d053b6340a5d8 Mon Sep 17 00:00:00 2001 From: zhoushuliang Date: Sat, 5 Jul 2025 11:13:00 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20enums/ModelTypeEnum.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- enums/ModelTypeEnum.py | 112 +++++++++++++++++++---------------------- 1 file changed, 53 insertions(+), 59 deletions(-) diff --git a/enums/ModelTypeEnum.py b/enums/ModelTypeEnum.py index 6f619f7..1f89471 100644 --- a/enums/ModelTypeEnum.py +++ b/enums/ModelTypeEnum.py @@ -9,12 +9,10 @@ from DMPRUtils.jointUtil import dmpr_yolo from segutils.segmodel import SegModel from utilsK.queRiver import riverDetSegMixProcess from utilsK.crowdGather import gather_post_process -from segutils.trafficUtils import tracfficAccidentMixFunction +from segutils.trafficUtils import tracfficAccidentMixFunction,mixTraffic_postprocess from utilsK.drownUtils import mixDrowing_water_postprocess from utilsK.noParkingUtils import mixNoParking_road_postprocess from utilsK.illParkingUtils import illParking_postprocess -from utilsK.spillUtils import mixSpillage_postprocess -from utilsK.cthcUtils import mixCthc_postprocess from utilsK.pannelpostUtils import pannel_post_process from stdc import stdcModel from yolov5 import yolov5Model @@ -119,7 +117,6 @@ class ModelType(Enum): }) - TRAFFIC_FARM_MODEL = ("3", "003", "交通模型", 'highWay2', lambda device, gpuName: { @@ -164,7 +161,7 @@ class ModelType(Enum): "classes": 10, "rainbows": COLOR }, - 'allowedList':[0,1,2,3,4,5,6,7,8,9,10,11,12,16,17,18,19,20,21,22], + 'allowedList':[0,1,2,3,4,5,6,7,8,9,10,11,12,16,17,18,19,20,21,22], 'Detweights': "../weights/trt/AIlib2/highWay2/yolov5_%s_fp16.engine" % gpuName, 'Segweights': '../weights/trt/AIlib2/highWay2/stdc_360X640_%s_fp16.engine' % gpuName }) @@ -359,9 +356,7 @@ class ModelType(Enum): "classes": 5, "rainbows": COLOR }, - # "../weights/pth/AIlib2/%s/yolov5.pt" % modeType.value[3] 'Detweights': "../weights/trt/AIlib2/river2/yolov5_%s_fp16.engine" % gpuName, - # '../weights/pth/AIlib2/%s/stdc_360X640.pth' % modeType.value[3] 'Segweights': '../weights/trt/AIlib2/river2/stdc_360X640_%s_fp16.engine' % gpuName }) @@ -378,11 +373,10 @@ class ModelType(Enum): }, 'models':[ { - 'weight':'../weights/pth/AIlib2/cityMangement3/yolov5.pt', - #'weight':'../weights/trt/AIlib2/cityMangement3/yolov5_%s_fp16.engine'%(gpuName), + 'weight':'../weights/trt/AIlib2/cityMangement3/yolov5_%s_fp16.engine'%(gpuName), 'name':'yolov5', 'model':yolov5Model, - 'par':{ 'half':True,'device':'cuda:0' ,'conf_thres':0.25,'iou_thres':0.45,'allowedList':[0,1,2,3],'segRegionCnt':1, 'trtFlag_det':False,'trtFlag_seg':False, "score_byClass":{"0":0.25,"1":0.4,"2":0.5,"3":0.5 } } + 'par':{ 'half':True,'device':'cuda:0' ,'conf_thres':0.25,'iou_thres':0.45,'allowedList':[0,1,2,3],'segRegionCnt':1, 'trtFlag_det':True,'trtFlag_seg':True, "score_byClass":{"0":0.8,"1":0.4,"2":0.5,"3":0.5 } } }, { 'weight':'../weights/pth/AIlib2/cityMangement3/dmpr.pth', @@ -394,9 +388,9 @@ class ModelType(Enum): 'name':'dmpr' }, { - 'weight':'../weights/pth/AIlib2/cityMangement3/stdc_360X640.pth', + 'weight':'../weights/trt/AIlib2/cityMangement3/stdc_360X640_%s_fp16.engine'%(gpuName), 'par':{ - 'modelSize':(640,360),'mean':(0.485, 0.456, 0.406),'std' :(0.229, 0.224, 0.225),'predResize':True,'numpy':False, 'RGB_convert_first':True,'seg_nclass':2},###分割模型预处理参数 + 'modelSize':(640,360),'mean':(0.485, 0.456, 0.406),'std' :(0.229, 0.224, 0.225),'predResize':True,'numpy':False, 'RGB_convert_first':True,'seg_nclass':3},###分割模型预处理参数 'model':stdcModel, 'name':'stdc' } @@ -441,9 +435,7 @@ class ModelType(Enum): "classes": 9, "rainbows": COLOR }, - # "../weights/pth/AIlib2/%s/yolov5.pt" % modeType.value[3] 'Detweights': "../weights/trt/AIlib2/drowning/yolov5_%s_fp16.engine" % gpuName, - # '../weights/pth/AIlib2/%s/stdc_360X640.pth' % modeType.value[3] 'Segweights': '../weights/trt/AIlib2/drowning/stdc_360X640_%s_fp16.engine' % gpuName }) @@ -512,7 +504,7 @@ class ModelType(Enum): CITYROAD_MODEL = ("20", "020", "城市公路模型", 'cityRoad', lambda device, gpuName: { 'device': device, - 'labelnames': ["护栏", "交通标志", "非交通标志", "施工", "施工"], + 'labelnames': ["护栏", "交通标志", "非交通标志", "施工锥桶", "施工水马"], 'trtFlag_seg': False, 'trtFlag_det': True, 'slopeIndex': [], @@ -572,14 +564,12 @@ class ModelType(Enum): }}, 'models':[ { - #'weight':'../weights/pth/AIlib2/channel2/yolov5.pt', 'weight':'../weights/trt/AIlib2/channel2/yolov5_%s_fp16.engine'%(gpuName), 'name':'yolov5', 'model':yolov5Model, 'par':{ 'half':True,'device':'cuda:0' ,'conf_thres':0.1,'iou_thres':0.45,'allowedList':list(range(20)),'segRegionCnt':1, 'trtFlag_det':False,'trtFlag_seg':False, "score_byClass":{"0":0.7,"1":0.7,"2":0.8,"3":0.6} } }, - { - # 'weight' : '../weights/trt/AIlib2/ocr2/crnn_ch_4090_fp16_192X32.engine', + { 'weight' : '../weights/pth/AIlib2/ocr2/crnn_ch.pth', 'name':'ocr', 'model':ocrModel, @@ -638,9 +628,7 @@ class ModelType(Enum): "classes": 5, "rainbows": COLOR }, - # "../weights/pth/AIlib2/%s/yolov5.pt" % modeType.value[3] 'Detweights': "../weights/trt/AIlib2/riverT/yolov5_%s_fp16.engine" % gpuName, - # '../weights/pth/AIlib2/%s/stdc_360X640.pth' % modeType.value[3] 'Segweights': '../weights/trt/AIlib2/riverT/stdc_360X640_%s_fp16.engine' % gpuName }) @@ -784,26 +772,24 @@ class ModelType(Enum): 'labelnames': ["抛洒物","车辆"], 'trtFlag_seg': True, 'trtFlag_det': True, - 'seg_nclass': 2, + 'seg_nclass': 3, 'segRegionCnt': 2, 'segPar': { - #'modelSize': (640, 360), - 'modelSize': (1920, 1080), + 'modelSize': (640, 360), 'mean': (0.485, 0.456, 0.406), 'std': (0.229, 0.224, 0.225), 'predResize': True, 'numpy': False, 'RGB_convert_first': True, 'mixFunction': { - 'function': mixSpillage_postprocess, + 'function': mixTraffic_postprocess, 'pars': { - #'modelSize': (640, 360), - 'modelSize': (1920,1080), + 'modelSize': (640, 360), 'RoadArea': 16000, 'roadVehicleAngle': 15, 'speedRoadVehicleAngleMax': 75, 'roundness': 1.0, - 'cls': 1, + 'cls': 0, 'vehicleFactor': 0.1, 'confThres': 0.25, 'roadIou': 0.6, @@ -831,26 +817,24 @@ class ModelType(Enum): 'labelnames': ["危化品","罐体","危险标识","普通车"], 'trtFlag_seg': True, 'trtFlag_det': True, - 'seg_nclass': 2, + 'seg_nclass': 3, 'segRegionCnt': 2, 'segPar': { - #'modelSize': (640, 360), - 'modelSize': (1920, 1080), + 'modelSize': (640, 360), 'mean': (0.485, 0.456, 0.406), 'std': (0.229, 0.224, 0.225), 'predResize': True, 'numpy': False, 'RGB_convert_first': True, 'mixFunction': { - 'function': mixCthc_postprocess, + 'function': mixTraffic_postprocess, 'pars': { - #'modelSize': (640, 360), - 'modelSize': (1920,1080), + 'modelSize': (640, 360), 'RoadArea': 16000, 'roadVehicleAngle': 15, 'speedRoadVehicleAngleMax': 75, 'roundness': 1.0, - 'cls': 4, + 'cls': 0, 'vehicleFactor': 0.1, 'confThres': 0.25, 'roadIou': 0.6, @@ -864,7 +848,7 @@ class ModelType(Enum): "name": "post_process", "conf_thres": 0.25, "iou_thres": 0.25, - "classes": 1, + "classes": 4, "rainbows": COLOR }, 'detModelpara': [{"id": str(x), "config": {"k1": "v1", "k2": "v2"}} for x in [0]], @@ -895,34 +879,44 @@ class ModelType(Enum): }) CITY_CARPLATE_MODEL = ("30", "301", "自研车牌检测", 'carplate', lambda device, gpuName: { + 'labelnames': ["车牌"], 'device': str(device), - 'models':{ + 'rainbows': COLOR, + 'models': [ { - 'weights': '../AIlib2/weights/conf/jkm/plate_yolov5s_v3.jit', - 'conf_thres': 0.4, - 'iou_thres': 0.45, - 'nc':1, + 'trtFlag_det': False, + 'weight': '../weights/pth/AIlib2/carplate/plate_yolov5s_v3.jit', + 'name': 'yolov5', + 'model': yolov5Model, + 'par': { + 'device': 'cuda:0', + 'half': False, + 'conf_thres': 0.4, + 'iou_thres': 0.45, + 'nc': 1, + 'plate_dilate': (0.5, 0.1) + }, }, { - 'weight' : '../weights/pth/AIlib2/ocr2/crnn_ch.pth', - 'name':'ocr', - 'model':ocrModel, - 'par':{ - 'char_file':'../AIlib2/conf/ocr2/benchmark.txt', - 'mode':'ch', - 'nc':3, - 'imgH':32, - 'imgW':192, - 'hidden':256, - 'mean':[0.5,0.5,0.5], - 'std':[0.5,0.5,0.5], - 'dynamic':False, - } - }, - } - }) + 'trtFlag_ocr': False, + 'weight': '../weights/pth/AIlib2/ocr2/crnn_ch.pth', + 'name': 'ocr', + 'model': ocrModel, + 'par': { + 'char_file': '../AIlib2/conf/ocr2/benchmark.txt', + 'mode': 'ch', + 'nc': 3, + 'imgH': 32, + 'imgW': 192, + 'hidden': 256, + 'mean': [0.5, 0.5, 0.5], + 'std': [0.5, 0.5, 0.5], + 'dynamic': False, + } + }], + }) - CITY_INFRAREDPERSON_MODEL = ("30", "302", "红外行人模型", 'infraredperson', lambda device, gpuName: { + CITY_INFRAREDPERSON_MODEL = ("30", "302", "红外行人模型", 'infraredPerson', lambda device, gpuName: { 'labelnames': ["行人"], 'postProcess': {'function': default_mix, 'pars': {}}, 'models': @@ -962,7 +956,7 @@ class ModelType(Enum): "rainbows": COLOR }, - }) + }) @staticmethod def checkCode(code): -- 2.25.1 From 8fae8a3b6b1b45395b4cbd8f50af659c17b5d35d Mon Sep 17 00:00:00 2001 From: zhoushuliang Date: Sat, 5 Jul 2025 11:13:31 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=88=A0=E9=99=A4=20enums/ModelTypeEnum-jc?= =?UTF-8?q?q.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 可删除 --- enums/ModelTypeEnum-jcq.py | 768 ------------------------------------- 1 file changed, 768 deletions(-) delete mode 100644 enums/ModelTypeEnum-jcq.py diff --git a/enums/ModelTypeEnum-jcq.py b/enums/ModelTypeEnum-jcq.py deleted file mode 100644 index aa7de0a..0000000 --- a/enums/ModelTypeEnum-jcq.py +++ /dev/null @@ -1,768 +0,0 @@ -import sys -from enum import Enum, unique - -from common.Constant import COLOR - -sys.path.extend(['..', '../AIlib2']) -from DMPR import DMPRModel -from DMPRUtils.jointUtil import dmpr_yolo -from segutils.segmodel import SegModel -from utilsK.queRiver import riverDetSegMixProcess -from utilsK.crowdGather import gather_post_process -from segutils.trafficUtils import tracfficAccidentMixFunction -from utilsK.drownUtils import mixDrowing_water_postprocess -from utilsK.noParkingUtils import mixNoParking_road_postprocess -from utilsK.illParkingUtils import illParking_postprocess -from stdc import stdcModel -from yolov5 import yolov5Model -from DMPRUtils.jointUtil import dmpr_yolo_stdc -from AI import default_mix -from ocr import ocrModel -from utilsK.channel2postUtils import channel2_post_process - -''' -参数说明 -1. 编号 -2. 模型编号 -3. 模型名称 -4. 选用的模型名称 -5. 模型配置 -6. 模型引用配置[Detweights文件, Segweights文件, 引用计数] -''' - - -@unique -class ModelType(Enum): - WATER_SURFACE_MODEL = ("1", "001", "河道模型", 'river', lambda device, gpuName: { - 'device': device, - 'labelnames': ["排口", "水生植被", "其它", "漂浮物", "污染排口", "菜地", "违建", "岸坡垃圾"], - 'seg_nclass': 2, - 'trtFlag_seg': True, - 'trtFlag_det': True, - 'segRegionCnt': 1, - 'segPar': { - 'modelSize': (640, 360), - 'mean': (0.485, 0.456, 0.406), - 'std': (0.229, 0.224, 0.225), - 'numpy': False, - 'RGB_convert_first': True, - 'mixFunction': { - 'function': riverDetSegMixProcess, - 'pars': { - 'slopeIndex': [5, 6, 7], - 'riverIou': 0.1 - } - } - }, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Detweights': "../AIlib2/weights/river/yolov5_%s_fp16.engine" % gpuName, - 'Segweights': '../AIlib2/weights/river/stdc_360X640_%s_fp16.engine' % gpuName - }) - - # FOREST_FARM_MODEL = ("2", "002", "森林模型", 'forest2', lambda device, gpuName: { - # 'device': device, - # 'gpu_name': gpuName, - # 'labelnames': ["林斑", "病死树", "行人", "火焰", "烟雾","云朵"], - # 'trtFlag_det': True, - # 'trtFlag_seg': False, - # 'Detweights': "../AIlib2/weights/forest2/yolov5_%s_fp16.engine" % gpuName, - # 'seg_nclass': 2, - # 'segRegionCnt': 0, - # 'slopeIndex': [], - # 'segPar': None, - # 'postFile': { - # "name": "post_process", - # "conf_thres": 0.25, - # "iou_thres": 0.45, - # "classes": 6, - # "rainbows": COLOR - # }, - # 'Segweights': None - # }) - - - FOREST_FARM_MODEL = ("2", "002", "森林模型", 'forest2', lambda device, gpuName: { - 'labelnames': ["林斑", "病死树", "行人", "火焰", "烟雾","云朵"], - 'postProcess':{'function':default_mix,'pars':{}}, - 'models': - [ - { - 'weight':"../AIlib2/weights/forest2/yolov5_%s_fp16.engine"%(gpuName),###检测模型路径 - 'name':'yolov5', - 'model':yolov5Model, - 'par':{ 'half':True,'device':'cuda:0' ,'conf_thres':0.25,'iou_thres':0.45,'allowedList':[0,1,2,3],'segRegionCnt':1, 'trtFlag_det':False,'trtFlag_seg':False, "score_byClass":{"0":0.25,"1":0.3,"2":0.3,"3":0.3 } }, - } - - - ], - - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'detModelpara':[{"id":str(x),"config":{"k1":"v1","k2":"v2"}} for x in [0,1,2,3,4,5,6,7,8,9] ],###控制哪些检测类别显示、输出 - 'segRegionCnt':2,###分割模型结果需要保留的等值线数目 - "pixScale": 1.2, - - - }) - - - - TRAFFIC_FARM_MODEL = ("3", "003", "交通模型", 'highWay2', lambda device, gpuName: { - 'device': str(device), - 'labelnames': ["行人", "车辆", "纵向裂缝", "横向裂缝", "修补", "网状裂纹", "坑槽", "块状裂纹", "积水", "影子", "事故"], - 'trtFlag_seg': True, - 'trtFlag_det': True, - 'seg_nclass': 3, - 'segRegionCnt': 2, - 'segPar': { - 'modelSize': (640, 360), - 'mean': (0.485, 0.456, 0.406), - 'std': (0.229, 0.224, 0.225), - 'predResize': True, - 'numpy': False, - 'RGB_convert_first': True, - 'mixFunction': { - 'function': tracfficAccidentMixFunction, - 'pars': { - 'modelSize': (640, 360), - #'modelSize': (1920,1080), - 'RoadArea': 16000, - 'roadVehicleAngle': 15, - 'speedRoadVehicleAngleMax': 75, - 'roundness': 1.0, - 'cls': 9, - 'vehicleFactor': 0.1, - 'confThres': 0.25, - 'roadIou': 0.6, - 'radius': 50, - 'vehicleFlag': False, - 'distanceFlag': False - } - } - }, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.25, - "classes": 10, - "rainbows": COLOR - }, - 'Detweights': "../AIlib2/weights/highWay2/yolov5_%s_fp16.engine" % gpuName, - 'Segweights': '../AIlib2/weights/highWay2/stdc_360X640_%s_fp16.engine' % gpuName - }) - - EPIDEMIC_PREVENTION_MODEL = ("4", "004", "防疫模型", None, None) - - PLATE_MODEL = ("5", "005", "车牌模型", None, None) - - VEHICLE_MODEL = ("6", "006", "车辆模型", 'vehicle', lambda device, gpuName: { - 'device': device, - 'gpu_name': gpuName, - 'labelnames': ["车辆"], - 'seg_nclass': 2, - 'segRegionCnt': 0, - 'slopeIndex': [], - 'trtFlag_det': True, - 'trtFlag_seg': False, - 'Detweights': "../AIlib2/weights/vehicle/yolov5_%s_fp16.engine" % gpuName, - 'segPar': None, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Segweights': None - }) - - PEDESTRIAN_MODEL = ("7", "007", "行人模型", 'pedestrian', lambda device, gpuName: { - 'device': device, - 'gpu_name': gpuName, - 'labelnames': ["行人"], - 'seg_nclass': 2, - 'segRegionCnt': 0, - 'trtFlag_det': True, - 'trtFlag_seg': False, - 'Detweights': "../AIlib2/weights/pedestrian/yolov5_%s_fp16.engine" % gpuName, - 'slopeIndex': [], - 'segPar': None, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Segweights': None - }) - - SMOGFIRE_MODEL = ("8", "008", "烟火模型", 'smogfire', lambda device, gpuName: { - 'device': device, - 'gpu_name': gpuName, - 'labelnames': ["火焰", "烟雾"], - 'seg_nclass': 2, # 分割模型类别数目,默认2类 - 'segRegionCnt': 0, - 'trtFlag_det': True, - 'trtFlag_seg': False, - 'Detweights': "../AIlib2/weights/smogfire/yolov5_%s_fp16.engine" % gpuName, - 'slopeIndex': [], - 'segPar': None, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Segweights': None - }) - - ANGLERSWIMMER_MODEL = ("9", "009", "钓鱼游泳模型", 'AnglerSwimmer', lambda device, gpuName: { - 'device': device, - 'gpu_name': gpuName, - 'labelnames': ["钓鱼", "游泳"], - 'seg_nclass': 2, # 分割模型类别数目,默认2类 - 'segRegionCnt': 0, - 'slopeIndex': [], - 'trtFlag_det': True, - 'trtFlag_seg': False, - 'Detweights': "../AIlib2/weights/AnglerSwimmer/yolov5_%s_fp16.engine" % gpuName, - 'segPar': None, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Segweights': None - }) - - COUNTRYROAD_MODEL = ("10", "010", "乡村模型", 'countryRoad', lambda device, gpuName: { - 'device': device, - 'gpu_name': gpuName, - 'labelnames': ["违法种植"], - 'seg_nclass': 2, # 分割模型类别数目,默认2类 - 'segRegionCnt': 0, - 'slopeIndex': [], - 'trtFlag_det': True, - 'trtFlag_seg': False, - 'Detweights': "../AIlib2/weights/countryRoad/yolov5_%s_fp16.engine" % gpuName, - 'segPar': None, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Segweights': None - }) - - SHIP_MODEL = ("11", "011", "船只模型", 'ship2', lambda device, gpuName: { - 'model_size': (608, 608), - 'K': 100, - 'conf_thresh': 0.18, - 'device': 'cuda:%s' % device, - 'down_ratio': 4, - 'num_classes': 15, - 'weights': '../AIlib2/weights/ship2/obb_608X608_%s_fp16.engine' % gpuName, - 'dataset': 'dota', - 'half': False, - 'mean': (0.5, 0.5, 0.5), - 'std': (1, 1, 1), - 'heads': {'hm': None, 'wh': 10, 'reg': 2, 'cls_theta': 1}, - 'decoder': None, - 'test_flag': True, - "rainbows": COLOR, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'drawBox': False, - 'label_array': None, - 'labelnames': ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "船只"), - }) - - BAIDU_MODEL = ("12", "012", "百度AI图片识别模型", None, None) - - CHANNEL_EMERGENCY_MODEL = ("13", "013", "航道模型", 'channelEmergency', lambda device, gpuName: { - 'device': device, - 'gpu_name': gpuName, - 'labelnames': ["人"], - 'seg_nclass': 2, # 分割模型类别数目,默认2类 - 'segRegionCnt': 0, - 'slopeIndex': [], - 'trtFlag_det': True, - 'trtFlag_seg': False, - 'Detweights': "../AIlib2/weights/channelEmergency/yolov5_%s_fp16.engine" % gpuName, - 'segPar': None, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Segweights': None - }) - - RIVER2_MODEL = ("15", "015", "河道检测模型", 'river2', lambda device, gpuName: { - 'device': device, - 'labelnames': ["漂浮物", "岸坡垃圾", "排口", "违建", "菜地", "水生植物", "河湖人员", "钓鱼人员", "船只", - "蓝藻"], - 'trtFlag_seg': True, - 'trtFlag_det': True, - 'seg_nclass': 2, - 'segRegionCnt': 1, - 'segPar': { - 'modelSize': (640, 360), - 'mean': (0.485, 0.456, 0.406), - 'std': (0.229, 0.224, 0.225), - 'numpy': False, - 'RGB_convert_first': True, - 'mixFunction': { - 'function': riverDetSegMixProcess, - 'pars': { - 'slopeIndex': [1, 3, 4, 7], - 'riverIou': 0.1 - } - } - }, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.3, - "ovlap_thres_crossCategory": 0.65, - "classes": 5, - "rainbows": COLOR - }, - # "../AIlib2/weights/conf/%s/yolov5.pt" % modeType.value[3] - 'Detweights': "../AIlib2/weights/river2/yolov5_%s_fp16.engine" % gpuName, - # '../AIlib2/weights/conf/%s/stdc_360X640.pth' % modeType.value[3] - 'Segweights': '../AIlib2/weights/river2/stdc_360X640_%s_fp16.engine' % gpuName - }) - - CITY_MANGEMENT_MODEL = ("16", "016", "城管模型", 'cityMangement2', lambda device, gpuName: { - 'labelnames': ["车辆", "垃圾", "商贩", "违停"], - 'postProcess':{ - 'function':dmpr_yolo_stdc, - 'pars':{'carCls':0 ,'illCls':3,'scaleRatio':0.5,'border':80,'rubCls': 1, 'Rubfilter': 150} - }, - 'models':[ - { - #'weight':'../AIlib2/weights/conf/cityMangement3/yolov5.pt', - 'weight':'../AIlib2/weights/cityMangement3/yolov5_%s_fp16.engine'%(gpuName), - 'name':'yolov5', - 'model':yolov5Model, - 'par':{ 'half':True,'device':'cuda:0' ,'conf_thres':0.25,'iou_thres':0.5,'allowedList':[0,1,2,3],'segRegionCnt':1, 'trtFlag_det':False,'trtFlag_seg':False, "score_byClass":{"0":0.8,"1":0.4,"2":0.5,"3":0.5 } } - }, - { - 'weight':'../AIlib2/weights/conf/cityMangement3/dmpr.pth', - 'par':{ - 'depth_factor':32,'NUM_FEATURE_MAP_CHANNEL':6,'dmpr_thresh':0.1, 'dmprimg_size':640, - 'name':'dmpr' - }, - 'model':DMPRModel, - 'name':'dmpr' - }, - { - 'weight':'../AIlib2/weights/conf/cityMangement3/stdc_360X640.pth', - - 'par':{ - 'modelSize':(640,360),'mean':(0.485, 0.456, 0.406),'std' :(0.229, 0.224, 0.225),'predResize':True,'numpy':False, 'RGB_convert_first':True,'seg_nclass':2},###分割模型预处理参数 - 'model':stdcModel, - 'name':'stdc' - } - ], - 'postFile': { - "name": "post_process", - "conf_thres": 0.5, - "iou_thres": 0.5, - "classes": 5, - "rainbows": COLOR - }, - 'detModelpara':[{"id":str(x),"config":{"k1":"v1","k2":"v2"}} for x in [0,1,2,3,5,6,7,8,9] ],###控制哪些检测类别显示、输出 - 'segRegionCnt':2,###分割模型结果需要保留的等值线数目 - "pixScale": 1.2, - }) - - DROWING_MODEL = ("17", "017", "人员落水模型", 'drowning', lambda device, gpuName: { - 'device': device, - 'labelnames': ["人头", "人", "船只"], - 'trtFlag_seg': True, - 'trtFlag_det': True, - 'seg_nclass': 2, - 'segRegionCnt': 2, - 'segPar': { - 'modelSize': (640, 360), - 'mean': (0.485, 0.456, 0.406), - 'std': (0.229, 0.224, 0.225), - 'predResize': True, - 'numpy': False, - 'RGB_convert_first': True, - 'mixFunction': { - 'function': mixDrowing_water_postprocess, - 'pars': { - 'modelSize': (640, 360) - } - } - }, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.25, - "classes": 9, - "rainbows": COLOR - }, - # "../AIlib2/weights/conf/%s/yolov5.pt" % modeType.value[3] - 'Detweights': "../AIlib2/weights/drowning/yolov5_%s_fp16.engine" % gpuName, - # '../AIlib2/weights/conf/%s/stdc_360X640.pth' % modeType.value[3] - 'Segweights': '../AIlib2/weights/drowning/stdc_360X640_%s_fp16.engine' % gpuName - }) - - NOPARKING_MODEL = ( - "18", "018", "城市违章模型", 'noParking', lambda device, gpuName: { - 'device': device, - 'labelnames': ["车辆", "违停"], - 'trtFlag_seg': True, - 'trtFlag_det': True, - 'seg_nclass': 4, - 'segRegionCnt': 2, - 'segPar': { - 'modelSize': (640, 360), - 'mean': (0.485, 0.456, 0.406), - 'std': (0.229, 0.224, 0.225), - 'predResize': True, - 'numpy': False, - 'RGB_convert_first': True, ###分割模型预处理参数 - 'mixFunction': { - 'function': mixNoParking_road_postprocess, - 'pars': { - 'modelSize': (640, 360), - 'roundness': 0.3, - 'cls': 9, - 'laneArea': 10, - 'laneAngleCha': 5, - 'RoadArea': 16000, - 'fitOrder':2 - } - } - }, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.25, - "classes": 9, - "rainbows": COLOR - }, - 'Detweights': "../AIlib2/weights/noParking/yolov5_%s_fp16.engine" % gpuName, - 'Segweights': '../AIlib2/weights/noParking/stdc_360X640_%s_fp16.engine' % gpuName - }) - - ILLPARKING_MODEL = ("19", "019", "车辆违停模型", 'illParking', lambda device, gpuName: { - 'device': device, - 'labelnames': ["车", "T角点", "L角点", "违停"], - 'trtFlag_seg': False, - 'trtFlag_det': True, - 'seg_nclass': 4, - 'segRegionCnt': 2, - 'segPar': { - 'mixFunction': { - 'function': illParking_postprocess, - 'pars': {} - } - }, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.25, - "classes": 9, - "rainbows": COLOR - }, - 'Detweights': "../AIlib2/weights/illParking/yolov5_%s_fp16.engine" % gpuName, - 'Segweights': None - }) - - CITYROAD_MODEL = ("20", "020", "城市公路模型", 'cityRoad', lambda device, gpuName: { - 'device': device, - 'labelnames': ["护栏", "交通标志", "非交通标志", "施工", "施工"], - 'trtFlag_seg': False, - 'trtFlag_det': True, - 'slopeIndex': [], - 'seg_nclass': 2, - 'segRegionCnt': 0, - 'segPar': None, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.5, - "classes": 5, - "rainbows": COLOR - }, - 'Detweights': "../AIlib2/weights/cityRoad/yolov5_%s_fp16.engine" % gpuName, - 'Segweights': None - }) - - POTHOLE_MODEL = ("23", "023", "坑槽检测模型", 'pothole', lambda device, gpuName: { - 'device': device, - 'gpu_name': gpuName, - 'labelnames': ["坑槽"], - 'seg_nclass': 2, # 分割模型类别数目,默认2类 - 'segRegionCnt': 0, - 'slopeIndex': [], - 'trtFlag_det': True, - 'trtFlag_seg': False, - 'Detweights': "../AIlib2/weights/pothole/yolov5_%s_fp16.engine" % gpuName, - 'segPar': None, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Segweights': None, - }) - - CHANNEL2_MODEL = ("24", "024", "船只综合检测模型", 'channel2', lambda device, gpuName: { - 'device': device, - 'gpu_name': gpuName, - - 'labelnames': ["国旗", "浮标", "船名", "船只","未挂国旗船只","未封仓"], # 保持原来的标签顺序不变,方便后面业务端增加 - 'segRegionCnt': 0, - 'postProcess':{'function':channel2_post_process,'name':'channel2','pars':{ - 'objs':[2], - 'wRation':1/6.0, - 'hRation':1/6.0, - 'smallId':0, #旗帜 - 'bigId':3, #船只 - 'newId':4, #未挂国旗船只 - 'uncoverId':5, #未封仓标签 - 'recScale':1.2, - 'target_cls':3.0, #目标种类 - 'filter_cls':4.0 #被过滤的种类 - }}, - 'models':[ - { - #'weight':'../AIlib2/weights/conf/channel2/yolov5.pt', - # 'weight':'../AIlib2/weights/channel2/yolov5_%s_fp16.engine'%(gpuName), - - 'weight':'/home/thsw2/jcq/test/AIlib2/weights/channel2/best.pt', # yolov5 原来模型基础上增加了未封仓 - - # 'weight':'../AIlib2/weights/channel2/yolov5_%s_fp16.engine'%(gpuName), - - 'name':'yolov5', - 'model':yolov5Model, - 'par':{ 'half':True,'device':'cuda:0' ,'conf_thres':0.1,'iou_thres':0.45,'allowedList':list(range(20)),'segRegionCnt':1, 'trtFlag_det':False,'trtFlag_seg':False, "score_byClass":{"0":0.7,"1":0.7,"2":0.8,"3":0.6} } - }, - { - # 'weight' : '../AIlib2/weights/ocr2/crnn_ch_4090_fp16_192X32.engine', - 'weight' : '../AIlib2/weights/conf/ocr2/crnn_ch.pth', - 'name':'ocr', - 'model':ocrModel, - 'par':{ - 'char_file':'../AIlib2/weights/conf/ocr2/benchmark.txt', - 'mode':'ch', - 'nc':3, - 'imgH':32, - 'imgW':192, - 'hidden':256, - 'mean':[0.5,0.5,0.5], - 'std':[0.5,0.5,0.5], - 'dynamic':False, - }, - } , - - - # { - # 'weight':'/home/thsw2/jcq/test/AIlib2/weights1/conf/channel2/yolov5_04.pt', # yolov5_04 添加了uncover 0 4 ;标签 yolov5_jcq - # 'name':'yolov5', - # 'model':yolov5Model, - # 'par':{ 'half':True,'device':'cuda:0' ,'conf_thres':0.15,'iou_thres':0.25,'allowedList':list(range(20)),'segRegionCnt':1, 'trtFlag_det':False,'trtFlag_seg':False, "score_byClass":{"0":0.7,"1":0.7,"2":0.8,"3":0.6} } - # } - - - ], - 'detModelpara':[{"id":str(x),"config":{"k1":"v1","k2":"v2"}} for x in [0,1,2,3]], - 'segPar': None, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Segweights': None, - }) - - RIVERT_MODEL = ("25", "025", "河道检测模型(T)", 'riverT', lambda device, gpuName: { - 'device': device, - 'labelnames': ["漂浮物", "岸坡垃圾", "排口", "违建", "菜地", "水生植物", "河湖人员", "钓鱼人员", "船只", - "蓝藻"], - 'trtFlag_seg': True, - 'trtFlag_det': True, - 'seg_nclass': 2, - 'segRegionCnt': 1, - 'segPar': { - 'modelSize': (640, 360), - 'mean': (0.485, 0.456, 0.406), - 'std': (0.229, 0.224, 0.225), - 'numpy': False, - 'RGB_convert_first': True, - 'mixFunction': { - 'function': riverDetSegMixProcess, - 'pars': { - 'slopeIndex': [1, 3, 4, 7], - 'riverIou': 0.1 - } - } - }, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.3, - "ovlap_thres_crossCategory": 0.65, - "classes": 5, - "rainbows": COLOR - }, - # "../AIlib2/weights/conf/%s/yolov5.pt" % modeType.value[3] - 'Detweights': "../AIlib2/weights/riverT/yolov5_%s_fp16.engine" % gpuName, - # '../AIlib2/weights/conf/%s/stdc_360X640.pth' % modeType.value[3] - 'Segweights': '../AIlib2/weights/riverT/stdc_360X640_%s_fp16.engine' % gpuName - }) - - - - FORESTCROWD_FARM_MODEL = ("2", "026", "森林人群模型", 'forestCrowd', lambda device, gpuName: { - 'labelnames': ["林斑", "病死树", "行人", "火焰", "烟雾","人群"], - 'postProcess':{'function':gather_post_process,'pars':{'pedestrianId':2,'crowdThreshold':4,'gatherId':5,'distancePersonScale':2.0}}, - 'models': - [ - { - 'weight':"../AIlib2/weights/forestCrowd/yolov5_%s_fp16.engine"%(gpuName),###检测模型路径 - 'name':'yolov5', - 'model':yolov5Model, - 'par':{ 'half':True,'device':'cuda:0' ,'conf_thres':0.25,'iou_thres':0.5,'allowedList':[0,1,2,3],'segRegionCnt':1, 'trtFlag_det':False,'trtFlag_seg':False, "score_byClass":{ "0":0.25,"1":0.25,"2":0.6,"3":0.6,'4':0.6 ,'5':0.6 } }, - } - - - ], - - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'detModelpara':[{"id":str(x),"config":{"k1":"v1","k2":"v2"}} for x in [0,1,2,3,4,5,6,7,8,9] ],###控制哪些检测类别显示、输出 - 'segRegionCnt':2,###分割模型结果需要保留的等值线数目 - "pixScale": 1.2, - - - }) - TRAFFICFORDSJ_FARM_MODEL = ("27", "027", "交通模型-大数据局", 'highWay2T', lambda device, gpuName: { - 'device': str(device), - 'labelnames': ["行人", "车辆", "纵向裂缝", "横向裂缝", "修补", "网状裂纹", "坑槽", "块状裂纹", "积水", "影子", "事故", "桥梁外观","设施破损缺失","龙门架","防抛网","标识牌损坏","护栏损坏","钢筋裸露" ], - 'trtFlag_seg': True, - 'trtFlag_det': True, - 'seg_nclass': 3, - 'segRegionCnt': 2, - 'segPar': { - 'modelSize': (640, 360), - 'mean': (0.485, 0.456, 0.406), - 'std': (0.229, 0.224, 0.225), - 'predResize': True, - 'numpy': False, - 'RGB_convert_first': True, - 'mixFunction': { - 'function': tracfficAccidentMixFunction, - 'pars': { - 'modelSize': (640, 360), - #'modelSize': (1920,1080), - 'RoadArea': 16000, - 'roadVehicleAngle': 15, - 'speedRoadVehicleAngleMax': 75, - 'roundness': 1.0, - 'cls': 9, - 'vehicleFactor': 0.1, - 'confThres': 0.25, - 'roadIou': 0.6, - 'radius': 50, - 'vehicleFlag': False, - 'distanceFlag': False - } - } - }, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.25, - "classes": 10, - "rainbows": COLOR - }, - 'Detweights': "../AIlib2/weights/highWay2/yolov5_%s_fp16.engine" % gpuName, - 'Segweights': '../AIlib2/weights/highWay2/stdc_360X640_%s_fp16.engine' % gpuName - }) - - - - @staticmethod - def checkCode(code): - for model in ModelType: - if model.value[1] == code: - return True - return False - - -''' - 参数1: 检测目标名称 - 参数2: 检测目标 - 参数3: 初始化百度检测客户端 -''' - - -@unique -class BaiduModelTarget(Enum): - VEHICLE_DETECTION = ( - "车辆检测", 0, lambda client0, client1, url, request_id: client0.vehicleDetectUrl(url, request_id)) - - HUMAN_DETECTION = ( - "人体检测与属性识别", 1, lambda client0, client1, url, request_id: client1.bodyAttr(url, request_id)) - - PEOPLE_COUNTING = ("人流量统计", 2, lambda client0, client1, url, request_id: client1.bodyNum(url, request_id)) - - -BAIDU_MODEL_TARGET_CONFIG = { - BaiduModelTarget.VEHICLE_DETECTION.value[1]: BaiduModelTarget.VEHICLE_DETECTION, - BaiduModelTarget.HUMAN_DETECTION.value[1]: BaiduModelTarget.HUMAN_DETECTION, - BaiduModelTarget.PEOPLE_COUNTING.value[1]: BaiduModelTarget.PEOPLE_COUNTING -} - -EPIDEMIC_PREVENTION_CONFIG = {1: "行程码", 2: "健康码"} - - -# 模型分析方式 -@unique -class ModelMethodTypeEnum(Enum): - # 方式一: 正常识别方式 - NORMAL = 1 - - # 方式二: 追踪识别方式 - TRACE = 2 -- 2.25.1 From 154268282892b94987b10046283d098de4f14c7c Mon Sep 17 00:00:00 2001 From: zhoushuliang Date: Sat, 5 Jul 2025 11:13:45 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=88=A0=E9=99=A4=20enums/ModelTypeEnum-ra?= =?UTF-8?q?w.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 可删除 --- enums/ModelTypeEnum-raw.py | 807 ------------------------------------- 1 file changed, 807 deletions(-) delete mode 100644 enums/ModelTypeEnum-raw.py diff --git a/enums/ModelTypeEnum-raw.py b/enums/ModelTypeEnum-raw.py deleted file mode 100644 index 79fd69c..0000000 --- a/enums/ModelTypeEnum-raw.py +++ /dev/null @@ -1,807 +0,0 @@ -import sys -from enum import Enum, unique - -from common.Constant import COLOR - -sys.path.extend(['..', '../AIlib2']) -from DMPR import DMPRModel -from DMPRUtils.jointUtil import dmpr_yolo -from segutils.segmodel import SegModel -from utilsK.queRiver import riverDetSegMixProcess -from utilsK.crowdGather import gather_post_process -from segutils.trafficUtils import tracfficAccidentMixFunction -from utilsK.drownUtils import mixDrowing_water_postprocess -from utilsK.noParkingUtils import mixNoParking_road_postprocess -from utilsK.illParkingUtils import illParking_postprocess -from stdc import stdcModel -from yolov5 import yolov5Model -from DMPRUtils.jointUtil import dmpr_yolo_stdc -from AI import default_mix -from ocr import ocrModel -from utilsK.channel2postUtils import channel2_post_process - -''' -参数说明 -1. 编号 -2. 模型编号 -3. 模型名称 -4. 选用的模型名称 -5. 模型配置 -6. 模型引用配置[Detweights文件, Segweights文件, 引用计数] -''' - - -@unique -class ModelType(Enum): - WATER_SURFACE_MODEL = ("1", "001", "河道模型", 'river', lambda device, gpuName: { - 'device': device, - 'labelnames': ["排口", "水生植被", "其它", "漂浮物", "污染排口", "菜地", "违建", "岸坡垃圾"], - 'seg_nclass': 2, - 'trtFlag_seg': True, - 'trtFlag_det': True, - 'segRegionCnt': 1, - 'segPar': { - 'modelSize': (640, 360), - 'mean': (0.485, 0.456, 0.406), - 'std': (0.229, 0.224, 0.225), - 'numpy': False, - 'RGB_convert_first': True, - 'mixFunction': { - 'function': riverDetSegMixProcess, - 'pars': { - 'slopeIndex': [5, 6, 7], - 'riverIou': 0.1 - } - } - }, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Detweights': "../AIlib2/weights/river/yolov5_%s_fp16.engine" % gpuName, - 'Segweights': '../AIlib2/weights/river/stdc_360X640_%s_fp16.engine' % gpuName - }) - - # FOREST_FARM_MODEL = ("2", "002", "森林模型", 'forest2', lambda device, gpuName: { - # 'device': device, - # 'gpu_name': gpuName, - # 'labelnames': ["林斑", "病死树", "行人", "火焰", "烟雾","云朵"], - # 'trtFlag_det': True, - # 'trtFlag_seg': False, - # 'Detweights': "../AIlib2/weights/forest2/yolov5_%s_fp16.engine" % gpuName, - # 'seg_nclass': 2, - # 'segRegionCnt': 0, - # 'slopeIndex': [], - # 'segPar': None, - # 'postFile': { - # "name": "post_process", - # "conf_thres": 0.25, - # "iou_thres": 0.45, - # "classes": 6, - # "rainbows": COLOR - # }, - # 'Segweights': None - # }) - - - FOREST_FARM_MODEL = ("2", "002", "森林模型", 'forest2', lambda device, gpuName: { - 'labelnames': ["林斑", "病死树", "行人", "火焰", "烟雾","云朵"], - 'postProcess':{'function':default_mix,'pars':{}}, - 'models': - [ - { - 'weight':"../AIlib2/weights/forest2/yolov5_%s_fp16.engine"%(gpuName),###检测模型路径 - 'name':'yolov5', - 'model':yolov5Model, - 'par':{ 'half':True,'device':'cuda:0' ,'conf_thres':0.25,'iou_thres':0.45,'allowedList':[0,1,2,3],'segRegionCnt':1, 'trtFlag_det':False,'trtFlag_seg':False, "score_byClass":{"0":0.25,"1":0.3,"2":0.3,"3":0.3 } }, - } - - - ], - - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'detModelpara':[{"id":str(x),"config":{"k1":"v1","k2":"v2"}} for x in [0,1,2,3,4,5,6,7,8,9] ],###控制哪些检测类别显示、输出 - 'segRegionCnt':2,###分割模型结果需要保留的等值线数目 - "pixScale": 1.2, - - - }) - - - - TRAFFIC_FARM_MODEL = ("3", "003", "交通模型", 'highWay2', lambda device, gpuName: { - 'device': str(device), - 'labelnames': ["行人", "车辆", "纵向裂缝", "横向裂缝", "修补", "网状裂纹", "坑槽", "块状裂纹", "积水", "影子", "事故"], - 'trtFlag_seg': True, - 'trtFlag_det': True, - 'seg_nclass': 3, - 'segRegionCnt': 2, - 'segPar': { - #'modelSize': (640, 360), - 'modelSize': (1920, 1080), - 'mean': (0.485, 0.456, 0.406), - 'std': (0.229, 0.224, 0.225), - 'predResize': True, - 'numpy': False, - 'RGB_convert_first': True, - 'mixFunction': { - 'function': tracfficAccidentMixFunction, - 'pars': { - #'modelSize': (640, 360), - 'modelSize': (1920,1080), - 'RoadArea': 16000, - 'roadVehicleAngle': 15, - 'speedRoadVehicleAngleMax': 75, - 'roundness': 1.0, - 'cls': 10, - 'vehicleFactor': 0.1, - 'confThres': 0.25, - 'roadIou': 0.6, - 'radius': 50, - 'vehicleFlag': False, - 'distanceFlag': False - } - } - }, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.25, - "classes": 10, - "rainbows": COLOR - }, - 'Detweights': "../AIlib2/weights/highWay2/yolov5_%s_fp16.engine" % gpuName, - 'Segweights': '../AIlib2/weights/highWay2/stdc_360X640_%s_fp16.engine' % gpuName - }) - - EPIDEMIC_PREVENTION_MODEL = ("4", "004", "防疫模型", None, None) - - PLATE_MODEL = ("5", "005", "车牌模型", None, None) - - VEHICLE_MODEL = ("6", "006", "车辆模型", 'vehicle', lambda device, gpuName: { - 'device': device, - 'gpu_name': gpuName, - 'labelnames': ["车辆"], - 'seg_nclass': 2, - 'segRegionCnt': 0, - 'slopeIndex': [], - 'trtFlag_det': True, - 'trtFlag_seg': False, - 'Detweights': "../AIlib2/weights/vehicle/yolov5_%s_fp16.engine" % gpuName, - 'segPar': None, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Segweights': None - }) - - PEDESTRIAN_MODEL = ("7", "007", "行人模型", 'pedestrian', lambda device, gpuName: { - 'device': device, - 'gpu_name': gpuName, - 'labelnames': ["行人"], - 'seg_nclass': 2, - 'segRegionCnt': 0, - 'trtFlag_det': True, - 'trtFlag_seg': False, - 'Detweights': "../AIlib2/weights/pedestrian/yolov5_%s_fp16.engine" % gpuName, - 'slopeIndex': [], - 'segPar': None, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Segweights': None - }) - - SMOGFIRE_MODEL = ("8", "008", "烟火模型", 'smogfire', lambda device, gpuName: { - 'device': device, - 'gpu_name': gpuName, - 'labelnames': ["火焰", "烟雾"], - 'seg_nclass': 2, # 分割模型类别数目,默认2类 - 'segRegionCnt': 0, - 'trtFlag_det': True, - 'trtFlag_seg': False, - 'Detweights': "../AIlib2/weights/smogfire/yolov5_%s_fp16.engine" % gpuName, - 'slopeIndex': [], - 'segPar': None, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Segweights': None - }) - - ANGLERSWIMMER_MODEL = ("9", "009", "钓鱼游泳模型", 'AnglerSwimmer', lambda device, gpuName: { - 'device': device, - 'gpu_name': gpuName, - 'labelnames': ["钓鱼", "游泳"], - 'seg_nclass': 2, # 分割模型类别数目,默认2类 - 'segRegionCnt': 0, - 'slopeIndex': [], - 'trtFlag_det': True, - 'trtFlag_seg': False, - 'Detweights': "../AIlib2/weights/AnglerSwimmer/yolov5_%s_fp16.engine" % gpuName, - 'segPar': None, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Segweights': None - }) - - COUNTRYROAD_MODEL = ("10", "010", "乡村模型", 'countryRoad', lambda device, gpuName: { - 'device': device, - 'gpu_name': gpuName, - 'labelnames': ["违法种植"], - 'seg_nclass': 2, # 分割模型类别数目,默认2类 - 'segRegionCnt': 0, - 'slopeIndex': [], - 'trtFlag_det': True, - 'trtFlag_seg': False, - 'Detweights': "../AIlib2/weights/countryRoad/yolov5_%s_fp16.engine" % gpuName, - 'segPar': None, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Segweights': None - }) - - SHIP_MODEL = ("11", "011", "船只模型", 'ship2', lambda device, gpuName: { - 'model_size': (608, 608), - 'K': 100, - 'conf_thresh': 0.18, - 'device': 'cuda:%s' % device, - 'down_ratio': 4, - 'num_classes': 15, - 'weights': '../AIlib2/weights/ship2/obb_608X608_%s_fp16.engine' % gpuName, - 'dataset': 'dota', - 'half': False, - 'mean': (0.5, 0.5, 0.5), - 'std': (1, 1, 1), - 'heads': {'hm': None, 'wh': 10, 'reg': 2, 'cls_theta': 1}, - 'decoder': None, - 'test_flag': True, - "rainbows": COLOR, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'drawBox': False, - 'label_array': None, - 'labelnames': ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "船只"), - }) - - BAIDU_MODEL = ("12", "012", "百度AI图片识别模型", None, None) - - CHANNEL_EMERGENCY_MODEL = ("13", "013", "航道模型", 'channelEmergency', lambda device, gpuName: { - 'device': device, - 'gpu_name': gpuName, - 'labelnames': ["人"], - 'seg_nclass': 2, # 分割模型类别数目,默认2类 - 'segRegionCnt': 0, - 'slopeIndex': [], - 'trtFlag_det': True, - 'trtFlag_seg': False, - 'Detweights': "../AIlib2/weights/channelEmergency/yolov5_%s_fp16.engine" % gpuName, - 'segPar': None, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Segweights': None - }) - - RIVER2_MODEL = ("15", "015", "河道检测模型", 'river2', lambda device, gpuName: { - 'device': device, - 'labelnames': ["漂浮物", "岸坡垃圾", "排口", "违建", "菜地", "水生植物", "河湖人员", "钓鱼人员", "船只", - "蓝藻"], - 'trtFlag_seg': True, - 'trtFlag_det': True, - 'seg_nclass': 2, - 'segRegionCnt': 1, - 'segPar': { - 'modelSize': (640, 360), - 'mean': (0.485, 0.456, 0.406), - 'std': (0.229, 0.224, 0.225), - 'numpy': False, - 'RGB_convert_first': True, - 'mixFunction': { - 'function': riverDetSegMixProcess, - 'pars': { - 'slopeIndex': [1, 3, 4, 7], - 'riverIou': 0.1 - } - } - }, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.3, - "ovlap_thres_crossCategory": 0.65, - "classes": 5, - "rainbows": COLOR - }, - # "../AIlib2/weights/conf/%s/yolov5.pt" % modeType.value[3] - 'Detweights': "../AIlib2/weights/river2/yolov5_%s_fp16.engine" % gpuName, - # '../AIlib2/weights/conf/%s/stdc_360X640.pth' % modeType.value[3] - 'Segweights': '../AIlib2/weights/river2/stdc_360X640_%s_fp16.engine' % gpuName - }) - - CITY_MANGEMENT_MODEL = ("16", "016", "城管模型", 'cityMangement2', lambda device, gpuName: { - 'labelnames': ["车辆", "垃圾", "商贩", "裸土","占道经营","违停"], - 'postProcess':{ - 'function':dmpr_yolo_stdc, - 'pars':{'carCls':0 ,'illCls':5,'scaleRatio':0.5,'border':80} - }, - 'models':[ - { - #'weight':'../AIlib2/weights/conf/cityMangement3/yolov5.pt', - 'weight':'../AIlib2/weights/cityMangement3/yolov5_%s_fp16.engine'%(gpuName), - 'name':'yolov5', - 'model':yolov5Model, - 'par':{ 'half':True,'device':'cuda:0' ,'conf_thres':0.25,'iou_thres':0.45,'allowedList':[0,1,2,3,4,5],'segRegionCnt':1, 'trtFlag_det':False,'trtFlag_seg':False, "score_byClass":{"0":0.8,"1":0.4,"2":0.5,"3":0.5,"4":0.4,"5":0.5 } } - }, - { - 'weight':'../AIlib2/weights/conf/cityMangement3/dmpr.pth', - 'par':{ - 'depth_factor':32,'NUM_FEATURE_MAP_CHANNEL':6,'dmpr_thresh':0.1, 'dmprimg_size':640, - 'name':'dmpr' - }, - 'model':DMPRModel, - 'name':'dmpr' - }, - { - 'weight':'../AIlib2/weights/conf/cityMangement3/stdc_360X640.pth', - 'par':{ - 'modelSize':(640,360),'mean':(0.485, 0.456, 0.406),'std' :(0.229, 0.224, 0.225),'predResize':True,'numpy':False, 'RGB_convert_first':True,'seg_nclass':2},###分割模型预处理参数 - 'model':stdcModel, - 'name':'stdc' - } - ], - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'detModelpara':[{"id":str(x),"config":{"k1":"v1","k2":"v2"}} for x in [0,1,2,3,5,6,7,8,9] ],###控制哪些检测类别显示、输出 - 'segRegionCnt':2,###分割模型结果需要保留的等值线数目 - "pixScale": 1.2, - }) - - DROWING_MODEL = ("17", "017", "人员落水模型", 'drowning', lambda device, gpuName: { - 'device': device, - 'labelnames': ["人头", "人", "船只"], - 'trtFlag_seg': True, - 'trtFlag_det': True, - 'seg_nclass': 2, - 'segRegionCnt': 2, - 'segPar': { - 'modelSize': (640, 360), - 'mean': (0.485, 0.456, 0.406), - 'std': (0.229, 0.224, 0.225), - 'predResize': True, - 'numpy': False, - 'RGB_convert_first': True, - 'mixFunction': { - 'function': mixDrowing_water_postprocess, - 'pars': { - 'modelSize': (640, 360) - } - } - }, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.25, - "classes": 9, - "rainbows": COLOR - }, - # "../AIlib2/weights/conf/%s/yolov5.pt" % modeType.value[3] - 'Detweights': "../AIlib2/weights/drowning/yolov5_%s_fp16.engine" % gpuName, - # '../AIlib2/weights/conf/%s/stdc_360X640.pth' % modeType.value[3] - 'Segweights': '../AIlib2/weights/drowning/stdc_360X640_%s_fp16.engine' % gpuName - }) - - NOPARKING_MODEL = ( - "18", "018", "城市违章模型", 'noParking', lambda device, gpuName: { - 'device': device, - 'labelnames': ["车辆", "违停"], - 'trtFlag_seg': True, - 'trtFlag_det': True, - 'seg_nclass': 4, - 'segRegionCnt': 2, - 'segPar': { - 'modelSize': (640, 360), - 'mean': (0.485, 0.456, 0.406), - 'std': (0.229, 0.224, 0.225), - 'predResize': True, - 'numpy': False, - 'RGB_convert_first': True, ###分割模型预处理参数 - 'mixFunction': { - 'function': mixNoParking_road_postprocess, - 'pars': { - 'modelSize': (640, 360), - 'roundness': 0.3, - 'cls': 9, - 'laneArea': 10, - 'laneAngleCha': 5, - 'RoadArea': 16000, - 'fitOrder':2 - } - } - }, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.25, - "classes": 9, - "rainbows": COLOR - }, - 'Detweights': "../AIlib2/weights/noParking/yolov5_%s_fp16.engine" % gpuName, - 'Segweights': '../AIlib2/weights/noParking/stdc_360X640_%s_fp16.engine' % gpuName - }) - - ILLPARKING_MODEL = ("19", "019", "车辆违停模型", 'illParking', lambda device, gpuName: { - 'device': device, - 'labelnames': ["车", "T角点", "L角点", "违停"], - 'trtFlag_seg': False, - 'trtFlag_det': True, - 'seg_nclass': 4, - 'segRegionCnt': 2, - 'segPar': { - 'mixFunction': { - 'function': illParking_postprocess, - 'pars': {} - } - }, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.25, - "classes": 9, - "rainbows": COLOR - }, - 'Detweights': "../AIlib2/weights/illParking/yolov5_%s_fp16.engine" % gpuName, - 'Segweights': None - }) - - CITYROAD_MODEL = ("20", "020", "城市公路模型", 'cityRoad', lambda device, gpuName: { - 'device': device, - 'labelnames': ["护栏", "交通标志", "非交通标志", "施工", "施工"], - 'trtFlag_seg': False, - 'trtFlag_det': True, - 'slopeIndex': [], - 'seg_nclass': 2, - 'segRegionCnt': 0, - 'segPar': None, - 'postFile': { - "name": "post_process", - "conf_thres": 0.8, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Detweights': "../AIlib2/weights/cityRoad/yolov5_%s_fp16.engine" % gpuName, - 'Segweights': None - }) - - POTHOLE_MODEL = ("23", "023", "坑槽检测模型", 'pothole', lambda device, gpuName: { - 'device': device, - 'gpu_name': gpuName, - 'labelnames': ["坑槽"], - 'seg_nclass': 2, # 分割模型类别数目,默认2类 - 'segRegionCnt': 0, - 'slopeIndex': [], - 'trtFlag_det': True, - 'trtFlag_seg': False, - 'Detweights': "../AIlib2/weights/pothole/yolov5_%s_fp16.engine" % gpuName, - 'segPar': None, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Segweights': None, - }) - - CHANNEL2_MODEL = ("24", "024", "船只综合检测模型", 'channel2', lambda device, gpuName: { - 'device': device, - 'gpu_name': gpuName, - 'labelnames': ["国旗", "浮标", "船名", "船只","未挂国旗船只"], - 'segRegionCnt': 0, - 'postProcess':{'function':channel2_post_process,'name':'channel2','pars':{ - 'objs':[2], - 'wRation':1/6.0, - 'hRation':1/6.0, - 'smallId':0, - 'bigId':3, - 'newId':4, - 'recScale':1.2}}, - 'models':[ - { - #'weight':'../AIlib2/weights/conf/channel2/yolov5.pt', - 'weight':'../AIlib2/weights/channel2/yolov5_%s_fp16.engine'%(gpuName), - 'name':'yolov5', - 'model':yolov5Model, - 'par':{ 'half':True,'device':'cuda:0' ,'conf_thres':0.1,'iou_thres':0.45,'allowedList':list(range(20)),'segRegionCnt':1, 'trtFlag_det':False,'trtFlag_seg':False, "score_byClass":{"0":0.7,"1":0.7,"2":0.8,"3":0.6} } - }, - { - # 'weight' : '../AIlib2/weights/ocr2/crnn_ch_4090_fp16_192X32.engine', - 'weight' : '../AIlib2/weights/conf/ocr2/crnn_ch.pth', - 'name':'ocr', - 'model':ocrModel, - 'par':{ - 'char_file':'../AIlib2/weights/conf/ocr2/benchmark.txt', - 'mode':'ch', - 'nc':3, - 'imgH':32, - 'imgW':192, - 'hidden':256, - 'mean':[0.5,0.5,0.5], - 'std':[0.5,0.5,0.5], - 'dynamic':False, - }, - } - ], - 'detModelpara':[{"id":str(x),"config":{"k1":"v1","k2":"v2"}} for x in [0,1,2,3]], - 'segPar': None, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'Segweights': None, - }) - - RIVERT_MODEL = ("25", "025", "河道检测模型(T)", 'riverT', lambda device, gpuName: { - 'device': device, - 'labelnames': ["漂浮物", "岸坡垃圾", "排口", "违建", "菜地", "水生植物", "河湖人员", "钓鱼人员", "船只", - "蓝藻"], - 'trtFlag_seg': True, - 'trtFlag_det': True, - 'seg_nclass': 2, - 'segRegionCnt': 1, - 'segPar': { - 'modelSize': (640, 360), - 'mean': (0.485, 0.456, 0.406), - 'std': (0.229, 0.224, 0.225), - 'numpy': False, - 'RGB_convert_first': True, - 'mixFunction': { - 'function': riverDetSegMixProcess, - 'pars': { - 'slopeIndex': [1, 3, 4, 7], - 'riverIou': 0.1 - } - } - }, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.3, - "ovlap_thres_crossCategory": 0.65, - "classes": 5, - "rainbows": COLOR - }, - # "../AIlib2/weights/conf/%s/yolov5.pt" % modeType.value[3] - 'Detweights': "../AIlib2/weights/riverT/yolov5_%s_fp16.engine" % gpuName, - # '../AIlib2/weights/conf/%s/stdc_360X640.pth' % modeType.value[3] - 'Segweights': '../AIlib2/weights/riverT/stdc_360X640_%s_fp16.engine' % gpuName - }) - - - - FORESTCROWD_FARM_MODEL = ("26", "026", "森林人群模型", 'forestCrowd', lambda device, gpuName: { - 'labelnames': ["林斑", "病死树", "行人", "火焰", "烟雾","人群"], - 'postProcess':{'function':gather_post_process,'pars':{'pedestrianId':2,'crowdThreshold':4,'gatherId':5,'distancePersonScale':2.0}}, - 'models': - [ - { - 'weight':"../AIlib2/weights/forestCrowd/yolov5_%s_fp16.engine"%(gpuName),###检测模型路径 - 'name':'yolov5', - 'model':yolov5Model, - 'par':{ 'half':True,'device':'cuda:0' ,'conf_thres':0.25,'iou_thres':0.45,'allowedList':[0,1,2,3],'segRegionCnt':1, 'trtFlag_det':False,'trtFlag_seg':False, "score_byClass":{ "0":0.25,"1":0.25,"2":0.6,"3":0.6,'4':0.6 ,'5':0.6 } }, - } - - - ], - - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.45, - "classes": 5, - "rainbows": COLOR - }, - 'detModelpara':[{"id":str(x),"config":{"k1":"v1","k2":"v2"}} for x in [0,1,2,3,4,5,6,7,8,9] ],###控制哪些检测类别显示、输出 - 'segRegionCnt':2,###分割模型结果需要保留的等值线数目 - "pixScale": 1.2, - - - }) - TRAFFICFORDSJ_FARM_MODEL = ("27", "027", "交通模型-大数据局", 'highWay2T', lambda device, gpuName: { - 'device': str(device), - 'labelnames': ["行人", "车辆", "纵向裂缝", "横向裂缝", "修补", "网状裂纹", "坑槽", "块状裂纹", "积水", "影子", "事故", "桥梁外观","设施破损缺失","龙门架","防抛网","标识牌损坏","护栏损坏","钢筋裸露" ], - 'trtFlag_seg': True, - 'trtFlag_det': True, - 'seg_nclass': 3, - 'segRegionCnt': 2, - 'segPar': { - 'modelSize': (640, 360), - 'mean': (0.485, 0.456, 0.406), - 'std': (0.229, 0.224, 0.225), - 'predResize': True, - 'numpy': False, - 'RGB_convert_first': True, - 'mixFunction': { - 'function': tracfficAccidentMixFunction, - 'pars': { - 'modelSize': (640, 360), - #'modelSize': (1920,1080), - 'RoadArea': 16000, - 'roadVehicleAngle': 15, - 'speedRoadVehicleAngleMax': 75, - 'roundness': 1.0, - 'cls': 9, - 'vehicleFactor': 0.1, - 'confThres': 0.25, - 'roadIou': 0.6, - 'radius': 50, - 'vehicleFlag': False, - 'distanceFlag': False - } - } - }, - 'postFile': { - "name": "post_process", - "conf_thres": 0.25, - "iou_thres": 0.25, - "classes": 10, - "rainbows": COLOR - }, - 'Detweights': "../AIlib2/weights/highWay2/yolov5_%s_fp16.engine" % gpuName, - 'Segweights': '../AIlib2/weights/highWay2/stdc_360X640_%s_fp16.engine' % gpuName - }) - - SMARTSITE_MODEL = ("28", "028", "智慧工地模型", 'smartSite', lambda device, gpuName: { - 'labelnames': [ "工人","塔式起重机","悬臂","起重机","压路机","推土机","挖掘机","卡车","装载机","泵车","混凝土搅拌车","打桩","其他车辆" ], - 'postProcess':{'function':default_mix,'pars':{}}, - 'models': - [ - { - 'weight':"../AIlib2/weights/smartSite/yolov5_%s_fp16.engine"%(gpuName),###检测模型路径 - 'name':'yolov5', - 'model':yolov5Model, - 'par':{ 'half':True,'device':'cuda:0' ,'conf_thres':0.25,'iou_thres':0.45,'allowedList':list(range(20)),'segRegionCnt':1, 'trtFlag_det':True,'trtFlag_seg':False, "score_byClass":{"0":0.25,"1":0.3,"2":0.3,"3":0.3 } }, - } - - - ], - 'postFile': { - "rainbows": COLOR - }, - - }) - - RUBBISH_MODEL = ("29", "029", "垃圾模型", 'rubbish', lambda device, gpuName: { - 'labelnames': [ "建筑垃圾","白色垃圾","其他垃圾"], - 'postProcess':{'function':default_mix,'pars':{}}, - 'models': - [ - { - 'weight':"../AIlib2/weights/rubbish/yolov5_%s_fp16.engine"%(gpuName),###检测模型路径 - 'name':'yolov5', - 'model':yolov5Model, - 'par':{ 'half':True,'device':'cuda:0' ,'conf_thres':0.25,'iou_thres':0.45,'allowedList':list(range(20)),'segRegionCnt':1, 'trtFlag_det':True,'trtFlag_seg':False, "score_byClass":{"0":0.25,"1":0.3,"2":0.3,"3":0.3 } }, - } - - - ], - 'postFile': { - "rainbows": COLOR - }, - - }) - - FIREWORK_MODEL = ("30", "030", "烟花模型", 'firework', lambda device, gpuName: { - 'labelnames': [ "烟花"], - 'postProcess':{'function':default_mix,'pars':{}}, - 'models': - [ - { - 'weight':"../AIlib2/weights/firework/yolov5_%s_fp16.engine"%(gpuName),###检测模型路径 - 'name':'yolov5', - 'model':yolov5Model, - 'par':{ 'half':True,'device':'cuda:0' ,'conf_thres':0.25,'iou_thres':0.45,'allowedList':list(range(20)),'segRegionCnt':1, 'trtFlag_det':True,'trtFlag_seg':False, "score_byClass":{"0":0.25,"1":0.3,"2":0.3,"3":0.3 } }, - } - - - ], - 'postFile': { - "rainbows": COLOR - }, - - }) - - - @staticmethod - def checkCode(code): - for model in ModelType: - if model.value[1] == code: - return True - return False - - -''' - 参数1: 检测目标名称 - 参数2: 检测目标 - 参数3: 初始化百度检测客户端 -''' - - -@unique -class BaiduModelTarget(Enum): - VEHICLE_DETECTION = ( - "车辆检测", 0, lambda client0, client1, url, request_id: client0.vehicleDetectUrl(url, request_id)) - - HUMAN_DETECTION = ( - "人体检测与属性识别", 1, lambda client0, client1, url, request_id: client1.bodyAttr(url, request_id)) - - PEOPLE_COUNTING = ("人流量统计", 2, lambda client0, client1, url, request_id: client1.bodyNum(url, request_id)) - - -BAIDU_MODEL_TARGET_CONFIG = { - BaiduModelTarget.VEHICLE_DETECTION.value[1]: BaiduModelTarget.VEHICLE_DETECTION, - BaiduModelTarget.HUMAN_DETECTION.value[1]: BaiduModelTarget.HUMAN_DETECTION, - BaiduModelTarget.PEOPLE_COUNTING.value[1]: BaiduModelTarget.PEOPLE_COUNTING -} - -EPIDEMIC_PREVENTION_CONFIG = {1: "行程码", 2: "健康码"} - - -# 模型分析方式 -@unique -class ModelMethodTypeEnum(Enum): - # 方式一: 正常识别方式 - NORMAL = 1 - - # 方式二: 追踪识别方式 - TRACE = 2 -- 2.25.1