From db88494e41e535a1404cbfe563211b23ff8804b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=A2=9E=E8=BE=89?= <3045316072@qq.com> Date: Fri, 26 Sep 2025 10:15:28 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E6=94=B9=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LabelPortShipRasterSlice.py | 1 + .../Portshapefile2dota_AA.py | 12 +++++----- SpitShipLabelTools/SpliteShipPort_AB.py | 2 +- StaticLabelResult.py | 2 +- gen_annex3.py | 22 +++++++++---------- .../PredictProcessRasterMJLCPort_AC.py | 6 ++--- .../PredictProcessRaster_AC.py | 6 ++--- .../SplitShipPortRasterTools_AC.py | 8 +++---- tools/SpliteShipPort_AA.py | 6 ++--- 9 files changed, 33 insertions(+), 32 deletions(-) create mode 100644 LabelPortShipRasterSlice/LabelPortShipRasterSlice.py diff --git a/LabelPortShipRasterSlice/LabelPortShipRasterSlice.py b/LabelPortShipRasterSlice/LabelPortShipRasterSlice.py new file mode 100644 index 0000000..0aba17d --- /dev/null +++ b/LabelPortShipRasterSlice/LabelPortShipRasterSlice.py @@ -0,0 +1 @@ +import os \ No newline at end of file diff --git a/LabelPortShipRasterSlice/Portshapefile2dota_AA.py b/LabelPortShipRasterSlice/Portshapefile2dota_AA.py index c81d62e..0a2a41e 100644 --- a/LabelPortShipRasterSlice/Portshapefile2dota_AA.py +++ b/LabelPortShipRasterSlice/Portshapefile2dota_AA.py @@ -305,16 +305,16 @@ def getMJSignal(geoExtend,shipPortTree): # pass # 处理软件 if MLCFlag and JLCFlag: - return MJLCName + return "mix_airport" # tiffLCPort[MJLCName].append(tiffpath) elif MLCFlag: - return MLCName + return "civil_harbor" # tiffLCPort[MLCName].append(tiffpath) elif JLCFlag: - return JLCName + return "military_harbor" # tiffLCPort[JLCName].append(tiffpath) else: - return NOLCName + return "no_harbor" # tiffLCPort[NOLCName].append(tiffpath) # return MLCFlag,JLCFlag @@ -418,8 +418,8 @@ def getParams(): parser.add_argument('-i','--infile',type=str,default=r'D:\港口\港口\Geo_bc2-sm-org-vv-20231016t135315-008424-0020e8-01.military_harbor.shp', help='输入shapefile文件') parser.add_argument('-o', '--outfile',type=str,default=r'D:\港口\港口dota\Geo_bc2-sm-org-vv-20231016t135315-008424-0020e8-01.military_harbor.txt', help='输出geojson文件') parser.add_argument('-m', '--mLC',type=str,help=r'MLC', default=r'D:\TYSAR-德清院\目标点位信息更新\0828目标点位\港口(民船).shp') - parser.add_argument('-j', '--jLC',type=str,help=r'JLC' ,default=r'D:\TYSAR-德清院\目标点位信息更新\0828目标点位\军港.shp') - parser.add_argument('-jm', '--jmlc',type=str,help=r'JMLC', default=r'D:\TYSAR-德清院\目标点位信息更新\0828目标点位\军民一体港口.shp') + parser.add_argument('-j', '--jLC',type=str,help=r'JLC' ,default=r'D:\TYSAR-德清院\目标点位信息更新\0828目标点位\君港.shp') + parser.add_argument('-jm', '--jmlc',type=str,help=r'JMLC', default=r'D:\TYSAR-德清院\目标点位信息更新\0828目标点位\君民一体港口.shp') parser.add_argument('-d', '--difficulty',type=int,default=1, help='输出geojson文件') args = parser.parse_args() return args diff --git a/SpitShipLabelTools/SpliteShipPort_AB.py b/SpitShipLabelTools/SpliteShipPort_AB.py index 4e91ae8..545afc3 100644 --- a/SpitShipLabelTools/SpliteShipPort_AB.py +++ b/SpitShipLabelTools/SpliteShipPort_AB.py @@ -67,7 +67,7 @@ def SpliteProcess(srcfolderpath,infolderpath,outfolderpath): labeltxtPaths=find_label_files_pathlib(infolderpath) - JportLabel=os.path.join(outfolderpath,'军港') + JportLabel=os.path.join(outfolderpath,'君港') MportLabel=os.path.join(outfolderpath,'民港') MJportLabel=os.path.join(outfolderpath,'混合港') NoportLabel=os.path.join(outfolderpath,'无港口') diff --git a/StaticLabelResult.py b/StaticLabelResult.py index 6d48dfd..3115ab8 100644 --- a/StaticLabelResult.py +++ b/StaticLabelResult.py @@ -36,7 +36,7 @@ def statictNumber(inlabelfilepath): def StaticProcess(inlabelfolder,outcsvpath): labelfilepaths=find_txt_files_pathlib(inlabelfolder) with open(outcsvpath,"w",encoding="utf-8") as f: - f.write("切片名,军用飞机,民用飞机,军民一体飞机,军用轮船,民用轮船,民用机场,军用机场,军民一体机场,军用港口,民用港口,军民一体港口,总计\n") + f.write("切片名,君用飞机,民用飞机,君民一体飞机,君用轮船,民用轮船,民用机场,君用机场,君民一体机场,君用港口,民用港口,君民一体港口,总计\n") f.write("标注,military_airplane, civil_airplane,mix_airpllane,military_ship,civil_ship,civil_airport,military_airport,mix_airport,military_harbor,civil_harbor,mix_harbor,Total\n") for labelfilepath in labelfilepaths: diff --git a/gen_annex3.py b/gen_annex3.py index 6979db1..b10c755 100644 --- a/gen_annex3.py +++ b/gen_annex3.py @@ -8,10 +8,10 @@ import argparse def stats_ship_labels(input_dir, output_file, person="", work_time=""): header = [ "标签", "负责人", "作业时间", - "军用飞机", "民用飞机", "军民一体飞机", - "军用轮船", "民用轮船", - "民用机场", "军用机场", "军民一体机场", - "民用港口", "军用港口", "军民一体港口", + "君用飞机", "民用飞机", "君民一体飞机", + "君用轮船", "民用轮船", + "民用机场", "君用机场", "君民一体机场", + "民用港口", "君用港口", "君民一体港口", "总计" ] alias = [ @@ -50,16 +50,16 @@ def stats_ship_labels(input_dir, output_file, person="", work_time=""): # "负责人":person, # "作业时间":work_time, # "民用飞机":0, - # "军用飞机":0, - # "军民一体飞机":0, - # "军用轮船":0, + # "君用飞机":0, + # "君民一体飞机":0, + # "君用轮船":0, # "民用轮船":counts["民用轮船"], # "民用机场":0, - # "军用机场":0, - # "军民一体机场":0, - # "军用港口":0, + # "君用机场":0, + # "君民一体机场":0, + # "君用港口":0, # "民用港口":0, - # "军民一体港口":0 + # "君民一体港口":0 # } # row["总计"] = row["民用轮船"] # rows.append(row) diff --git a/generatorRasterSlicesTools/PredictProcessRasterMJLCPort_AC.py b/generatorRasterSlicesTools/PredictProcessRasterMJLCPort_AC.py index 449bd6c..25c3f7d 100644 --- a/generatorRasterSlicesTools/PredictProcessRasterMJLCPort_AC.py +++ b/generatorRasterSlicesTools/PredictProcessRasterMJLCPort_AC.py @@ -90,7 +90,7 @@ def preProcessShipPortTools(srcFolderPath,targetFolderPath,outTargetFolderPath): # # # 文件接口创建 # MPortFolder=os.path.join(targetFolderPath,"AC-图像预处理","民港口") - # JPortFolder=os.path.join(targetFolderPath,"AC-图像预处理","军港口") + # JPortFolder=os.path.join(targetFolderPath,"AC-图像预处理","君港口") # MJPortFolder=os.path.join(targetFolderPath,"AC-图像预处理","混合港口") # NoPortFolder=os.path.join(targetFolderPath,"AC-图像预处理","无港口") # @@ -105,8 +105,8 @@ def preProcessShipPortTools(srcFolderPath,targetFolderPath,outTargetFolderPath): existOrCreate(outMJPortFolderPath) MLCShapeFilePath=r"D:\TYSAR-德清院\目标点位信息更新\0828目标点位\港口(民船).shp" - JLCShapeFilePath=r"D:\TYSAR-德清院\目标点位信息更新\0828目标点位\军港.shp" - MJLCShapeFilePath=r"D:\TYSAR-德清院\目标点位信息更新\0828目标点位\军民一体港口.shp" + JLCShapeFilePath=r"D:\TYSAR-德清院\目标点位信息更新\0828目标点位\君港.shp" + MJLCShapeFilePath=r"D:\TYSAR-德清院\目标点位信息更新\0828目标点位\君民一体港口.shp" processMJPortflag=processMJPort(srcFolderPath,outMJPortSumTxtPath,outMJPortFolderPath,MLCShapeFilePath,JLCShapeFilePath,MJLCShapeFilePath) diff --git a/generatorRasterSlicesTools/PredictProcessRaster_AC.py b/generatorRasterSlicesTools/PredictProcessRaster_AC.py index e7be32e..cd9be25 100644 --- a/generatorRasterSlicesTools/PredictProcessRaster_AC.py +++ b/generatorRasterSlicesTools/PredictProcessRaster_AC.py @@ -90,7 +90,7 @@ def preProcessShipPortTools(srcFolderPath,targetFolderPath,outTargetFolderPath): # 文件接口创建 MPortFolder=os.path.join(targetFolderPath,"AC-图像预处理","民港口") - JPortFolder=os.path.join(targetFolderPath,"AC-图像预处理","军港口") + JPortFolder=os.path.join(targetFolderPath,"AC-图像预处理","君港口") MJPortFolder=os.path.join(targetFolderPath,"AC-图像预处理","混合港口") NoPortFolder=os.path.join(targetFolderPath,"AC-图像预处理","无港口") @@ -105,8 +105,8 @@ def preProcessShipPortTools(srcFolderPath,targetFolderPath,outTargetFolderPath): existOrCreate(outMJPortFolderPath) MLCShapeFilePath=r"D:\TYSAR-德清院\目标点位信息更新\0828目标点位\港口(民船).shp" - JLCShapeFilePath=r"D:\TYSAR-德清院\目标点位信息更新\0828目标点位\军港.shp" # 数据BM,不公开 - MJLCShapeFilePath=r"D:\TYSAR-德清院\目标点位信息更新\0828目标点位\军民一体港口.shp" + JLCShapeFilePath=r"D:\TYSAR-德清院\目标点位信息更新\0828目标点位\君港.shp" # 数据BM,不公开 + MJLCShapeFilePath=r"D:\TYSAR-德清院\目标点位信息更新\0828目标点位\君民一体港口.shp" processMJPortflag=processMJPort(srcFolderPath,outMJPortSumTxtPath,outMJPortFolderPath,MLCShapeFilePath,JLCShapeFilePath,MJLCShapeFilePath) # 港口归属 diff --git a/generatorRasterSlicesTools/SplitShipPortRasterTools_AC.py b/generatorRasterSlicesTools/SplitShipPortRasterTools_AC.py index 0541e93..3968887 100644 --- a/generatorRasterSlicesTools/SplitShipPortRasterTools_AC.py +++ b/generatorRasterSlicesTools/SplitShipPortRasterTools_AC.py @@ -12,10 +12,10 @@ from pathlib import Path import shutil """ -1. 港口,5000x5000,军港与民港切片, +1. 港口,5000x5000,君港与民港切片, a. 预标注框给他们 b. 重叠率25%重复 - c. 军民2000m 以内,影像抽出来 + c. 君民2000m 以内,影像抽出来 d. 原影像如果只有 1 个港口,-》 港口类型 多 个港口,-》 远近,如果港口距离1000m ,单独拉出来 @@ -269,8 +269,8 @@ def getParams(): parser.add_argument('-o', '--outfilepath',type=str,default=r'D:\TYSAR-德清院\TYSAR-条带模式(SM)\港口\20250903-不分类\A-预处理\JMPort.txt', help='输出geojson文件') parser.add_argument('-f', '--folderOutpath',type=str,help=r'PortfolderOutpath', default=r'D:\TYSAR-德清院\TYSAR-条带模式(SM)\港口\20250903-不分类\A-预处理\PortPoints') parser.add_argument('-m', '--mLC',type=str,help=r'MLC', default=r'D:\TYSAR-德清院\目标点位信息更新\0828目标点位\港口(民船).shp') - parser.add_argument('-j', '--jLC',type=str,help=r'JLC' ,default=r'D:\TYSAR-德清院\目标点位信息更新\0828目标点位\军港.shp') - parser.add_argument('-jm', '--jmlc',type=str,help=r'JMLC', default=r'D:\TYSAR-德清院\目标点位信息更新\0828目标点位\军民一体港口.shp') + parser.add_argument('-j', '--jLC',type=str,help=r'JLC' ,default=r'D:\TYSAR-德清院\目标点位信息更新\0828目标点位\君港.shp') + parser.add_argument('-jm', '--jmlc',type=str,help=r'JMLC', default=r'D:\TYSAR-德清院\目标点位信息更新\0828目标点位\君民一体港口.shp') args = parser.parse_args() return args diff --git a/tools/SpliteShipPort_AA.py b/tools/SpliteShipPort_AA.py index 13530a8..068899c 100644 --- a/tools/SpliteShipPort_AA.py +++ b/tools/SpliteShipPort_AA.py @@ -247,10 +247,10 @@ def getParams(): parser = argparse.ArgumentParser() parser.add_argument('-s','--srcfolder',type=str,default=r'R:\TYSAR-德清院\TYSAR-条带模式(SM)\港口', help='输入shapefile文件') parser.add_argument('-i','--intiffolder',type=str,default=r'D:\TYSAR-德清院\切片结果整理', help='输入shapefile文件') - parser.add_argument('-o', '--outfolder',type=str,default=r'D:\TYSAR-德清院\军民区分结果', help='输出geojson文件') + parser.add_argument('-o', '--outfolder',type=str,default=r'D:\TYSAR-德清院\君民区分结果', help='输出geojson文件') parser.add_argument('-m', '--mLC',type=str,help=r'MLC', default=r'D:\TYSAR-德清院\目标点位信息更新\0828目标点位\港口(民船).shp') - parser.add_argument('-j', '--jLC',type=str,help=r'JLC' ,default=r'D:\TYSAR-德清院\目标点位信息更新\0828目标点位\军港.shp') - parser.add_argument('-jm', '--jmLC',type=str,help=r'MJLC', default=r'D:\TYSAR-德清院\目标点位信息更新\0828目标点位\军民一体港口.shp') + parser.add_argument('-j', '--jLC',type=str,help=r'JLC' ,default=r'D:\TYSAR-德清院\目标点位信息更新\0828目标点位\君港.shp') + parser.add_argument('-jm', '--jmLC',type=str,help=r'MJLC', default=r'D:\TYSAR-德清院\目标点位信息更新\0828目标点位\君民一体港口.shp') args = parser.parse_args() return args