前言
SSDD虽然经典,但是样本太少了,所以论文 LS-SSDD-v1.0: A Deep Learning Dataset Dedicated to Small Ship Detection from Large-Scale Sentinel-1 SAR Images 给出了一个新的数据集LS-SSDD,这个数据集特点是大尺度影像小舰船检测。由15张24,000×16,000大图以及9,000张分割好的800x800小图组成。文件目录如下图所示。
需要注意的是,在ImageSets文件夹中不光给出了训练集和测试集的划分,还给出了专门的近岸(test_inshore.txt)和离岸(test_offshore.txt)测试数据集的划分。便于研究者进行专门的研究。
之前有单独用过里面的近岸测试集进行模型的泛化性分析,所以需要提取一下数据集,这里给出代码,有需要就用。
代码
# 本脚本用来将ImageSets中的训练集,测试集,近海岸测试集,离岸测试集中影像分别提出
import os,shutil
#shutil.copyfile应用,参数必须具体到文件名
def mycopyfile(srcfile,dstfile):
if not os.path.isfile(srcfile):
print("%s not exit!" % (srcfile))
else:
fpath,fname=os.path.split(dstfile)
if not os.path.exists(fpath):
os.makedirs(fpath)
shutil.copyfile(srcfile,dstfile)
#print("copy %s" % (srcfile,dstfile))
with open("ImageSets/Main/test.txt", "r") as f: # 需要什么数据集就引入
dir = f.read().splitlines()
# mycopyfile(srcfile,dstfile)
for i in dir :
src_img_file = 'JPEGImages_sub/' + i + '.jpg'
dst_img_file = 'TestSets/test/JPEGImages/' + i + '.jpg'
src_anno_dir = 'Annotations_sub/' + i + '.xml'
dst_anno_dir = 'TestSets/test/Annotations/' + i + '.xml'
mycopyfile(src_anno_dir, dst_anno_dir)
mycopyfile(src_img_file, dst_img_file)