@@ -633,13 +633,14 @@ def __call__(self, img):
633
633
634
634
class Grayscale (object ):
635
635
"""Convert image to grayscale.
636
+
636
637
Args:
637
638
num_output_channels (int): (1 or 3) number of channels desired for output image
638
639
639
640
Returns:
640
- PIL Image: grayscale version of the input
641
- if num_output_channels == 1 : returned image is single channel
642
- if num_output_channels == 3 : returned image is 3 channel with r == g == b
641
+ PIL Image: Grayscale version of the input.
642
+ - If num_output_channels == 1 : returned image is single channel
643
+ - If num_output_channels == 3 : returned image is 3 channel with r == g == b
643
644
644
645
"""
645
646
@@ -659,16 +660,15 @@ def __call__(self, img):
659
660
660
661
class RandomGrayscale (object ):
661
662
"""Randomly convert image to grayscale with a probability of p (default 0.1).
663
+
662
664
Args:
663
665
p (float): probability that image should be converted to grayscale.
664
666
665
667
Returns:
666
- PIL Image: grayscale version of the input image with probability p
667
- and unchanged with probability (1-p)
668
- - if input image is 1 channel:
669
- grayscale version is 1 channel
670
- - if input image is 3 channel:
671
- grayscale version is 3 channel with r == g == b
668
+ PIL Image: Grayscale version of the input image with probability p and unchanged
669
+ with probability (1-p).
670
+ - If input image is 1 channel: grayscale version is 1 channel
671
+ - If input image is 3 channel: grayscale version is 3 channel with r == g == b
672
672
673
673
"""
674
674
0 commit comments