随笔分类 -  python代码

YOLOv7引入Swin Transformer以及CCNet出现的问题
摘要:YOLOv7引入Swin Transformer以及CCNet出现的问题 一、YOLOv7训练完,运行test.py的时候出现:RuntimeError: expected scalar type Float but found Half 错误 采用GPU训练时出现的问题! 解决方案: 将test. 阅读全文
posted @ 2023-03-28 21:00 DLst_liu 阅读(1161) 评论(0) 推荐(0)
Python 批量更改图片后缀
摘要:Python 批量更改图片后缀 import os file_path = r"E:\DATASET\Mine_Helmet\images\val_hou\val" files = os.listdir(file_path) for file in files: if file.endswith(' 阅读全文
posted @ 2022-11-18 09:44 DLst_liu 阅读(80) 评论(0) 推荐(0)
Python 读取图片的位置写入txt
摘要:import os saveBasePath = r'E:\Mine_personnel' # 存放txt文件的地址 jpgfilepath = r'E:\Mine_personnel\images\val' # jpg图片的地址 ftest = open(os.path.join(saveBase 阅读全文
posted @ 2022-11-08 09:58 DLst_liu 阅读(191) 评论(0) 推荐(0)
Python 绘制曲线、标注最值(坐标)
摘要:Python 绘制曲线、标注最值(坐标) 一、建立excel文件 二、代码 对于含有曲线、最值标注、最值坐标、箭头。 import matplotlib.pyplot as plt import pandas as pd plt.rcParams['font.sans-serif']=['SimHe 阅读全文
posted @ 2022-10-24 14:57 DLst_liu 阅读(1325) 评论(0) 推荐(0)
python 将图片转换成RGB
摘要:python 将图片转换成RGB import os from PIL import Image # 填入图片所在文件夹的路径 img_path = 'E:\chengxu\CV\dataset_hat_person\hat' # 获取该路径下的图片 img_all = os.listdir(img 阅读全文
posted @ 2022-07-30 10:37 DLst_liu 阅读(784) 评论(0) 推荐(0)
利用python 在txt中添加指定内容
摘要:利用python 在txt中添加指定内容 一、原txt的内容 二、添加内容后的txt 三、代码 import os # 文件夹的路径 scr = 'E:\DATASET\Main' # 获取文件夹下的txt的文件名 fs = os.listdir(scr) print(fs) for fz in f 阅读全文
posted @ 2022-07-27 16:48 DLst_liu 阅读(1356) 评论(0) 推荐(0)
利用Python寻找两个文件夹下不相同的文件
摘要:找不同.txt 由于在打标签的时候,有些图像可能不存在标签,因此导出.txt文件可能缺少该标签的文件,而images下又存在该图片。可通过python寻找未打标签的文件。 images = 1116 labels = 1113 打标签的时候,有三张图片没有标签,因此images多出三个文件,可通过p 阅读全文
posted @ 2022-07-20 10:45 DLst_liu 阅读(365) 评论(0) 推荐(0)