![](https://img-blog.csdnimg.cn/20190918140012416.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
python或者c++简单程序
文件夹及文件操作程序
博观而约取,厚积而薄发
这个作者很懒,什么都没留下…
展开
-
python循环读取写入Excel
【代码】python循环读取写入Excel。原创 2024-03-11 14:37:33 · 515 阅读 · 0 评论 -
labeling在conda虚拟环境下安装使用
下载地址:GitHub - tzutalin/labelImg: ????️ LabelImg is a graphical image annotation tool and label object bounding boxes in imageshttps://github.com/tzutalin/labelImg下载之后可以放在pycharm的工程下,解压在Anaconda Prompt中自行创建虚拟环境conda create -n 虚拟环境名字 python=选择版本使用原创 2021-09-13 09:23:26 · 1992 阅读 · 0 评论 -
关于json.dumps()写入文件时是utf8
json.dumps()中设置ensure_ascii=False,结合open函数中的encoding='utf-8',json.dumps()默认情况下,该函数会自动处理Unicode编码。不要直接在json.dumps()设置encoding='utf-8',原创 2024-01-09 13:30:20 · 1423 阅读 · 0 评论 -
读取程序所在位置
希望在不同目录下调用python程序,不会影响程序中模型的调用。这样无论从哪里调用程序都不会影响程序内部调用外部模型。原创 2024-01-09 17:38:26 · 294 阅读 · 0 评论 -
python中list类型比set用的内存少,但是时间长
记录。原创 2022-07-19 09:27:12 · 233 阅读 · 0 评论 -
删除文件夹中的txt或者其他特定类型文件
import ospath = r''fileFinalName = ''def delTxt(path): lists = os.listdir(path) for file in lists : if file.split('.')[-1] == fileFinalName: os.remove(path+'\\'+file)if __name__ == '__main__': delTxt(path)原创 2021-09-16 17:57:19 · 335 阅读 · 0 评论 -
使用python获取URL图像
使用python获取URL图像。原创 2024-01-09 17:43:11 · 541 阅读 · 0 评论 -
PP-PicoDet注意版面分析模型的结果导出
使用轻量模型PP-PicoDet检测模型实现版面各种类别的检测。原创 2024-02-02 15:02:56 · 465 阅读 · 0 评论 -
文件夹下文件命名脚本
import os#############配置参数################ 功能:# 1、 提供一个二级目录的文件夹,将该文件夹下面的多个子文件夹的名字修改为 文件夹名 + 空格 + 数字编码# 例如 A文件夹下只有文件夹,第一个文件修改为 a 0001.文件后缀# 2、 提供一个一级目录的文件夹,将该文件夹下的文件修改成 文件夹名 + 空格 + 数字编码# 例如 B文件夹下只有文件,第一个文件修改为.原创 2021-09-11 11:16:22 · 380 阅读 · 0 评论 -
关于paddleocr的predict_system按高度顺序画图
关于paddleocr的predict_system按高度顺序画图,(coco格式)原创 2024-01-30 13:45:52 · 472 阅读 · 0 评论 -
python在文件夹中按顺序追加图片
import os#功能: 将A文件夹下的文件移动到B文件夹中,并且按照B中的已有的顺排序###################可修改参数#########################导入目录inputDir = r'D:\测试\1'#加载目录addDir = r'D:\cc\bbb\123\2'#填充总位数num = 5 #必须和addDir中一致#插入点insert = 0 #addDir中如果是从1开始不许要修改,例如 A 0001.文件后缀这个不用修改###.原创 2021-09-11 14:46:45 · 368 阅读 · 0 评论 -
PIL和tensor转换,PIL读取和保存
#读取 img = Image.open("地址") pil = transforms.PILToTensor() # 这里不一样 img = pil(img)#保存 image = img.cpu().clone() image = image.squeeze(0) image = unloader(image) image.save('E:/test0507' + '/' + '图片名称')原创 2022-05-09 14:20:02 · 738 阅读 · 0 评论 -
k-means算法寻找自己的anchor
文件:txt图片后缀是pngimport numpy as npimport jsonimport osfrom PIL import Imagedef iou(box, clusters): """ 计算 IOU param: box: tuple or array, shifted to the origin (i. e. width and height) clusters: numpy array of shape (k,原创 2021-09-22 11:58:55 · 192 阅读 · 0 评论 -
python Excel转xml,json
python Excel转xml,json操作Excel的内容参考: 注意脚本名称不能用xml.py,包括后面的json也不能直接json.py否则容易出错:ModuleNotFoundError: No module named 'xml.etree'; 'xml' is not a package原创 2022-06-02 18:42:10 · 371 阅读 · 0 评论 -
C++ opencv4 批量彩色图转灰度
#include<io.h>#include<iostream>#include<vector>#include<opencv2/opencv.hpp>#include <opencv2\imgproc\types_c.h>using namespace std;using namespace cv;void get_image_names(std::string file_path,std::string root_path.原创 2022-03-14 13:16:25 · 3908 阅读 · 0 评论 -
python在txt文件中指定每一行的下标修改内容
import ospath = r'E:\labels'def alter(file,old_str,new_str): file_data = '' with open(file,'r',encoding='utf8') as f: for line in f: if int(line[0]) == 4: line = '3' + line[1:] file_data += line.原创 2021-10-15 17:09:12 · 287 阅读 · 0 评论 -
文件和文件夹中添加xml中的转义字符
n = ft.find('&') i = 1 while n!=-1: # ft = list(ft) ft = ft[:n]+'&'+ft[n+1:] # ft = str(ft) i = i + 1 n = ft.f..原创 2021-10-08 15:57:38 · 104 阅读 · 0 评论 -
读写数组时去掉[]
x = x.replace('[', '').replace(']', '')原创 2021-10-08 09:45:09 · 406 阅读 · 0 评论