![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
工具
脸不大的CVer
这个作者很懒,什么都没留下…
展开
-
【工具】 python 四个坐标点顺时针
四点顺时针def clockwise(self, pts): ''' sort points by clockwise ''' pts = np.array(pts) sort_x = pts[np.argsort(pts[:, 0]), :] Left = sort_x[:2, :] Right = sort_x[2:, :] # Left sort Left = Left[np.argsort(Left[:,1])[::-1], :]原创 2021-10-14 13:49:03 · 1089 阅读 · 0 评论 -
【工具】python 按照比例划分训练测试集
import shutilfrom glob import globimport osimport randomfrom tqdm import tqdmpath1 = "path1" #数据路径paths = sorted(glob(path1+"/*.jpg"))savepath = "test"os.makedirs(savepath,exist_ok=True)testpaths = random.sample(paths, int(len(paths)*0.2))for pa原创 2021-11-26 11:39:24 · 542 阅读 · 0 评论 -
【工具】python 分标注任务
分标注任务import shutilfrom glob import globimport osfrom tqdm import tqdmpath1 = "path1" #数据路径num = 3 #分成几份paths = sorted(glob(path1+"/*.jpg"))each_nums = int(len(paths)/num)for i in tqdm(range(num)): savepath = "%d"%i os.makedirs(savepath,e原创 2021-11-26 11:34:22 · 193 阅读 · 0 评论 -
【工具】python 文件重命名
python 文件重命名from glob import globimport osfrom tqdm import tqdmimgpaths = sorted(glob("path/*.jpg"))for i, imgpath in enumerate(tqdm(imgpaths)): txtpath = imgpath.replace(".jpg",".txt") srcname = imgpath.split("/")[-1].split(".")[0] newn原创 2021-11-26 10:55:10 · 385 阅读 · 0 评论 -
【工具】python json、字典 格式化显示,中文编码
在代码调试的时候print 字典格式数据时,总是输出成一行,同时解决中文编码问题import jsonoutputdic = json.dumps(outputdic, sort_keys=True, indent=4, ensure_ascii=False, separators=(',', ':'))原创 2021-11-18 15:03:43 · 847 阅读 · 0 评论