to_tfrecords.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:tensorflow-cyclegan 作者: rickbarraza 项目源码 文件源码
def reader(path, shuffle=True):
    files = []

    for img_file in os.scandir(path):
        if img_file.name.lower().endswith('.jpg', ) and img_file.is_file():
            files.append(img_file.path)

    if shuffle:
        # Shuffle the ordering of all image files in order to guarantee
        # random ordering of the images with respect to label in the
        # saved TFRecord files. Make the randomization repeatable.
        shuffled_index = list(range(len(files)))
        random.shuffle(files)

        files = [files[i] for i in shuffled_index]

    return files
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号