Python中图像增强管道的图像增强错误

2024-09-28 13:17:07 发布

您现在位置:Python中文网/ 问答频道 /正文

据我所知,路径是正确的,我也在遵循Augmentor文档。在

代码:

import Augmentor
import os
import warnings
warnings.filterwarnings('ignore')
import keras
import glob

for img in glob.glob("C:\\Users\\Diganta\\Desktop\\Courses and Projects\\Projects\\Bennet\\irregular*.jpg"):
    p = Augmentor.Pipeline(img)
    p.rotate(probability=0.7, max_left_rotation=10, max_right_rotation=10)
    p.zoom(probability=0.5, min_factor=1.1, max_factor=1.5)
    p.sample(100)

这确实运行过,但是没有按照Augmentor文档中指定的在目录中创建包含增强图像的输出文件夹


Tags: 代码文档import路径imgosmaxglob
1条回答
网友
1楼 · 发布于 2024-09-28 13:17:07

我不是增强器专家,但是通过查看source code它看起来像是管道需要一个源目录作为参数,它会自动找到其中的所有图片。在

尝试直接传递目录,而不传递globs和loops:

p = Augmentor.Pipeline("C:\\Users\\Diganta\\Desktop\\Courses and Projects\\Projects\\Bennet")
p.rotate(probability=0.7, max_left_rotation=10, max_right_rotation=10)
p.zoom(probability=0.5, min_factor=1.1, max_factor=1.5)
p.sample(100)

在我看来,你想在所有图像上运行你的管道,而不是一个子集。如果是这样,那么将p.sample(100)替换为:

^{pr2}$

或者:

p.process()

相关问题 更多 >

    热门问题