当前位置:网站首页>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()
边栏推荐
- ML15-神经网络(1)
- 虚假新闻检测论文阅读(四):A novel self-learning semi-supervised deep learning network to detect fake news on...
- Error in installing pyspider under Windows: Please specify --curl dir=/path/to/build/libcurl solution
- Interesting talk about performance optimization thread pool: is the more threads open, the better?
- 【Transformer】AdaViT: Adaptive Vision Transformers for Efficient Image Recognition
- ML16-神经网络(2)
- 研究生新生培训第二周:卷积神经网络基础
- 第三周周报 ResNet+ResNext
- 第2周学习:卷积神经网络基础
- 【Transformer】TransMix: Attend to Mix for Vision Transformers
猜你喜欢

【语义分割】SETR_Rethinking Semantic Segmentation from a Sequence-to-Sequence Perspective with Transformer

一、常见损失函数的用法

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

【Transformer】ACMix:On the Integration of Self-Attention and Convolution

一、Focal Loss理论及代码实现

ROS教程(Xavier)

ABSA1: Attentional Encoder Network for Targeted Sentiment Classification

How to perform POC in depth with full flash distribution?
![[semantic segmentation] Introduction to mapillary dataset](/img/3d/49b1b6007c1f97b1ba8ac438097590.png)
[semantic segmentation] Introduction to mapillary dataset
![[pycharm] pycharm remote connection server](/img/b2/a4e1c095343f9e635ff3dad1e3c507.png)
[pycharm] pycharm remote connection server
随机推荐
三、如何读取视频?
【Transformer】ATS: Adaptive Token Sampling For Efficient Vision Transformers
Spring, summer, autumn and winter with Miss Zhang (1)
"Full flash measurement" database acceleration solution
一、PyTorch Cookbook(常用代码合集)
C # judge whether the user accesses by mobile phone or computer
ROS教程(Xavier)
个人学习网站
Reporting service 2016 custom authentication
ML11-SKlearn实现支持向量机
【CV】请问卷积核(滤波器)3*3、5*5、7*7、11*11 都是具体什么数?
虚假新闻检测论文阅读(一):Fake News Detection using Semi-Supervised Graph Convolutional Network
Spring, summer, autumn and winter with Miss Zhang (3)
【综述】图像分类网络
Flink connector Oracle CDC synchronizes data to MySQL in real time (oracle19c)
tensorflow中tf.get_variable()函数详解
Flink, the mainstream real-time stream processing computing framework, is the first experience.
【Transformer】SegFormer:Simple and Efficient Design for Semantic Segmentation with Transformers
[go] use of defer
【卷积核设计】Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs