Closed yuyu2172 closed 7 years ago
For return values, packing all of them into a dictionary may be good. For example, random_flip
returns img, params
, where params
is a dictionary whose keys are x_flip
and y_flip
.
This is good for three reasons.
params['x_flip']
is self-explanatory).random_flip
and five for random_expand
. This is good because users do not have to remember the number of parameters.params
or not can be fixed to return_params
. This solves issue #83.@Hakuyume The code your PRed will be changed with the proposal above. What do you think about it?
For arguments, following functions are related
image/random_flip
, image/flip
bbox/translate_bbox
bbox/flip_bbox
Although there is an inconsistency, using x_*
, y_*
in this order for arguments is fine. The reasons behind this are
x
and y
are usually in x,y
order because of the order of alphabets.The other alternatives would be to make everything consistent. However, I found them to be less convincing.
The first alternative would be to make everything follow y, x
order. However, this would bring up the question of whether to keep order of elements in bounding boxes and keypoints which are currently in x, y
order. In scikit-image, everything including bounding boxes are in y, x
order. I think that using y, x
for bounding boxes and keypoints are very rare conventions.
The second alternative would be to make everything follow x, y
order. This means that image shapes will be represented as W, H
instead of H, W
. I find it increasingly popular to use H, W
in many machine learning communities (e.g. TensorFlow), and I think this convention is more natural especially when working with tensors of shape CHW.
I agree with you that inconsistency of the order of axis is a problem. I like (col, row)
order, because
x, y
order is natural.OpenCV
uses x, y
order for its APIs even though it stores images in (row, col)
order.
cv2.resize
takes (width, height)
as the shape of imageAfter some discussion internally, I agree that making everything in col, row
order seems to be best.
We need to change resize related functions.
There is inconsistency on conventions used for arguments and return data order of transforms. The conventions refer to (row, col) and (col, row) orders. For example, when a transform takes argument
flip_x, flip_y
in this order, it is following (col, row) convention.The issue is that there are functions that follow those conventions, whereas the image shapes follow (row, col) convention.
Currently, the following codes are related to this issue.
x_flip
,y_flip
)x_offset
,y_offset
)x_slice
,y_slice
)resize
. (shape=(H, W)
)