def full(): """ global variable """ global PANDA_TEST_SIZE,fliterscore,UP_boundary,iskeep_dets,test,isdel_inter,isfliter PANDA_TEST_SIZE=[ [26573,15052], # 9 [32609,24457], # 10 [31746,23810], [34682,26012], [26583,14957], [26583,14957], [26573,15052]] UP_boundary=[3552,2004,0,0,5990,4257,3813] #是否use keep_dets() iskeep_dets=0 isfliter=1#fliter score xml isdel_inter=0# test=1#"test" fliterscore={"14_OCT":0,"15_nanshan":0,"1601_shool":0,"1602_shool":0,"17_newzhongguan":0,"1801_xilin":0,"1802_xilin":0} nms_name="emnms" nms_thresh=0.5 network="detectors" weights="" cls_="elema"#head dataset="selfbicyle" resfile="/root/data/gvision/mmdetection-master/workdir/detectors_vehicle_method2_elema/output/test_bbox.json" # resfile="/root/data/gvision/mmdetection-master/workdir/detectors_1_2_fafaxue/output/detectors_ep30_12_fafaxue_bbox.json" splitannofile='/root/data/rubzz/ruby/ruby_output/test/vehicle/method3_bbox_small_else_noresize.json' imgfilters=["15_27","14_02","16_01","17_23","18_01","18_40","18_41"] outfile=f"{network}{weights}_delinter{isdel_inter}isfliter{isfliter}{cls_}dataset{dataset}{nms_name}{nms_thresh}.json"#save image prefix image_prefix=f'delinter{isdel_inter}isfliter{isfliter}{nms_name}{nms_thresh}' # savepath=f"/root/data/gvision/my_merge/{cls_}/visual/{network}_{dataset}" #softnms nms setnms emnms if test: outpath=f"/root/data/gvision/my_merge/{cls_}/coco_results/{test}/{network}_{dataset}" else: outpath=f"/root/data/gvision/my_merge/{cls_}/coco_results/{network}_{dataset}" savepath=os.path.join(outpath,"visual") merge=DetResMerge(resfile=resfile,outpath=outpath, # splitannofile="/root/data/rubzz/ruby/ruby_output/test/person/split_test_method2_person.json", splitannofile=splitannofile, srcannofile="/root/data/gvision/dataset/raw_data/image_annos/person_bbox_test.json", # srcannofile="/root/data/gvision/dataset/predict/17_01/image_annos/1701.json", npyname=outfile[:-4]+f"{nms_name}", test=test, imgfilters=imgfilters, isload_npy=False, ) merge.mergeResults(outfile=outfile,is_nms=True,nms_thresh=nms_thresh,nms_name=nms_name) # merge.mergeResults(merge_input_mode="xywh",is_nms=True,nms_thresh=0.9) merge_result_visual(image_folder_test="/root/data/gvision/dataset/raw_data/image_test", result_path=os.path.join(outpath,outfile), annos_path="/root/data/gvision/dataset/raw_data/image_annos/person_bbox_test.json", savepath=savepath, output_prefix=image_prefix, imgfilters=imgfilters, test=test, mode="xywh", num=10,score=0.3)#mode: input_bbox mode
def head(): """ global variable """ global PANDA_TEST_SIZE,fliterscore,UP_boundary,iskeep_dets,test,isdel_inter,isfliter PANDA_TEST_SIZE=[ [26573,15052], # 9 [32609,24457], # 10 [31760,23810], [26583,14957], [26583,14957], [26573,15052]] UP_boundary=[4500,1417,0,0,5357,4205,52] #是否use keep_dets() iskeep_dets=0 isfliter=1#fliter score xml isdel_inter=0# test=1 fliterscore={"14_OCT":0.1,"15_nanshan":0.1,"1601_shool":0.1,"1602_shool":0.1,"17_newzhongguan":0.1,"1801_xilin":0.1,"1802_xilin":0.1} nms_name="softnms" nms_thresh=0.7 network="retinaface" weights="final_model" cls_="head"#head dataset="person_unsure" resfile="/root/data/gvision/detectron2-master/workdir/output/my_head_retinaface_ms_panda/my_predict/final_nms0.7_fs0.1_all.json" splitannofile="/root/data/rubzz/ruby/ruby_output2/test_person_unsure_cell.json" imgfilters=["15_27","14_02","16_01","17_23","18_01"] outfile=f"{network}{weights}_delinter{isdel_inter}isfliter{isfliter}{cls_}dataset{dataset}{nms_name}{nms_thresh}.json"#save image prefix image_prefix=f'delinter{isdel_inter}isfliter{isfliter}{nms_name}{nms_thresh}' # savepath=f"/root/data/gvision/my_merge/{cls_}/visual/{network}_{dataset}" #softnms nms setnms emnms outpath=f"/root/data/gvision/my_merge/{cls_}/coco_results/{network}_{dataset}" savepath=os.path.join(outpath,"visual") merge=DetResMerge(resfile=resfile,outpath=outpath, # splitannofile="/root/data/rubzz/ruby/ruby_output/test/person/split_test_method2_person.json", splitannofile=splitannofile, srcannofile="/root/data/gvision/dataset/raw_data/image_annos/person_bbox_test.json", # srcannofile="/root/data/gvision/dataset/predict/17_01/image_annos/1701.json", npyname=outfile[:-4]+f"{nms_name}", test=test, imgfilters=imgfilters, isload_npy=False, ) merge.mergeResults(outfile=outfile,is_nms=True,nms_thresh=nms_thresh,nms_name=nms_name) # merge.mergeResults(merge_input_mode="xywh",is_nms=True,nms_thresh=0.9) merge_result_visual(image_folder_test="/root/data/gvision/dataset/raw_data/image_test", result_path=os.path.join(outpath,outfile), annos_path="/root/data/gvision/dataset/raw_data/image_annos/person_bbox_test.json", savepath=savepath, output_prefix=image_prefix, imgfilters=imgfilters, test=test, mode="xywh", num=10)#mode: input_bbox mode
def full(): """ global variable """ global PANDA_TEST_SIZE, fliterscore, UP_boundary, keep_fliter, test PANDA_TEST_SIZE = [ [26573, 15052], # 9 [32609, 24457], # 10 [31760, 23810], [26583, 14957], [26583, 14957], [26573, 15052] ] UP_boundary = [4500, 1417, 0, 0, 5357, 4205, 52] #是否use keep_dets() keep_fliter = 1 fliterscore = { "14_OCT": 0.1, "15_nanshan": 0.5, "1601_shool": 0.2, "1602_shool": 0.3, "17_newzhongguan": 0.4, "1801_xilin": 0.4, "1802_xilin": 0.4 } network = "crowdet" weights = "" cls_ = "full" #head test = 1 resfile = "/root/data/gvision/CrowdDet-master/model/rcnn_emd_refinet/visiblebody/outputs/eval_dump/allvboxdump_3nms0.35prethre0.4.json" # resfile="/root/data/gvision/CrowdDet-master/model/rcnn_emd_refinet/outputs/eval_dump/testalldunms0.35prethre0.4.json" outpath = f"/root/data/gvision/my_merge/{cls_}/coco_results" imgfilters = [ "14_02", "16_02", "16_14", "16_16", "15_24", "17_02", "18_40", "18_01", "17_01" ] imgfilters = ["15_24"] outfile = f"inter{network}{weights}_{cls_}.json" #save image prefix savepath = f"/root/data/gvision/my_merge/{cls_}/visual/{network}" #softnms nms setnms emnms nms_name = "softnms" nms_thresh = 0.7 merge = DetResMerge( resfile=resfile, outpath=outpath, # splitannofile="/root/data/rubzz/ruby/ruby_output/test/person/split_test_method2_person.json", splitannofile= "/root/data/gvision/dataset/predict/person/test_person.json", srcannofile= "/root/data/gvision/dataset/raw_data/image_annos/person_bbox_test.json", # srcannofile="/root/data/gvision/dataset/predict/17_01/image_annos/1701.json", npyname=outfile[:-4] + f"{nms_name}", test=test, imgfilters=imgfilters, isload_npy=False, ) merge.mergeResults(outfile=outfile, is_nms=True, nms_thresh=nms_thresh, nms_name=nms_name) # merge.mergeResults(merge_input_mode="xywh",is_nms=True,nms_thresh=0.9) merge_result_visual( image_folder_test="/root/data/gvision/dataset/raw_data/image_test", result_path=os.path.join(outpath, outfile), annos_path= "/root/data/gvision/dataset/raw_data/image_annos/person_bbox_test.json", savepath=savepath, output_prefix=outfile[:-4] + f"{nms_name}{nms_thresh}", imgfilters=imgfilters, test=test, mode="xywh", num=10) #mode: input_bbox mode
def vehicle(): """ global variable """ global PANDA_TEST_SIZE,fliterscore,UP_boundary,iskeep_dets,test,isdel_inter,isfliter PANDA_TEST_SIZE=[ [26573,15052], # 9 [32609,24457], # 10 [31760,23810], [26583,14957], [26583,14957], [26573,15052]] UP_boundary=[4500,1417,0,0,5357,4205,52] #是否use keep_dets() iskeep_dets=0 isfliter=1#fliter score xml isdel_inter=1# test=0 fliterscore={"14_OCT":0.0,"15_nanshan":0,"1601_shool":0.2,"1602_shool":0.3,"17_newzhongguan":0,"1801_xilin":0.1,"1802_xilin":0} nms_name="nms" nms_thresh=0.2 network="detectors" weights="" cls_="vehicle"#head dataset="else" resfile="/root/data/gvision/mmdetection-master/workdir/detectors_vehicle_method2/output/coco_bicycle_and_panda_else/split_reuslt_detectros_else_bbox.json" # resfile="/root/data/gvision/mmdetection-master/workdir/detectors_vehicle_method2/output/coco_bicycle_and_panda_else/split_reuslt_detectros_else_big_bbox.json" # resfile="/root/data/gvision/mmdetection-master/workdir/detectors_vehicle_method2/output/epoch_12_car/split_reuslt_detectros_car_big_bbox.json" # resfile="/root/data/gvision/mmdetection-master/workdir/detectors_vehicle_method2/output/epoch_12_car/split_reuslt_detectros_car_17_bbox.json" # resfile="/root/data/gvision/mmdetection-master/workdir/detectors_vehicle_method2/output/epoch_12_car/split_reuslt_detectros_car_without17_bbox.json" splitannofile='/root/data/rubzz/ruby/ruby_output/test/vehicle/method3_bbox_small_else_noresize.json' # splitannofile='/root/data/rubzz/ruby/ruby_output/test/person/split_test_method2_bigimageto1536.json' # splitannofile="/root/data/rubzz/ruby/ruby_output/test/vehicle/test_bbox_vehicle_1333_1238_17_noresize.json" # splitannofile="/root/data/rubzz/ruby/ruby_output/test/vehicle/test_bbox_vehicle_1333_1238_without17.json" # imgfilters=["14_02","16_02" ,"16_14","16_16","15_24","17_02" ,"18_40","18_01","17_01"] # imgfilters=["15_24","14_02","17_01","17_011","17_015","17_26","17_27"] imgfilters=["15_27","14_02","16_01","17_23","18_01"] outfile=f"{network}{weights}_delinter{isdel_inter}isfliter{isfliter}{cls_}dataset{dataset}{nms_name}{nms_thresh}.json"#save image prefix outfile="car_without_17.json" image_prefix=f'delinter{isdel_inter}isfliter{isfliter}{nms_name}{nms_thresh}' savepath=f"/root/data/gvision/my_merge/{cls_}/visual/{network}_{dataset}" #softnms nms setnms emnms outpath=f"/root/data/gvision/my_merge/{cls_}/coco_results/detectors" merge=DetResMerge(resfile=resfile,outpath=outpath, # splitannofile="/root/data/rubzz/ruby/ruby_output/test/person/split_test_method2_person.json", splitannofile=splitannofile, srcannofile="/root/data/gvision/dataset/raw_data/image_annos/person_bbox_test.json", # srcannofile="/root/data/gvision/dataset/predict/17_01/image_annos/1701.json", npyname=outfile[:-4]+f"{nms_name}", test=test, imgfilters=imgfilters, isload_npy=False, ) merge.mergeResults(outfile=outfile,is_nms=True,nms_thresh=nms_thresh,nms_name=nms_name) # merge.mergeResults(merge_input_mode="xywh",is_nms=True,nms_thresh=0.9) merge_result_visual(image_folder_test="/root/data/gvision/dataset/raw_data/image_test", result_path=os.path.join(outpath,outfile), annos_path="/root/data/gvision/dataset/raw_data/image_annos/person_bbox_test.json", savepath=savepath, output_prefix=image_prefix, imgfilters=imgfilters, test=test, mode="xywh", num=10)#mode: input_bbox mode