iis服务器助手广告广告
返回顶部
首页 > 资讯 > 后端开发 > Python >Tensorflow中TFRecord生成与读取的实现
  • 448
分享到

Tensorflow中TFRecord生成与读取的实现

2024-04-02 19:04:59 448人浏览 薄情痞子

Python 官方文档:入门教程 => 点击学习

摘要

目录一、为什么使用TFRecord?二、 生成TFRecord简单实现方式三、 生成TFRecord文件完整代码实例TFRecord读取四、 读取TFRecord的简单实现方式五、t

一、为什么使用TFRecord?

正常情况下我们训练文件夹经常会生成 train, test 或者val文件夹,这些文件夹内部往往会存着成千上万的图片或文本等文件,这些文件被散列存着,这样不仅占用磁盘空间,并且再被一个个读取的时候会非常慢,繁琐。占用大量内存空间(有的大型数据不足以一次性加载)。此时我们TFRecord格式的文件存储形式会很合理的帮我们存储数据。TFRecord内部使用了“Protocol Buffer”二进制数据编码方案,它只占用一个内存块,只需要一次性加载一个二进制文件的方式即可,简单,快速,尤其对大型训练数据很友好。而且当我们的训练数据量比较大的时候,可以将数据分成多个TFRecord文件,来提高处理效率。

二、 生成TFRecord简单实现方式

我们可以分成两个部分来介绍如何生成TFRecord,分别是TFRecord生成器以及样本Example模块。

  • TFRecord生成器
writer = tf.python_io.TFRecordWriter(record_path)
writer.write(tf_example.SerializeToString())
writer.close()

这里面writer就是我们TFrecord生成器。接着我们就可以通过writer.write(tf_example.SerializeToString())来生成我们所要的tfrecord文件了。这里需要注意的是我们TFRecord生成器在写完文件后需要关闭writer.close()。这里tf_example.SerializeToString()是将Example中的map压缩为二进制文件,更好的节省空间。那么tf_example是如何生成的呢?那就是下面所要介绍的样本Example模块了。

  • Example模块
    首先们来看一下Example协议块是什么样子的。
message Example {
  Features features = 1;
};

message Features {
  map<string, Feature> feature = 1;
};

message Feature {
  oneof kind {
    BytesList bytes_list = 1;
    FloatList float_list = 2;
    Int64List int64_list = 3;
  }
};

我们可以看出上面的tf_example可以写入的数据形式有三种,分别是BytesList, FloatList以及Int64List的类型。那我们如何写一个tf_example呢?下面有一个简单的例子。

def int64_feature(value):
    return tf.train.Feature(int64_list=tf.train.Int64List(value=[value]))

def bytes_feature(value):
    return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))

tf_example = tf.train.Example(
        features=tf.train.Features(feature={
            'image/encoded': bytes_feature(encoded_jpg),
            'image/fORMat': bytes_feature('jpg'.encode()),
            'image/class/label': int64_feature(label),
            'image/height': int64_feature(height),
            'image/width': int64_feature(width)}))

下面我们来好好从外部往内部分解来解释一下上面的内容。
(1)tf.train.Example(features = None) 这里的features是tf.train.Features类型的特征实例。
(2)tf.train.Features(feature = None) 这里的feature是以字典的形式存在,*key:要保存数据的名字    value:要保存的数据,但是格式必须符合tf.train.Feature实例要求。

三、 生成TFRecord文件完整代码实例

首先我们需要提供数据集

图片文件夹

通过图片文件夹我们可以知道这里面总共有七种分类图片,类别的名称就是每个文件夹名称,每个类别文件夹存储各自的对应类别的很多图片。下面我们通过一下代码(generate_annotation_JSON.pygenerate_tfrecord.py)生成train.record。

  • generate_annotation_json.py
# -*- coding: utf-8 -*-
# @Time    : 2018/11/22 22:12
# @Author  : MaochengHu
# @Email   : wojiaohumaocheng@gmail.com
# @File    : generate_annotation_json.py
# @Software: PyCharm

import os
import json


def get_annotation_dict(input_folder_path, Word2number_dict):
    label_dict = {}
    father_file_list = os.listdir(input_folder_path)
    for father_file in father_file_list:
        full_father_file = os.path.join(input_folder_path, father_file)
        son_file_list = os.listdir(full_father_file)
        for image_name in son_file_list:
            label_dict[os.path.join(full_father_file, image_name)] = word2number_dict[father_file]
    return label_dict


def save_json(label_dict, json_path):
    with open(json_path, 'w') as json_path:
        json.dump(label_dict, json_path)
    print("label json file has been generated successfully!")
  • generate_tfrecord.py
# -*- coding: utf-8 -*-
# @Time    : 2018/11/23 0:09
# @Author  : MaochengHu
# @Email   : wojiaohumaocheng@gmail.com
# @File    : generate_tfrecord.py
# @Software: PyCharm

import os
import Tensorflow as tf
import io
from PIL import Image
from generate_annotation_json import get_annotation_dict

flags = tf.app.flags
flags.DEFINE_string('images_dir',
                    '/data2/raycloud/jingxiong_datasets/six_classes/images',
                    'Path to image(directory)')
flags.DEFINE_string('annotation_path',
                     '/data1/humaoc_file/classify/data/annotations/annotations.json',
                    'Path to annotation')
flags.DEFINE_string('record_path',
                    '/data1/humaoc_file/classify/data/train_tfrecord/train.record',
                    'Path to TFRecord')
FLAGS = flags.FLAGS


def int64_feature(value):
    return tf.train.Feature(int64_list=tf.train.Int64List(value=[value]))


def bytes_feature(value):
    return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))


def process_image_channels(image):
    process_flag = False
    # process the 4 channels .png
    if image.mode == 'RGBA':
        r, g, b, a = image.split()
        image = Image.merge("RGB", (r,g,b))
        process_flag = True
    # process the channel image
    elif image.mode != 'RGB':
        image = image.convert("RGB")
        process_flag = True
    return image, process_flag


def process_image_reshape(image, resize):
    width, height = image.size
    if resize is not None:
        if width > height:
             width = int(width * resize / height)
             height = resize
        else:
            width = resize
            height = int(height * resize / width)
        image = image.resize((width, height), Image.ANTIALIAS)
    return image


def create_tf_example(image_path, label, resize=None):
    with tf.gfile.GFile(image_path, 'rb') as fid:
        encode_jpg = fid.read()
    encode_jpg_io = io.BytesIO(encode_jpg)
    image = Image.open(encode_jpg_io)
    # process png pic with four channels 
    image, process_flag = process_image_channels(image)
    # reshape image
    image = process_image_reshape(image, resize)
    if process_flag == True or resize is not None:
        bytes_io = io.BytesIO()
        image.save(bytes_io, format='JPEG')
        encoded_jpg = bytes_io.getvalue()
    width, height = image.size
    tf_example = tf.train.Example(
        features=tf.train.Features(
            feature={
                'image/encoded': bytes_feature(encode_jpg),
                'image/format': bytes_feature(b'jpg'),
                'image/class/label': int64_feature(label),
                'image/height': int64_feature(height),
                'image/width': int64_feature(width)
            }
        ))
    return tf_example


def generate_tfrecord(annotation_dict, record_path, resize=None):
    num_tf_example = 0
    writer = tf.Python_io.TFRecordWriter(record_path)
    for image_path, label in annotation_dict.items():
        if not tf.gfile.GFile(image_path):
            print("{} does not exist".format(image_path))
        tf_example = create_tf_example(image_path, label, resize)
        writer.write(tf_example.SerializeToString())
        num_tf_example += 1
        if num_tf_example % 100 == 0:
            print("Create %d TF_Example" % num_tf_example)
    writer.close()
    print("{} tf_examples has been created successfully, which are saved in {}".format(num_tf_example, record_path))


def main(_):
    word2number_dict = {
        "combinations": 0,
        "details": 1,
        "sizes": 2,
        "tags": 3,
        "models": 4,
        "tileds": 5,
        "hangs": 6
    }
    images_dir = FLAGS.images_dir
    #annotation_path = FLAGS.annotation_path
    record_path = FLAGS.record_path
    annotation_dict = get_annotation_dict(images_dir, word2number_dict)
    generate_tfrecord(annotation_dict, record_path)


if __name__ == '__main__':
    tf.app.run()

* 这里需要说明的是generate_annotation_json.py是为了得到图片标注的label_dict。通过这个代码块可以获得我们需要的图片标注字典,key是图片具体地址, value是图片的类别,具体实例如下:

{
"/images/hangs/862e67a8-5bd9-41f1-8c6d-876a3cb270df.JPG": 6, 
"/images/tags/adc264af-a76b-4477-9573-ac6c435decab.JPG": 3, 
"/images/tags/fd231f5a-b42c-43ba-9e9d-4abfbaf38853.JPG": 3, 
"/images/hangs/2e47d877-1954-40d6-bfa2-1b8e3952ebf9.jpg": 6, 
"/images/tileds/a07beddc-4b39-4865-8ee2-017e6c257e92.png": 5,
 "/images/models/642015c8-f29d-4930-b1a9-564f858c40e5.png": 4
}
  • 如何运行代码

(1)首先我们的文件夹构成形式是如下结构,其中images_root是图片根文件夹,combinations, details, sizes, tags, models, tileds, hangs分别存放不同类别的图片文件夹。

-<images_root>
   -<combinations>
      -图片.jpg
   -<details>
      -图片.jpg
   -<sizes>
      -图片.jpg
   -<tags>
      -图片.jpg
   -<models>
      -图片.jpg
   -<tileds>
      -图片.jpg
   -<hangs>
      -图片.jpg

(2)建立文件夹TFRecord,并将generate_tfrecord.pygenerate_annotation_json.py这两个python文件放入文件夹内,需要注意的是我们需要将 generate_tfrecord.py文件中字典word2number_dict换成自己的字典(即key是放不同类别的图片文件夹名称,value是对应的分类number)

    word2number_dict = { 
        "combinations": 0,
        "details": 1,
        "sizes": 2,
        "tags": 3,
        "models": 4,
        "tileds": 5,
        "hangs": 6
    }

(3)直接执行代码 python3/python2 ./TFRecord/generate_tfrecord.py --image_dir="images_root地址" --record_path="你想要保存record地址(.record文件全路径)"即可。如下是一个实例:

python3 generate_tfrecord.py --image_dir /images/ --record_path /classify/data/train_tfrecord/train.record

TFRecord读取

上面我们介绍了如何生成TFRecord,现在我们尝试如何通过使用队列读取读取我们的TFRecord。
读取TFRecord可以通过tensorflow两个个重要的函数实现,分别是tf.train.string_input_producertf.TFRecordReadertf.parse_single_example解析器。如下图

AnimatedFileQueues.gif

四、 读取TFRecord的简单实现方式

解析TFRecord有两种解析方式一种是利用tf.parse_single_example, 另一种是通过tf.contrib.slim(* 推荐使用)。

 第一种方式(tf.parse_single_example)解析步骤如下

(1).第一步,我们将train.record文件读入到队列中,如下所示:
filename_queue = tf.train.string_input_producer([tfrecords_filename])

(2) 第二步,我们需要通过TFRecord将生成的队列读入

reader = tf.TFRecordReader()
 _, serialized_example = reader.read(filename_queue) #返回文件名和文件

(3)第三步, 通过解析器tf.parse_single_example将我们的example解析出来。

第二种方式(tf.contrib.slim)解析步骤如下

(1) 第一步, 我们要设置decoder = slim.tfexample_decoder.TFExampleDecoder(keys_to_features, items_to_handlers), 其中key_to_features这个字典需要和TFrecord文件中定义的字典项匹配,items_to_handlers中的关键字可以是任意值,但是它的handler的初始化参数必须要来自于keys_to_features中的关键字。

(2) 第二步, 我们要设定dataset = slim.dataset.Dataset(params), 其中params包括:
a. data_source: 为tfrecord文件地址
b. reader: 一般设置为tf.TFRecordReader阅读器
c. decoder: 为第一步设置的decoder
d. num_samples: 样本数量
e. items_to_description: 对样本及标签的描述
f. num_classes: 分类的数量

(3) 第三步, 我们设置provider = slim.dataset_data_provider.DatasetDataProvider(params), 其中params包括 :
a. dataset: 第二步骤我们生成的数据集
b. num_reader: 并行阅读器数量
c. shuffle: 是否打乱
d. num_epochs:每个数据源被读取的次数,如果设为None数据将会被无限循环的读取
e. common_queue_capacity:读取数据队列的容量,默认为256
f. scope:范围
g. common_queue_min:读取数据队列的最小容量。

(4) 第四步, 我们可以通过provider.get得到我们需要的数据了。

3. 对不同图片大小的TFRecord读取并resize成相同大小reshape_same_size函数来对图片进行resize,这样我们可以对我们的图片进行batch操作了,因为有的神经网络训练需要一个batch一个batch操作,不同大小的图片在组成一个batch的时候会报错,因此我们我通过后期处理可以更好的对图片进行batch操作。
或者直接通过resized_image = tf.squeeze(tf.image.resize_bilinear([image], size=[FLAG.resize_height, FLAG.resize_width]))即可。

五、tf.contrib.slim模块读取TFrecord文件完整代码实例

# -*- coding: utf-8 -*-
# @Time    : 2018/12/1 11:06
# @Author  : MaochengHu
# @Email   : wojiaohumaocheng@gmail.com
# @File    : read_tfrecord.py
# @Software: PyCharm
import os
import tensorflow as tf

flags = tf.app.flags
flags.DEFINE_string('tfrecord_path', '/data1/humaoc_file/classify/data/train_tfrecord/train.record', 'path to tfrecord file')
flags.DEFINE_integer('resize_height', 800, 'resize height of image')
flags.DEFINE_integer('resize_width', 800, 'resize width of image')
FLAG = flags.FLAGS
slim = tf.contrib.slim


def print_data(image, resized_image, label, height, width):
    with tf.Session() as sess:
        init_op = tf.global_variables_initializer()
        sess.run(init_op)
        coord = tf.train.Coordinator()
        threads = tf.train.start_queue_runners(coord=coord)
        for i in range(10):
            print("______________________image({})___________________".format(i))
            print_image, print_resized_image, print_label, print_height, print_width = sess.run([image, resized_image, label, height, width])
            print("resized_image shape is: ", print_resized_image.shape)
            print("image shape is: ", print_image.shape)
            print("image label is: ", print_label)
            print("image height is: ", print_height)
            print("image width is: ", print_width)
        coord.request_stop()
        coord.join(threads)

def reshape_same_size(image, output_height, output_width):
    """Resize images by fixed sides.
    
    Args:
        image: A 3-D image `Tensor`.
        output_height: The height of the image after preprocessing.
        output_width: The width of the image after preprocessing.

    Returns:
        resized_image: A 3-D tensor containing the resized image.
    """
    output_height = tf.convert_to_tensor(output_height, dtype=tf.int32)
    output_width = tf.convert_to_tensor(output_width, dtype=tf.int32)

    image = tf.expand_dims(image, 0)
    resized_image = tf.image.resize_nearest_neighbor(
        image, [output_height, output_width], align_corners=False)
    resized_image = tf.squeeze(resized_image)
    return resized_image


def read_tfrecord(tfrecord_path, num_samples=14635, num_classes=7, resize_height=800, resize_width=800):
    keys_to_features = {
        'image/encoded': tf.FixedLenFeature([], default_value='', dtype=tf.string,),
        'image/format': tf.FixedLenFeature([], default_value='jpeg', dtype=tf.string),
        'image/class/label': tf.FixedLenFeature([], tf.int64, default_value=0),
        'image/height': tf.FixedLenFeature([], tf.int64, default_value=0),
        'image/width': tf.FixedLenFeature([], tf.int64, default_value=0)
    }

    items_to_handlers = {
        'image': slim.tfexample_decoder.Image(image_key='image/encoded', format_key='image/format', channels=3),
        'label': slim.tfexample_decoder.Tensor('image/class/label', shape=[]),
        'height': slim.tfexample_decoder.Tensor('image/height', shape=[]),
        'width': slim.tfexample_decoder.Tensor('image/width', shape=[])
    }
    decoder = slim.tfexample_decoder.TFExampleDecoder(keys_to_features, items_to_handlers)

    labels_to_names = None
    items_to_descriptions = {
        'image': 'An image with shape image_shape.',
        'label': 'A single integer between 0 and 9.'}

    dataset = slim.dataset.Dataset(
        data_sources=tfrecord_path,
        reader=tf.TFRecordReader,
        decoder=decoder,
        num_samples=num_samples,
        items_to_descriptions=None,
        num_classes=num_classes,
    )

    provider = slim.dataset_data_provider.DatasetDataProvider(dataset=dataset,
                                                              num_readers=3,
                                                              shuffle=True,
                                                              common_queue_capacity=256,
                                                              common_queue_min=128,
                                                              seed=None)
    image, label, height, width = provider.get(['image', 'label', 'height', 'width'])
    resized_image = tf.squeeze(tf.image.resize_bilinear([image], size=[resize_height, resize_width]))
    return resized_image, label, image, height, width




def main():
    resized_image, label, image, height, width = read_tfrecord(tfrecord_path=FLAG.tfrecord_path,
                                                               resize_height=FLAG.resize_height,
                                                               resize_width=FLAG.resize_width)
    #resized_image = reshape_same_size(image, FLAG.resize_height, FLAG.resize_width)
    #resized_image = tf.squeeze(tf.image.resize_bilinear([image], size=[FLAG.resize_height, FLAG.resize_width]))
    print_data(image, resized_image, label, height, width)
  


if __name__ == '__main__':
    main()

代码运行方式

python3 read_tfrecord.py --tfrecord_path /data1/humaoc_file/classify/data/train_tfrecord/train.record --resize_height 800 --resize_width 800

最终我们可以看到我们读取文件的部分内容:

______________________image(0)___________________
resized_image shape is:  (800, 800, 3)
image shape is:  (2000, 1333, 3)
image label is:  5
image height is:  2000
image width is:  1333
______________________image(1)___________________
resized_image shape is:  (800, 800, 3)
image shape is:  (667, 1000, 3)
image label is:  0
image height is:  667
image width is:  1000
______________________image(2)___________________
resized_image shape is:  (800, 800, 3)
image shape is:  (667, 1000, 3)
image label is:  3
image height is:  667
image width is:  1000
______________________image(3)___________________
resized_image shape is:  (800, 800, 3)
image shape is:  (800, 800, 3)
image label is:  5
image height is:  800
image width is:  800
______________________image(4)___________________
resized_image shape is:  (800, 800, 3)
image shape is:  (1424, 750, 3)
image label is:  0
image height is:  1424
image width is:  750
______________________image(5)___________________
resized_image shape is:  (800, 800, 3)
image shape is:  (1196, 1000, 3)
image label is:  6
image height is:  1196
image width is:  1000
______________________image(6)___________________
resized_image shape is:  (800, 800, 3)
image shape is:  (667, 1000, 3)
image label is:  5
image height is:  667
image width is:  1000

参考:

[1] TensorFlow 自定义生成 .record 文件

[2] TensorFlow基础5:TFRecords文件的存储与读取讲解及代码实现

[3] Slim读取TFrecord文件

[4] Tensorflow针对不定尺寸的图片读写tfrecord文件总结

到此这篇关于Tensorflow中TFRecord生成与读取的实现的文章就介绍到这了,更多相关Tensorflow TFRecord生成与读取内容请搜索编程网以前的文章或继续浏览下面的相关文章希望大家以后多多支持编程网!

--结束END--

本文标题: Tensorflow中TFRecord生成与读取的实现

本文链接: https://www.lsjlt.com/news/117742.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • Tensorflow中TFRecord生成与读取的实现
    目录一、为什么使用TFRecord二、 生成TFRecord简单实现方式三、 生成TFRecord文件完整代码实例TFRecord读取四、 读取TFRecord的简单实现方式五、tf...
    99+
    2024-04-02
  • tensorflow学习笔记之tfrecord文件的生成与读取
    训练模型时,我们并不是直接将图像送入模型,而是先将图像转换为tfrecord文件,再将tfrecord文件送入模型。为进一步理解tfrecord文件,本例先将6幅图像及其标签转换为t...
    99+
    2024-04-02
  • 怎么在tensorflow中读取tfrecord文件
    今天就跟大家聊聊有关怎么在tensorflow中读取tfrecord文件,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。生成tfrecord文件import osimport...
    99+
    2023-06-14
  • python中怎么使用tensorflow实现数据下载与读取
    本篇内容介绍了“python中怎么使用tensorflow实现数据下载与读取”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!一、mnist数据...
    99+
    2023-07-02
  • python读取mat文件生成h5文件的实现
    目录读取mat文件生成h5文件1. Matlab生成 .mat 文件2. 读取 .mat 文件读取mat文件 基于h5py库两种数据结构读取代码读取mat文件生成h5文件 1. Ma...
    99+
    2024-04-02
  • Python读取Excel数据实现批量生成PPT
    目录背景需求准备PPT数据PPT模板实战导入相关模块读取电影数据读取PPT模板插入数据背景 大家好,我是J哥。 我们常常面临着大量的重复性工作,通过人工方式处理往往耗时耗力易出错。而...
    99+
    2024-04-02
  • Java中二维码生成及读取的高效实现方法。
    Java中二维码生成及读取的高效实现方法 二维码已经成为现代生活中不可或缺的一部分,它们被用于各种场景,例如支付、身份验证等。在Java中,我们可以使用多种库来生成和读取二维码。在本文中,我们将介绍一些高效的实现方法,包括如何使用ZXing...
    99+
    2023-10-22
    numy 二维码 并发
  • C#实现读取txt文件生成Word文档
    目录dll文件安装(3种方法)读取txt生成Word注意事项总结本文将以C#程序代码为例介绍如何来读取txt文件中的内容,生成Word文档。在编辑代码前,可参考如下代码环境进行配置:...
    99+
    2024-04-02
  • Python读取Excel数据实现批量生成合同
    目录一、背景二、准备三、实战1.安装相关库2.读取合同数据3.批量合同生成大家好,我是J哥。 在我们的工作中,面临着大量的重复性工作,通过人工方式处理往往耗时耗力易出错。而Pytho...
    99+
    2024-04-02
  • node.js生成与读取csv文件方法详解
    nodejs使用object-to-CSV库生成csv文件 object-to-CSV是一个非常棒的库,可以使用nodejs将对象数组快速写入CSV文件。 当然,还有许多其他的库。只...
    99+
    2022-11-13
    node.js生成csv文件方法 node.js与读取csv文件方法 object-to-CSV生成csv文件方法
  • Python一行代码实现生成和读取二维码
    目录生成二维码读取二维码补充总结二维码是用某种特定的几何图形按一定规律在平面(二维方向上)分布的、黑白相间的、记录数据符号信息的图形。 二维码被称为快速响应码,可能看起来很简单,但它...
    99+
    2024-04-02
  • python深度学习tensorflow实例数据下载与读取
    目录一、mnist数据二、CSV数据 三、cifar10数据一、mnist数据 深度学习的入门实例,一般就是mnist手写数字分类识别,因此我们应该先下载这个数据集。 te...
    99+
    2024-04-02
  • JS实现读取Excel文件内容并生成二维码
    目录需求实现方案puppeteernode-canvas浏览器问题分解具体实现启动一个本地服务器创建html,引入资源库解析xls文件写入中间logo写入底部文字canvas转化为图...
    99+
    2024-04-02
  • 在Jav中使用httpclient与Jsoup实现获取动态生成的数据
    这期内容当中小编将会给大家带来有关在Jav中使用httpclient与Jsoup实现获取动态生成的数据,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。Java爬虫Jsoup+httpclient获取动态生成...
    99+
    2023-05-31
    java httpclient jsoup
  • 使用pandas生成/读取csv文件的方法实例
    前言 csv是我接触的比较早的一种文件,比较好的是这种文件既能够以电子表格的形式查看又能够以文本的形式查看。 先引入pandas库 import pandas as pd 方法一...
    99+
    2024-04-02
  • 怎么用Python读取Excel数据实现批量生成合同
    这篇文章主要介绍“怎么用Python读取Excel数据实现批量生成合同”,在日常操作中,相信很多人在怎么用Python读取Excel数据实现批量生成合同问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”怎么用Py...
    99+
    2023-06-30
  • Java如何实现读取txt文件内容并生成Word文档
    目录导入Jar包1. Maven仓库下载导入2. 手动导入读取txt生成Word注意事项本文将以Java程序代码为例介绍如何读取txt文件中的内容,生成Word文档。在编辑代码前,可...
    99+
    2024-04-02
  • 如何使用Python读取实时生成的数组文件?
    Python是一个强大的编程语言,常用于数据处理、机器学习、人工智能等领域。在处理数据时,我们通常需要读取实时生成的数组文件,以便进一步分析和处理数据。本文将介绍如何使用Python读取实时生成的数组文件。 一、什么是数组文件? 数组文件是...
    99+
    2023-07-06
    实时 数组 文件
  • python中csv文件的写入与读取怎么实现
    这篇文章主要讲解了“python中csv文件的写入与读取怎么实现”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“python中csv文件的写入与读取怎么实现”吧!CSV (Comma Sepa...
    99+
    2023-06-29
  • pandas读取excel时获取读取进度的实现
    写在前面 QQ群里偶然看到群友问这个问题, pandas读取大文件时怎么才能获取进度? 我第一反应是: 除非pandas的read_excel等函数提供了回调函数的接口, 否...
    99+
    2024-04-02
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作