Add Gluon Transformer Crop#14259
Conversation
|
@mxnet-label-bot add [pr-awaiting-review] @stu1130 is this trying to achieve the same functionality as this PR - #13679 have the comments in the previous PR( 1 and 2) been addressed here? could you please elaborate on how the comments have been addressed in this new PR? |
|
@anirudhacharya yes it is |
|
what is the behavior if the crop size is greater than the input image for either dimension? |
|
got it, thanks |
| return image.random_size_crop(x, *self._args)[0] | ||
|
|
||
|
|
||
| class Crop(HybridBlock): |
There was a problem hiding this comment.
there is an deprecated mx.sym.Crop op already, using sym.image.Crop may introduce some confusion again, can you propose a new name?
For image transformation, since resize is supported, I guess CropResize is better?
There was a problem hiding this comment.
Do you intend to expand the implementation to add more parameters like x1, y1 ? If so then it makes sense to keep them x0 and y0. Else I think you should change them to x and y
There was a problem hiding this comment.
thanks @access2rohit I assume now I only need one x and y so I'll go with x and y
| Makes a crop of the original image then optionally resize it to the specified size. | ||
| Parameters | ||
| ---------- | ||
| x0 : int |
There was a problem hiding this comment.
imo, x is better than x0 since there is nox1
| ---------- | ||
| x0 : int | ||
| Left boundary of the cropping area | ||
| y0 : int |
src/operator/image/crop.cc
Outdated
| .set_attr<nnvm::FInferShape>("FInferShape", CropShape) | ||
| .set_attr<nnvm::FInferType>("FInferType", ElemwiseType<1, 1>) | ||
| .set_attr<FCompute>("FCompute<cpu>", Crop) | ||
| .set_attr<nnvm::FGradient>("FGradient", ElemwiseGradUseNone{ "_copy" }) |
There was a problem hiding this comment.
copy gradient does not apply to crop op.
|
|
||
| def hybrid_forward(self, F, x): | ||
| out = F.image.crop(x, self._x0, self._y0, self._width, self._height) | ||
| if self._size is not None: |
src/operator/image/crop-inl.h
Outdated
| DMLC_DECLARE_FIELD(width) | ||
| .describe("Width of the cropping area."); | ||
| DMLC_DECLARE_FIELD(height) | ||
| .describe("Top boundary of the cropping area"); |
There was a problem hiding this comment.
Height of the cropping area?
6e101b7 to
0dd7407
Compare
|
@zhreshold ready for 2nd round review. Thanks |
zhreshold
left a comment
There was a problem hiding this comment.
Thanks for addressing previous comments, I see no issue, but can you add unittest for backward gradient check?
faffe1b to
40410d0
Compare
|
@zhreshold I added the unit test for backward gradient check |
40410d0 to
3f6583d
Compare
sandeep-krishnamurthy
left a comment
There was a problem hiding this comment.
Thanks. Few minor comments.
d3d92ce to
2926495
Compare
* implement crop * add crop operator * fix for linter * add. backword and refactor the code * fix error namespace * fix the website build failure * start adding the unit test of backword * add unit test for backward * address the comment * add missing statement * fix the website error * fix the website building * add missing doc
* implement crop * add crop operator * fix for linter * add. backword and refactor the code * fix error namespace * fix the website build failure * start adding the unit test of backword * add unit test for backward * address the comment * add missing statement * fix the website error * fix the website building * add missing doc
Description
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Comments
@zhreshold