PhysAugNet 1.0.1
VQ-VQE powered augmentation for metal defect segmentation
Loading...
Searching...
No Matches
grain.py
Go to the documentation of this file.
1import torch
2
3def add_grain(image, intensity=0.05):
4 if not torch.is_tensor(image):
5 image = torch.tensor(image)
6 noise = torch.randn_like(image) * intensity
7 return torch.clamp(image + noise, 0, 1)
add_grain(image, intensity=0.05)
Definition grain.py:3