Beispiel #1
0
    def infer_outputs(self):
        # sampled rois (0, x1, y1, x2, y2)
        # for CNTK the proposal shape is [4 x roisPerImage], and mirrored in Python
        rois_shape = (FreeDimension, 4)
        labels_shape = (FreeDimension, self._num_classes)
        bbox_targets_shape = (FreeDimension, self._num_classes * 4)
        bbox_inside_weights_shape = (FreeDimension, self._num_classes * 4)

        return [
            output_variable(rois_shape,
                            self.inputs[0].dtype,
                            self.inputs[0].dynamic_axes,
                            name="rpn_target_rois_raw",
                            needs_gradient=False),
            output_variable(labels_shape,
                            self.inputs[0].dtype,
                            self.inputs[0].dynamic_axes,
                            name="label_targets_raw",
                            needs_gradient=False),
            output_variable(bbox_targets_shape,
                            self.inputs[0].dtype,
                            self.inputs[0].dynamic_axes,
                            name="bbox_targets_raw",
                            needs_gradient=False),
            output_variable(bbox_inside_weights_shape,
                            self.inputs[0].dtype,
                            self.inputs[0].dynamic_axes,
                            name="bbox_inside_w_raw",
                            needs_gradient=False)
        ]
Beispiel #2
0
 def infer_outputs(self):
     return [
         C.output_variable(self.inputs[0].shape, self.inputs[0].dtype,
                           self.inputs[0].dynamic_axes),
         C.output_variable(self.inputs[0].shape, self.inputs[0].dtype,
                           self.inputs[0].dynamic_axes)
     ]
Beispiel #3
0
 def infer_outputs(self):
     return [
         C.output_variable(C.FreeDimension, self.inputs[0].dtype,
                           self.inputs[0].dynamic_axes),
         C.output_variable(C.FreeDimension, self.inputs[0].dtype,
                           self.inputs[0].dynamic_axes)
     ]
    def infer_outputs(self):
        # sampled rois (0, x1, y1, x2, y2)
        # for CNTK the proposal shape is [4 x roisPerImage], and mirrored in Python
        rois_shape = (cfg["TRAIN"].RPN_POST_NMS_TOP_N, 4)
        #rois_shape = (FreeDimension, 4)

        # labels
        # for CNTK the labels shape is [1 x roisPerImage], and mirrored in Python
        labels_shape = (cfg["TRAIN"].RPN_POST_NMS_TOP_N, self._num_classes)
        #labels_shape = (FreeDimension, self._num_classes)

        # bbox_targets
        bbox_targets_shape = (cfg["TRAIN"].RPN_POST_NMS_TOP_N, self._num_classes * 4)
        #bbox_targets_shape = (FreeDimension, self._num_classes * 4)

        # bbox_inside_weights
        bbox_inside_weights_shape = (cfg["TRAIN"].RPN_POST_NMS_TOP_N, self._num_classes * 4)
        #bbox_inside_weights_shape = (FreeDimension, self._num_classes * 4)

        return [output_variable(rois_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="rpn_target_rois_raw", needs_gradient=False),
                output_variable(labels_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="label_targets_raw", needs_gradient=False),
                output_variable(bbox_targets_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="bbox_targets_raw", needs_gradient=False),
                output_variable(bbox_inside_weights_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="bbox_inside_w_raw", needs_gradient=False)]
Beispiel #5
0
    def infer_outputs(self):
        # This is a necessary work around since after cloning the cloned inputs are just place holders without the proper shape
        if self._cfm_shape is None:
            self._cfm_shape = self.inputs[0].shape
        height, width = self._cfm_shape[-2:]

        if DEBUG:
            print('AnchorTargetLayer: height', height, 'width', width)

        A = self._num_anchors
        # labels
        labelShape = (1, A, height, width)
        # Comment: this layer uses encoded labels, while in CNTK we mostly use one hot labels
        # bbox_targets
        bbox_target_shape = (1, A * 4, height, width)
        # bbox_inside_weights
        bbox_inside_weights_shape = (1, A * 4, height, width)

        return [
            output_variable(labelShape,
                            self.inputs[0].dtype,
                            self.inputs[0].dynamic_axes,
                            name="objectness_target",
                            needs_gradient=False),
            output_variable(bbox_target_shape,
                            self.inputs[0].dtype,
                            self.inputs[0].dynamic_axes,
                            name="rpn_bbox_target",
                            needs_gradient=False),
            output_variable(bbox_inside_weights_shape,
                            self.inputs[0].dtype,
                            self.inputs[0].dynamic_axes,
                            name="rpn_bbox_inside_w",
                            needs_gradient=False),
        ]
Beispiel #6
0
    def infer_outputs(self):
        height, width = self.inputs[0].shape[-2:]
        if DEBUG:
            print('AnchorTargetLayer: height', height, 'width', width)

        A = self._num_anchors
        # labels
        labelShape = (1, A, height, width)
        # Comment: this layer uses encoded labels, while in CNTK we mostly use one hot labels
        # bbox_targets
        bbox_target_shape = (1, A * 4, height, width)
        # bbox_inside_weights
        bbox_inside_weights_shape = (1, A * 4, height, width)

        return [
            output_variable(labelShape,
                            self.inputs[0].dtype,
                            self.inputs[0].dynamic_axes,
                            name="objectness_target",
                            needs_gradient=False),
            output_variable(bbox_target_shape,
                            self.inputs[0].dtype,
                            self.inputs[0].dynamic_axes,
                            name="rpn_bbox_target",
                            needs_gradient=False),
            output_variable(bbox_inside_weights_shape,
                            self.inputs[0].dtype,
                            self.inputs[0].dynamic_axes,
                            name="rpn_bbox_inside_w",
                            needs_gradient=False),
        ]
    def infer_outputs(self):
        output_vars = [C.output_variable(self.inputs[0].shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes)]

        self.action, self.actionArg = self.multiFunc(self.inputs[0])
        self.grad, self.gradArg, self.gradRoot = self.gradFunc(self.inputs[0])

        return output_vars
Beispiel #8
0
 def infer_outputs(self):
     return [
         C.output_variable(self.inputs[0].shape,
                           self.inputs[0].dtype,
                           self.inputs[0].dynamic_axes,
                           needs_gradient=False)
     ]
Beispiel #9
0
 def infer_outputs(self):
     outputVar = [
         C.output_variable(self.inputs[idx].shape,
                           self.inputs[idx].dtype,
                           self.inputs[idx].dynamic_axes,
                           name='outSimpleUdf')
         for idx in range(len(self.inputs))
     ]
     return outputVar
Beispiel #10
0
 def infer_outputs(self):
     self.count = self.count + 1
     outputVar = [
         C.output_variable(self.inputs[1].shape,
                           self.inputs[1].dtype,
                           self.inputs[1].dynamic_axes,
                           name='outDummyLayer')
     ]
     return outputVar
Beispiel #11
0
    def infer_outputs(self):
        # rois blob: holds R regions of interest, each is a 5-tuple
        # (n, x1, y1, x2, y2) specifying an image batch index n and a
        # rectangle (x1, y1, x2, y2)
        # for CNTK the proposal shape is [4 x roisPerImage], and mirrored in Python
        proposalShape = (FreeDimension, 4)

        return [output_variable(proposalShape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                            name="rpn_rois_raw", needs_gradient=False)]
Beispiel #12
0
    def infer_outputs(self):
        # rois blob: holds R regions of interest, each is a 5-tuple
        # (n, x1, y1, x2, y2) specifying an image batch index n and a
        # rectangle (x1, y1, x2, y2)
        # for CNTK the proposal shape is [4 x roisPerImage], and mirrored in Python
        proposalShape = (FreeDimension, 4)

        return [output_variable(proposalShape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                            name="rpn_rois_raw", needs_gradient=False)]
Beispiel #13
0
 def infer_outputs(self):
     if not self.shape:
         self.shape = self.inputs[0].shape[:-1] + (
             self.inputs[1].shape[-1], )
     return [
         ct.output_variable(self.shape,
                            np.float32,
                            self.inputs[1].dynamic_axes,
                            name=self.name + '_output_shape')
     ]
Beispiel #14
0
    def infer_outputs(self):
        output_vars = [
            C.output_variable(self.inputs[0].shape, self.inputs[0].dtype,
                              self.inputs[0].dynamic_axes)
        ]

        self.action, self.actionArg = self.multiFunc(self.inputs[0])
        self.grad, self.gradArg, self.gradRoot = self.gradFunc(self.inputs[0])

        return output_vars
    def infer_outputs(self):
        height, width = self.inputs[0].shape[-2:]
        if DEBUG:
            print('AnchorTargetLayer: height', height, 'width', width)

        A = self._num_anchors
        # labels
        labelShape = (1, A, height, width)
        # Comment: this layer uses encoded labels, while in CNTK we mostly use one hot labels
        # bbox_targets
        bbox_target_shape = (1, A * 4, height, width)
        # bbox_inside_weights
        bbox_inside_weights_shape = (1, A * 4, height, width)

        return [output_variable(labelShape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="objectness_target", needs_gradient=False),
                output_variable(bbox_target_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="rpn_bbox_target", needs_gradient=False),
                output_variable(bbox_inside_weights_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="rpn_bbox_inside_w", needs_gradient=False),]
Beispiel #16
0
    def infer_outputs(self):
        # rois blob: holds R regions of interest, each is a 5-tuple
        # (n, x1, y1, x2, y2) specifying an image batch index n and a
        # rectangle (x1, y1, x2, y2)
        # for CNTK the proposal shape is [4 x roisPerImage], and mirrored in Python

        # cfg_key = str(self.phase) # either 'TRAIN' or 'TEST' --> use FreeDimension and set output size in fwd
        proposalShape = (cfg["TRAIN"].RPN_POST_NMS_TOP_N, 4)
        #proposalShape = (FreeDimension, 4)

        return [output_variable(proposalShape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="rpn_rois_raw", needs_gradient=False)] # , name="rpn_rois" | name="rpn_rois_raw"
    def infer_outputs(self):
        # This is a necessary work around since anfter cloning the cloned inputs are just place holders without the proper shape
        if self._cfm_shape is None:
            self._cfm_shape = self.inputs[0].shape
        height, width = self._cfm_shape[-2:]

        if DEBUG:
            print('AnchorTargetLayer: height', height, 'width', width)

        A = self._num_anchors
        # labels
        labelShape = (1, A, height, width)
        # Comment: this layer uses encoded labels, while in CNTK we mostly use one hot labels
        # bbox_targets
        bbox_target_shape = (1, A * 4, height, width)
        # bbox_inside_weights
        bbox_inside_weights_shape = (1, A * 4, height, width)

        return [output_variable(labelShape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="objectness_target", needs_gradient=False),
                output_variable(bbox_target_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="rpn_bbox_target", needs_gradient=False),
                output_variable(bbox_inside_weights_shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes,
                                name="rpn_bbox_inside_w", needs_gradient=False),]
    def infer_outputs(self):
        # rois blob: holds R regions of interest, each is a 5-tuple
        # (n, x1, y1, x2, y2) specifying an image batch index n and a
        # rectangle (x1, y1, x2, y2)
        # for CNTK the proposal shape is [4 x roisPerImage], and mirrored in Python

        # cfg_key = str(self.phase) # either 'TRAIN' or 'TEST' --> use FreeDimension and set output size in fwd
        proposalShape = (cfg["TRAIN"].RPN_POST_NMS_TOP_N, 4)
        #proposalShape = (FreeDimension, 4)

        return [
            output_variable(proposalShape,
                            self.inputs[0].dtype,
                            self.inputs[0].dynamic_axes,
                            name="rpn_rois_raw",
                            needs_gradient=False)
        ]  # , name="rpn_rois" | name="rpn_rois_raw"
Beispiel #19
0
 def infer_outputs(self):
     impl_func_output = self.impl_func.output
     return [C.output_variable(impl_func_output.shape, impl_func_output.dtype, impl_func_output.dynamic_axes)]
Beispiel #20
0
 def infer_outputs(self):
     impl_func_output = self.impl_func.output
     return [
         C.output_variable(impl_func_output.shape, impl_func_output.dtype,
                           impl_func_output.dynamic_axes)
     ]
Beispiel #21
0
 def infer_outputs(self):
     conversation_batch_axis = C.Axis.default_batch_axis()
     return [
         C.output_variable((C.FreeDimension, ) + self.inputs[0].shape,
                           self.inputs[0].dtype, [conversation_batch_axis])
     ]
 def infer_outputs(self):
     return [C.output_variable(C.FreeDimension, self.inputs[0].dtype, self.inputs[0].dynamic_axes),
             C.output_variable(C.FreeDimension, self.inputs[0].dtype, self.inputs[0].dynamic_axes)]
 def infer_outputs(self):
     return [output_variable(self.inputs[0].shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes, name='rpn_obj_prob'),
             output_variable(self.inputs[1].shape, self.inputs[1].dtype, self.inputs[1].dynamic_axes, name='rpn_obj_targets', needs_gradient=False)]
Beispiel #24
0
 def infer_outputs(self):
     return [
         output_variable((), self.inputs[0].dtype,
                         self.inputs[0].dynamic_axes)
     ]
Beispiel #25
0
 def infer_outputs(self):
     self.count = self.count + 1
     outputVar = [C.output_variable(self.inputs[1].shape, self.inputs[1].dtype,
         self.inputs[1].dynamic_axes, name='outDummyLayer')]
     return outputVar
Beispiel #26
0
 def infer_outputs(self):
     conversation_batch_axis = C.Axis.default_batch_axis()
     return [C.output_variable((C.FreeDimension,) + self.inputs[0].shape, self.inputs[0].dtype, [conversation_batch_axis])]
Beispiel #27
0
 def infer_outputs(self):
     return [C.output_variable(self.inputs[0].shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes, needs_gradient=False)]
Beispiel #28
0
 def infer_outputs(self):
     outputVar = [C.output_variable(self.inputs[idx].shape, self.inputs[idx].dtype,
         self.inputs[idx].dynamic_axes, name='outDummyLayer') for idx in range(len(self.inputs))]
     return outputVar
Beispiel #29
0
 def infer_outputs(self):
     return [output_variable(self.inputs[0].shape, self.inputs[0].dtype, self.inputs[0].dynamic_axes)]