Unverified Commit c31c3d7e authored by Alykhan Tejani's avatar Alykhan Tejani Committed by GitHub
Browse files

add docs for grayscale + random grayscale transforms (#333)

* add docs for grayscale + random grayscale transforms
parent 627ce703
...@@ -26,6 +26,10 @@ Transforms on PIL Image ...@@ -26,6 +26,10 @@ Transforms on PIL Image
.. autoclass:: RandomSizedCrop .. autoclass:: RandomSizedCrop
.. autoclass:: Grayscale
.. autoclass:: RandomGrayscale
.. autoclass:: FiveCrop .. autoclass:: FiveCrop
.. autoclass:: TenCrop .. autoclass:: TenCrop
......
...@@ -633,13 +633,14 @@ class RandomRotation(object): ...@@ -633,13 +633,14 @@ class RandomRotation(object):
class Grayscale(object): class Grayscale(object):
"""Convert image to grayscale. """Convert image to grayscale.
Args: Args:
num_output_channels (int): (1 or 3) number of channels desired for output image num_output_channels (int): (1 or 3) number of channels desired for output image
Returns: Returns:
PIL Image: grayscale version of the input PIL Image: Grayscale version of the input.
if num_output_channels == 1 : returned image is single channel - If num_output_channels == 1 : returned image is single channel
if num_output_channels == 3 : returned image is 3 channel with r == g == b - If num_output_channels == 3 : returned image is 3 channel with r == g == b
""" """
...@@ -659,16 +660,15 @@ class Grayscale(object): ...@@ -659,16 +660,15 @@ class Grayscale(object):
class RandomGrayscale(object): class RandomGrayscale(object):
"""Randomly convert image to grayscale with a probability of p (default 0.1). """Randomly convert image to grayscale with a probability of p (default 0.1).
Args: Args:
p (float): probability that image should be converted to grayscale. p (float): probability that image should be converted to grayscale.
Returns: Returns:
PIL Image: grayscale version of the input image with probability p PIL Image: Grayscale version of the input image with probability p and unchanged
and unchanged with probability (1-p) with probability (1-p).
- if input image is 1 channel: - If input image is 1 channel: grayscale version is 1 channel
grayscale version is 1 channel - If input image is 3 channel: grayscale version is 3 channel with r == g == b
- if input image is 3 channel:
grayscale version is 3 channel with r == g == b
""" """
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment