diff --git a/libnd4j/include/ops/declarable/generic/parity_ops/draw_bounding_boxes.cpp b/libnd4j/include/ops/declarable/generic/parity_ops/draw_bounding_boxes.cpp index 78d8910fb..7610e6161 100644 --- a/libnd4j/include/ops/declarable/generic/parity_ops/draw_bounding_boxes.cpp +++ b/libnd4j/include/ops/declarable/generic/parity_ops/draw_bounding_boxes.cpp @@ -21,16 +21,18 @@ #include #if NOT_EXCLUDED(OP_draw_bounding_boxes) -//#include -#include +#include +#include namespace nd4j { namespace ops { OP_IMPL(draw_bounding_boxes, 3, 1, true) { - auto image = INPUT_VARIABLE(0); + auto images = INPUT_VARIABLE(0); auto boxes = INPUT_VARIABLE(1); auto colors = INPUT_VARIABLE(2); - + auto output = OUTPUT_VARIABLE(0); + + helpers::drawBoundingBoxesFunctor(block.launchContext(), images, boxes, colors, output); return ND4J_STATUS_OK; } diff --git a/libnd4j/include/ops/declarable/helpers/cpu/image_draw_bounding_boxes.cpp b/libnd4j/include/ops/declarable/helpers/cpu/image_draw_bounding_boxes.cpp new file mode 100644 index 000000000..6f32c1cbd --- /dev/null +++ b/libnd4j/include/ops/declarable/helpers/cpu/image_draw_bounding_boxes.cpp @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2015-2018 Skymind, Inc. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ******************************************************************************/ + +// +// @author sgazeos@gmail.com +// +#include +#include + +namespace nd4j { +namespace ops { +namespace helpers { + + void drawBoundingBoxesFunctor(nd4j::LaunchContext * context, NDArray* images, NDArray* boxes, NDArray* colors, NDArray* output) { + + } + +} +} +} diff --git a/libnd4j/include/ops/declarable/helpers/cuda/image_draw_bounding_boxes.cu b/libnd4j/include/ops/declarable/helpers/cuda/image_draw_bounding_boxes.cu new file mode 100644 index 000000000..9e4db944c --- /dev/null +++ b/libnd4j/include/ops/declarable/helpers/cuda/image_draw_bounding_boxes.cu @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2015-2018 Skymind, Inc. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ******************************************************************************/ + +// +// @author sgazeos@gmail.com +// +#include +#include + +namespace nd4j { +namespace ops { +namespace helpers { + + void drawBoundingBoxesFunctor(nd4j::LaunchContext * context, NDArray* images, NDArray* boxes, NDArray* colors, NDArray* output) { + + } + +} +} +} diff --git a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests10.cpp b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests10.cpp index 14bc22fae..ce327f0cf 100644 --- a/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests10.cpp +++ b/libnd4j/tests_cpu/layers_tests/DeclarableOpsTests10.cpp @@ -2045,9 +2045,12 @@ TEST_F(DeclarableOpsTests10, Image_CropAndResize_5) { //////////////////////////////////////////////////////////////////// TEST_F(DeclarableOpsTests10, Image_DrawBoundingBoxes_1) { - int axis = 0; NDArray images = NDArrayFactory::create('c', {2,4,5,3}); - NDArray boxes = NDArrayFactory::create('c', {2, 2, 4}, {0,0,1,1}); + NDArray boxes = NDArrayFactory::create('c', {2, 2, 4}, { + 0. , 0. , 1. , 1. , 0.1, 0.2, 0.9, 0.8, + 0.3, 0.3, 0.7, 0.7, 0.4, 0.4, 0.6, 0.6 + }); + NDArray colors = NDArrayFactory::create('c', {2, 3}, {201., 202., 203., 128., 129., 130.}); //NDArray ('c', {6}, {0.9f, .75f, .6f, .95f, .5f, .3f}); @@ -2062,7 +2065,7 @@ TEST_F(DeclarableOpsTests10, Image_DrawBoundingBoxes_1) { 91., 92., 93., 201., 202., 203., 201., 202., 203., 100., 101., 102., 103., 104., 105., 106., 107., 108., 109., 110., 111., 112., 113., 114., 115., 116., 117., 118., 119., 120. }); - + images.linspace(1.); nd4j::ops::draw_bounding_boxes op; auto results = op.execute({&images, &boxes, &colors}, {}, {});