I am researching image-denoising. At first, I used a random Gaussian noise(AWGN) interval within the specified range using the following code. However, I am now extending to add the Poisson noise and mixed noise within the range interval. The question is np. random.poisson () accepts one interval and the size according to this np.random.poisson(lam=1.0, size=None). How can I solve this problem?

Thank you for your suggestion and comment. My question is, while AWGN noise can be easily added using PyTorch tensors, adding Poisson noise can only be accomplished using NumPy. Do you have any suggestions for adding Poisson noise using PyTorch tensors?

Thank you for your comment. I have implemented Poisson noise according to the following code. I am uncertain whether the use of torch.ones for noise addition is appropriate or not. Additionally, some research papers suggest that Poisson noise is signal-dependent, and the addition of the noise to the original image may not be accurate. Please give me suggestions and comments for this point.

noise = torch.zeros(img_train.size())
stdn = np.random.uniform(args.noiseIntL[0], args.noiseIntL[1], size=noise.size()[0])
for nx in range(noise.size()[0]):
sizen = noise[0, :, :, :].size()
noise[nx, :, :, :] = torch.poisson(
torch.ones(sizen) * stdn[nx]) # Pass a tensor of the same shape as noise
imgn_train = img_train + noise

as far as I understand the documentation the argument of torch.poisson corresponds to the lamda parameter of np.random.poisson. You just have the option do define different lambdas for different dimensions. This is why

torch.poisson(torch.ones(your_shape))

makes actually sense. In this case all dimensions have the same lambda parameter.
Additionally you multiply a standard deviation to your lambda. I don’t see any reason why you should do that. Gaussian Noise is parameterized by standard deviation, but poisson noise is not. Its solely defined by the lambda (even though you can calculate a standard deviation for the poisson distribution).

You should be aware that adding poisson distributed random values can only make your image brighter and never darker, because they are strictly positive

I originally used std = np.random.uniform() to create different noise ranges, like 0 to 70, during neural network training. Later, I changed the code to use lambdas = torch.randint(76, size=(noise.size()[0],)) .