据我所知,路径是正确的,我也在遵循Augmentor的文档。
代码:
import Augmentorimport osimport warningswarnings.filterwarnings('ignore')import kerasimport globfor 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文档的说明,目录中并没有创建包含增强图像的输出文件夹。
回答:
我不是Augmentor的专家,但通过查看源代码,看起来Pipeline需要一个源目录作为参数,它会自动找到其中的所有图片。
尝试直接传递目录,不使用glob和循环:
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)
替换为:
p.sample(0)
或者:
p.process()