New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to pass an image path as parameter and only preprocess it? #62
Comments
Hi there, the best thing to do would be to pass the single image as an array. So create a pipeline object without specifying an image directory: import Augmentor
import numpy as np
from PIL import Image
# Create a Pipeline object without specifying a directory:
p = Augmentor.Pipeline()
# Add operations to the pipeline object as per usual:
p.rotate(probability=1, max_left_rotation=5, max_right_rotation=5) and then pass an image as an array to the function img = Image.open("/tmp/test.JPEG")
img_array = np.asarray(img)
img_augmented = p.sample_with_array(img_array) The image contained in Admittedly this is not very intuitive, I'll try to fix that for a future version. Also the documentation for this functionality is sparse, I'll fix that too in an upcoming version. M. |
Thank you. |
Hi,
|
you can do it like this: import Augmentor
import numpy as np
from PIL import Image
# Create a Pipeline object without specifying a directory:
p = Augmentor.Pipeline()
# Add operations to the pipeline object as per usual:
p.rotate(probability=1, max_left_rotation=5, max_right_rotation=5) And then change your image: If it does not work, check this: |
I used
|
It seems Augmentor needs a work directory as the parameter and it will preprocess all files in it.
However, we always need to preprocess a specific image and use the image path as the parameter.
So how to use Augmentor in this situation?
Thank you.
The text was updated successfully, but these errors were encountered: