def pipeline_RTNoise(image, box): rotated_image, rotated_box = img_aug.Rotate(image.copy(), box.copy()) translated_image, translated_box = img_aug.translate( rotated_image, rotated_box) noise_aug = iaa.AdditiveGaussianNoise(loc=(0.0, 0.1 * 255), scale=(0.0, 0.1 * 255), per_channel=True) noised_image = noise_aug(image=translated_image) final_box = [] if len(translated_box) > 0: for box in translated_box.tolist(): box = [str(x) for x in box] final_box.append(",".join(box)) final_box = " ".join(final_box) return noised_image, final_box
def pipeline_RTResise(image, box): rotated_image, rotated_box = img_aug.Rotate(image.copy(), box.copy()) translated_image, translated_box = img_aug.translate( rotated_image, rotated_box) Resize_image, Resize_box = img_aug.Resize(translated_image, translated_box) final_box = [] if len(Resize_box) > 0: for box in Resize_box.tolist(): box = [str(x) for x in box] final_box.append(",".join(box)) final_box = " ".join(final_box) return Resize_image, final_box
def pipeline_RTShear(image, box): rotated_image, rotated_box = img_aug.Rotate(image.copy(), box.copy()) translated_image, translated_box = img_aug.translate( rotated_image, rotated_box) sheared_image, sheared_box = img_aug.shearing(translated_image, translated_box) final_box = [] if len(sheared_box) > 0: for box in sheared_box.tolist(): box = [str(x) for x in box] final_box.append(",".join(box)) final_box = " ".join(final_box) return sheared_image, final_box
def pipeline_RTBlur(image, box): rotated_image, rotated_box = img_aug.Rotate(image.copy(), box.copy()) translated_image, translated_box = img_aug.translate( rotated_image, rotated_box) blur_aug = iaa.MotionBlur(k=10) blured_image = blur_aug(image=translated_image) final_box = [] if len(translated_box) > 0: for box in translated_box.tolist(): box = [str(x) for x in box] final_box.append(",".join(box)) final_box = " ".join(final_box) return blured_image, final_box
def pipeline_RTSharp(image, box): rotated_image, rotated_box = img_aug.Rotate(image.copy(), box.copy()) translated_image, translated_box = img_aug.translate( rotated_image, rotated_box) sharp_aug = iaa.Sharpen(alpha=random.sample(list(np.arange(11) / 10), 2)) sharped_image = sharp_aug(image=translated_image) final_box = [] if len(translated_box) > 0: for box in translated_box.tolist(): box = [str(x) for x in box] final_box.append(",".join(box)) final_box = " ".join(final_box) return sharped_image, final_box