加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
util-generate_gt_labels.py 955 Bytes
一键复制 编辑 原始数据 按行查看 历史
椰子奶糖 提交于 2022-03-31 10:07 . init
import cv2
import numpy as np
import os
from shutil import copyfile
from sys import exit
train_txt = "../data/ImageSets/train.txt"
trainval_txt = "../data/ImageSets/trainval.txt"
test_txt = "../data/ImageSets/test.txt"
val_txt = "../data/ImageSets/val.txt"
dir_txt = "model/ship_gt/labels/"
# save_dir_ = "model/ship_gt/labels_test/"
save_dir_ = "model/ship_gt/labels_train/"
source_dir = "model/ship_gt/labels_int/"
name_list = []
# with open(test_txt, 'r') as fr:
with open(train_txt, 'r') as fr:
for line in fr.readlines():
name_list.append(line.split('\n')[0])
source = '{}{}.txt'.format(source_dir,line.split('\n')[0])
target = '{}{}.txt'.format(save_dir_,line.split('\n')[0])
try:
copyfile(source, target)
except IOError as e:
print("Unable to copy file. %s" % e)
exit(1)
except:
print("Unexpected error:", sys.exc_info())
exit(1)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化