huggingface / huggingface/diffusers
Difference in Output When Using PIL.Image vs numpy.array for Image and Mask Input.
- Dominant language
- Python
- Stars
- 34.5k
- Forks
- 7.3k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 91
Description
hi.
I get different results when providing image and mask as input using PIL.Image versus numpy. array. Why does this happen?
Is there an issue with my normalization method?
| pillow | array |
|---|---|
|  |  |
#### pillow code
```python
image = Image.open(image_path).convert("RGB")
mask = Image.open(mask_path).convert("L")
output_image = pipeline(
image=image,
mask_image=mask,
generator=torch.Generator(device=self.device).manual_seed(0),
).images[0]
```
#### array code
```python
image = Image.open(image_path).convert("RGB")
mask = Image.open(mask_path).convert("L")
image_array = np.array(image) / 255.0
mask_array = np.array(mask) / 255.0
output_image = pipeline(
image=image_array,
mask_image=mask_array,
generator=torch.Generator(device=self.device).manual_seed(0),
).images[0]
```
Contributor guide
Assessment
This issue has not been assessed yet.