当前位置:网站首页>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()
边栏推荐
- Beijing Baode & taocloud jointly build the road of information innovation
- Isaccessible() method: use reflection techniques to improve your performance several times
- ML16-神经网络(2)
- 一、网页端文件流的传输
- 迁移学习笔记——Adapting Component Analysis
- [target detection] KL loss: bounding box progression with uncertainty for accurate object detection
- 第一周任务 深度学习和pytorch基础
- torch.nn.Parameter()函数理解
- Continue the new journey and control smart storage together
- [semantic segmentation] setr_ Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformer
猜你喜欢
![[clustmaps] visitor statistics](/img/1a/173664a633fd14ea56696dd824acb6.png)
[clustmaps] visitor statistics

【Transformer】SOFT: Softmax-free Transformer with Linear Complexity

pip安装后仍有解决ImportError: No module named XX

【TensorRT】将 PyTorch 转化为可部署的 TensorRT
![[target detection] 6. SSD](/img/7d/f137ffa4b251360441a9e4ff0f2219.png)
[target detection] 6. SSD

Are you sure you know the interaction problem of activity?

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

Yum local source production

Beijing Baode & taocloud jointly build the road of information innovation
![[pycharm] pycharm remote connection server](/img/b2/a4e1c095343f9e635ff3dad1e3c507.png)
[pycharm] pycharm remote connection server
随机推荐
【Transformer】TransMix: Attend to Mix for Vision Transformers
【卷积核设计】Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs
C connect to SharePoint online webservice
MarkDown简明语法手册
PyTorch中的模型构建
[overview] image classification network
CNOOC, desktop cloud & network disk storage system application case
Analysis on the principle of flow
一、迁移学习与fine-tuning有什么区别?
【语义分割】Fully Attentional Network for Semantic Segmentation
这些你一定要知道的进程知识
clion+opencv+aruco+cmake配置
研究生新生培训第一周:深度学习和pytorch基础
Set automatic build in idea - change the code, and refresh the page without restarting the project
四、One-hot和损失函数的应用
GAN:生成对抗网络 Generative Adversarial Networks
【Transformer】AdaViT: Adaptive Vision Transformers for Efficient Image Recognition
迁移学习——Transfer Joint Matching for Unsupervised Domain Adaptation
Wechat applet source code acquisition (download with tools)
Flink connector Oracle CDC synchronizes data to MySQL in real time (oracle19c)