当前位置:网站首页>1、 Combine multiple txt files into one TXT file
1、 Combine multiple txt files into one TXT file
2022-07-29 06:08:00 【My hair is messy】
Project scenario :
Mainly complete OCR Before training ,dataset Need to load lmdb File format .
Problem description :
Go straight to the code , It's easy to see :
#@Override
import os
def Combine_txt():
dirpath = r"E:\enducate\test_paper\Train_code\txt1111"
files = os.listdir(dirpath)
res = ""
for file in files:
if file.endswith(".txt"):
name = file[:-3] + "png"
img_path = os.path.join(dirpath, name)
txtpath = os.path.join(dirpath, file)
with open(txtpath, "r", encoding="utf-8") as file:
content = file.read()
text = img_path + "\t" + content
file.close()
input = "%s\n" % (text)
res += input
outpath = r'E:\enducate\test_paper\Train_code\output.txt'
with open(outpath, "a", encoding="utf-8") as outfile:
outfile.write(res)
outfile.close()
print(len(res))
if __name__ == '__main__':
Combine_txt()
边栏推荐
- 【CV】请问卷积核(滤波器)3*3、5*5、7*7、11*11 都是具体什么数?
- torch.nn.Parameter()函数理解
- [CV] what are the specific numbers of convolution kernels (filters) 3*3, 5*5, 7*7 and 11*11?
- 【Transformer】ATS: Adaptive Token Sampling For Efficient Vision Transformers
- ROS教程(Xavier)
- [DL] build convolutional neural network for regression prediction (detailed tutorial of data + code)
- CNOOC, desktop cloud & network disk storage system application case
- 【DL】搭建卷积神经网络用于回归预测(数据+代码详细教程)
- 二、OCR训练时,将txt文件和图片数据转为lmdb文件格式
- 二、深度学习数据增强方法汇总
猜你喜欢

ML15-神经网络(1)

迁移学习笔记——Adapting Component Analysis

Technology that deeply understands the principle of MMAP and makes big manufacturers love it

Is flutter being quietly abandoned? On the future of flutter
![[semantic segmentation] setr_ Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformer](/img/aa/daccb45d5b6d4a3f7e8517dd5bd7d2.png)
[semantic segmentation] setr_ Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformer
![[tensorrt] convert pytorch into deployable tensorrt](/img/56/81d641b494cf8b02ff77246c2207db.png)
[tensorrt] convert pytorch into deployable tensorrt

性能优化之趣谈线程池:线程开的越多就越好吗?

四、One-hot和损失函数的应用

anaconda中移除旧环境、增加新环境、查看环境、安装库、清理缓存等操作命令

PyTorch基础知识(可入门)
随机推荐
Valuable blog and personal experience collection (continuous update)
Chongqing Avenue cloud bank, as a representative of the software industry, was invited to participate in the signing ceremony of key projects in Yuzhong District
【Transformer】TransMix: Attend to Mix for Vision Transformers
Jianzhi core taocloud full flash SDS helps build high-performance cloud services
Anr Optimization: cause oom crash and corresponding solutions
一、multiprocessing.pool.RemoteTraceback
【Clustrmaps】访客统计
三、如何搞自定义数据集?
Ffmpeg creation GIF expression pack tutorial is coming! Say thank you, brother black fly?
MarkDown简明语法手册
【Transformer】ACMix:On the Integration of Self-Attention and Convolution
[image classification] how to use mmclassification to train your classification model
【Transformer】AdaViT: Adaptive Vision Transformers for Efficient Image Recognition
一、网页端文件流的传输
【比赛网站】收集机器学习/深度学习比赛网站(持续更新)
[target detection] 6. SSD
【语义分割】SETR_Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformer
Nifi changed UTC time to CST time
[overview] image classification network
[semantic segmentation] setr_ Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformer