Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image preprocess module. #2084

Merged
merged 4 commits into from
May 11, 2017
Merged

Image preprocess module. #2084

merged 4 commits into from
May 11, 2017

Conversation

qingqing01
Copy link
Contributor

@qingqing01 qingqing01 commented May 10, 2017

在v2 API里实现了一些通用的图像预处理函数,并对CHW, RGB顺序写了一些注释,这个顺序对刚接触的用户来说通常会比较疑惑。

  • 使用opencv-python库.
  • 后续其他同学可以增加更多的处理.

related to #2070 #PaddlePaddle/models#28

Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some tiny English problems.

"left_right_flip", "simple_transform", "load_and_transform"
]
"""
This file contains some common interface for image preprocess.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interfaces

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

"""
This file contains some common interface for image preprocess.
Many users are confused about the image layout. We introduce
the image layout firstly.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

firstly->as follows.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


- CHW Layout
- The abbreviations: C=channel, H=Height, W=Width
- The default image layout is HWC opened by cv2 or PIL.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opened->formulated ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

- CHW Layout
- The abbreviations: C=channel, H=Height, W=Width
- The default image layout is HWC opened by cv2 or PIL.
PaddlePaddle only support the image layout with CHW.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only support the CHW layout.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


- Color format: RGB or BGR
OpenCV use BGR color format. PIL use RGB color format. Both
formats can be used for training. But it must be noted that,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that, the format should be XXX

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

"""
Transpose the input image order. The image layout is HWC format
opened by cv2 or PIL. Transposed the input image to CHW layouts
by order (2,0,1).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Transpose the input image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


:param im: the input image with HWC layout.
:type im: ndarray
:param size: the cropping size
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

119行加句号。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


:param im: the input image with HWC layout.
:type im: ndarray
:param size: the cropping size
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

146行加句号。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


def simple_transform(im, resize_size, crop_size, is_train, is_color=True):
"""
Simply data argumentation for traing. These operations includes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

training笔误。These operations include

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

is_color=True):
"""
Load image from the input file `filename` and transform image for
data argumentation. Please refer the `simple_transform` interface
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refer to

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor Author

@qingqing01 qingqing01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! @luotao1

"left_right_flip", "simple_transform", "load_and_transform"
]
"""
This file contains some common interface for image preprocess.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

"""
This file contains some common interface for image preprocess.
Many users are confused about the image layout. We introduce
the image layout firstly.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


- CHW Layout
- The abbreviations: C=channel, H=Height, W=Width
- The default image layout is HWC opened by cv2 or PIL.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

- CHW Layout
- The abbreviations: C=channel, H=Height, W=Width
- The default image layout is HWC opened by cv2 or PIL.
PaddlePaddle only support the image layout with CHW.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


- Color format: RGB or BGR
OpenCV use BGR color format. PIL use RGB color format. Both
formats can be used for training. But it must be noted that,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

"""
Transpose the input image order. The image layout is HWC format
opened by cv2 or PIL. Transposed the input image to CHW layouts
by order (2,0,1).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


:param im: the input image with HWC layout.
:type im: ndarray
:param size: the cropping size
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


:param im: the input image with HWC layout.
:type im: ndarray
:param size: the cropping size
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


def simple_transform(im, resize_size, crop_size, is_train, is_color=True):
"""
Simply data argumentation for traing. These operations includes
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

is_color=True):
"""
Load image from the input file `filename` and transform image for
data argumentation. Please refer the `simple_transform` interface
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@luotao1 luotao1 merged commit affd9d2 into PaddlePaddle:develop May 11, 2017
heavengate pushed a commit to heavengate/Paddle that referenced this pull request Aug 16, 2021
* fix dide link, test=document

* fix dide link, test=document
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants