Description
Thank you for creating this useful package! I have a question that I hope you can help me with.
I want to use augraphy in a pipeline for creating synthetic data as part of a research project. However, I need to be able to recreate the exact pipeline that was used on each image after the fact. When reading the documentation I found that I can get the log from the output using pipeline.augment(image)["log"]
. However, when looking at the log, I can’t see how I can tell which phase (ink_phase
, paper_phase
, post_phase
or pre_phase
) an augmentation belongs to. I also can’t seem to find this in the documentation. So my question is: Is there some way I can find which phase an augmentation should be applied to? If not, what problems might I expect if I input them all in the post_phase?
Example code:
From pprint import pprint
import numpy as np
from augraphy import AugraphyPipeline, augmentations
image = np.random.standard_normal((512, 512))
fold_x = 100
ink_phase = [augmentations.BrightnessTexturize(texturize_range=(0.9, 0.9), deviation=0.1, p=1)]
paper_phase = []
post_phase = [
augmentations.Folding(
fold_x=fold_x,
fold_deviation=(0, 0),
fold_count=1,
fold_noise=0,
fold_angle_range=(0, 0),
gradient_width=(0.1, 0.1),
gradient_height=(0.01, 0.01),
backdrop_color=(0, 0, 0),
p=1,
)
]
pipeline = AugraphyPipeline(
ink_phase=ink_phase,
paper_phase=paper_phase,
post_phase=post_phase,
bounding_boxes=None,
)
pipeline_output = pipeline.augment(image)
pprint(pipeline_output["log"])
{'augmentation_name': ['BrightnessTexturize', 'Folding'],
'augmentation_parameters': [{'bounding_boxes': [],
'deviation': 0.1,
'high': 0.9,
'keypoints': {},
'low': 0.9,
'mask': None,
'numba_jit': 1,
'p': 1,
'texturize_range': (0.9, 0.9)},
{'backdrop_color': (0, 0, 0),
'bounding_boxes': [],
'fold_angle_range': (0, 0),
'fold_count': 1,
'fold_deviation': (0, 0),
'fold_noise': 0,
'fold_x': 100,
'gradient_height': (0.01, 0.01),
'gradient_width': (0.1, 0.1),
'keypoints': {},
'mask': None,
'numba_jit': 1,
'p': 1}],
'augmentation_status': [True, True],
'image_shape': (512, 512),
'ink_color': -1,
'paper_color': 255,
'time': [(BrightnessTexturize(texturize_range=(0.9, 0.9), deviation=0.1, p=1),
0.040704107999999906),
(Folding(fold_x=100, fold_deviation=(0, 0), fold_count=1, fold_noise=0, fold_angle_range=(0, 0), gradient_width=(0.1, 0.1), gradient_height=(0.01, 0.01), backdrop_color=(0, 0, 0), p=1),
0.0025830479999999767)]}
How can I from this log create a pipeline with the two augmentations in the correct phases?