当前位置:网站首页>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()
边栏推荐
- 有价值的博客、面经收集(持续更新)
- 【Transformer】AdaViT: Adaptive Vision Transformers for Efficient Image Recognition
- 【Transformer】SOFT: Softmax-free Transformer with Linear Complexity
- [semantic segmentation] full attention network for semantic segmentation
- [semantic segmentation] Introduction to mapillary dataset
- 【Transformer】AdaViT: Adaptive Tokens for Efficient Vision Transformer
- 四、One-hot和损失函数的应用
- ML17-神经网络实战
- 个人学习网站
- 【图像分类】如何使用 mmclassification 训练自己的分类模型
猜你喜欢

Jianzhi core taocloud full flash SDS helps build high-performance cloud services

Anr Optimization: cause oom crash and corresponding solutions

fastText学习——文本分类
![[image classification] how to use mmclassification to train your classification model](/img/98/f8536bc4c6a291a028a0c4227653ee.png)
[image classification] how to use mmclassification to train your classification model

Reporting service 2016 custom authentication

迁移学习——Transitive Transfer Learning

The differences and reasons between MySQL with and without quotation marks when querying string types

【语义分割】Fully Attentional Network for Semantic Segmentation

【综述】图像分类网络

一、Focal Loss理论及代码实现
随机推荐
五、图像像素统计
Discussion on the design of distributed full flash memory automatic test platform
Android studio login registration - source code (connect to MySQL database)
一、multiprocessing.pool.RemoteTraceback
ML8自学笔记-LDA原理公式推导
第三周周报 ResNet+ResNext
Technology that deeply understands the principle of MMAP and makes big manufacturers love it
Wechat applet source code acquisition (download with tools)
[overview] image classification network
MarkDown简明语法手册
Improve quality with intelligence financial imaging platform solution
How to perform POC in depth with full flash distribution?
PyTorch中的模型构建
【Transformer】ACMix:On the Integration of Self-Attention and Convolution
Spring, summer, autumn and winter with Miss Zhang (3)
六、基于深度学习关键点的指针式表计识别
[DL] build convolutional neural network for regression prediction (detailed tutorial of data + code)
Spring, summer, autumn and winter with Miss Zhang (1)
ROS教程(Xavier)
GAN:生成对抗网络 Generative Adversarial Networks