You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/12/11 19:43:01 UTC

[GitHub] sandeep-krishnamurthy commented on a change in pull request #13611: add image resize operator and unit test

sandeep-krishnamurthy commented on a change in pull request #13611: add image resize operator and unit test
URL: https://github.com/apache/incubator-mxnet/pull/13611#discussion_r240761417
 
 

 ##########
 File path: src/operator/image/image_random-inl.h
 ##########
 @@ -147,6 +150,140 @@ void Normalize(const nnvm::NodeAttrs &attrs,
   });
 }
 
+struct ResizeParam : public dmlc::Parameter<ResizeParam> {
+  nnvm::Tuple<int> size;
+  bool keep_ratio;
+  int interp;
+  DMLC_DECLARE_PARAMETER(ResizeParam) {
+    DMLC_DECLARE_FIELD(size)
+    .set_default(nnvm::Tuple<int>())
+    .describe("Size of new image. Could be (width, height) or (size)");
+    DMLC_DECLARE_FIELD(keep_ratio)
+    .describe("Whether to resize the short edge or both edges to `size`, "
+      "if size is give as an integer.");
+    DMLC_DECLARE_FIELD(interp)
+    .set_default(1)
+    .describe("Interpolation method for resizing. By default uses bilinear"
+        "interpolation. See OpenCV's resize function for available choices.");
+  }
+};
+
+inline std::tuple<int, int> GetHeightAndWidth(int data_h,
+                                              int data_w,
+                                              const ResizeParam& param) {
+  CHECK_LE(param.size.ndim(), 2)
+      << "Input size dimension must be 1 or 2, but got "
+      << param.size.ndim();
+  int resized_h;
+  int resized_w;
+  if (param.size.ndim() == 1) {
+    CHECK_GT(param.size[0], 0)
+      << "Input size should greater than 0, but got "
 
 Review comment:
   Is this input size or expected output size?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services