Forums - Does SNPE v1.31.0.522 supports ROIAlign layer?

4 posts / 0 new
Last post
Does SNPE v1.31.0.522 supports ROIAlign layer?
zhengxin.zhao
Join Date: 13 Mar 19
Posts: 12
Posted: Mon, 2019-10-21 01:20

Hi,

I used SNPE-1.23.1.245 a few days ago. I wrote a UDL for ROIAlign as it is not supported by v1.23.

I found ROIAlign has been supported by v1.31.0.522 yesterday. So I setup v1.31 enviroment then tried to convert .caffemode to .dlc. But I got the following error during converting caffe model.

$ snpe-caffe-to-dlc -i caffe/test.prototxt -b caffe/test.caffemodel
2019-10-23 10:09:40,963 - 175 - WARNING - WARNING_CAFFE_FEWER_COEFFS_THAN_INPUT_NUM: Fewer coeffs given than number of inputs. Padding with 1.0.
2019-10-23 10:09:40,964 - 175 - WARNING - WARNING_CAFFE_FEWER_COEFFS_THAN_INPUT_NUM: Fewer coeffs given than number of inputs. Padding with 1.0.
2019-10-23 10:09:40,966 - 175 - WARNING - WARNING_CAFFE_FEWER_COEFFS_THAN_INPUT_NUM: Fewer coeffs given than number of inputs. Padding with 1.0.
2019-10-23 10:09:40,968 - 175 - WARNING - WARNING_CAFFE_FEWER_COEFFS_THAN_INPUT_NUM: Fewer coeffs given than number of inputs. Padding with 1.0.
2019-10-23 10:09:40,971 - 175 - WARNING - WARNING_CAFFE_FEWER_COEFFS_THAN_INPUT_NUM: Fewer coeffs given than number of inputs. Padding with 1.0.
2019-10-23 10:09:40,973 - 175 - WARNING - WARNING_CAFFE_FEWER_COEFFS_THAN_INPUT_NUM: Fewer coeffs given than number of inputs. Padding with 1.0.
2019-10-23 10:09:40,975 - 175 - WARNING - WARNING_CAFFE_FEWER_COEFFS_THAN_INPUT_NUM: Fewer coeffs given than number of inputs. Padding with 1.0.
2019-10-23 10:09:40,977 - 175 - WARNING - WARNING_CAFFE_FEWER_COEFFS_THAN_INPUT_NUM: Fewer coeffs given than number of inputs. Padding with 1.0.
2019-10-23 10:09:40,981 - 165 - ERROR - Node roi_pool_conv5: 'No translation registered for op type caffe_roialign. Op is most likely not supported by the converter.'

It shows that roialign is not support by the converter.I also checked the environment of v1.31 as following and it seems all right:

$ which snpe-caffe-to-dlc
/home/worker/WORK/Dev/Qualcomm_SDK/snpe-1.31.0.522/bin/x86_64-linux-clang/snpe-caffe-to-dlc
(python2.7) $ echo $PYTHONPATH
/home/worker/Soft/caffe/lib_proposal:/home/worker/Soft/caffe/distribute/python:/home/worker/Soft/caffe/build/install/python:/home/worker/WORK/Dev/Qualcomm_SDK/snpe-1.31.0.522/models/alexnet/scripts:/home/worker/WORK/Dev/Qualcomm_SDK/snpe-1.31.0.522/models/lenet/scripts:/home/worker/WORK/Dev/Qualcomm_SDK/snpe-1.31.0.522/lib/python:/home/worker/WORK/Dev/Qualcomm_SDK/snpe-1.31.0.522/models/alexnet/scripts:/home/worker/WORK/Dev/Qualcomm_SDK/snpe-1.31.0.522/models/lenet/scripts:/home/worker/WORK/Dev/Qualcomm_SDK/snpe-1.31.0.522/lib/python::/home/worker/Soft/openCV-3.3.1/lib/python2.7/site-packages

So I wonder whether ROIAlign is support or not on SNPE v1.31.0.522.

FYI:

Part of the .prototxt is below:

layer {
  name: "roi_pool_conv5"
  type: "ROIAlign"                                                                                                                                                                                                                
  bottom: "res3.4.sum"
  bottom: "rois"
  top: "roi_pool_conv5"
  roi_align_param {
    pooled_w: 7  pooled_h: 7
    spatial_scale: 0.0625 # 1/16
  }
}

Best regards!

  • Up0
  • Down0
gesqdn-forum
Join Date: 4 Nov 18
Posts: 184
Posted: Tue, 2019-11-05 03:20

Hi,
Looking into the list of supported layers by SNPE,  "ROI Pooling" is supported and "ROI Align" is not supported by Caffe Framework.

You can go through the below link which lists out all the layers and activation functions supported by SNPE,
https://developer.qualcomm.com/docs/snpe/network_layers.html

  • Up0
  • Down0
zhengxin.zhao
Join Date: 13 Mar 19
Posts: 12
Posted: Tue, 2019-11-05 18:27

Thanks. I got it. From the link we can see ROI Pooling is supported by Caffe Framework. Line 880 in $SNPE_ROOT/lib/python/snpe/converters/common/converter_ir/ir_to_dlc.py defines ROIPooling layer translation.

@register
class DlcRoiPoolingTranslation(DlcTranslationBase):
    TARGET = op_adapter.RoiPoolingOp.TRANSLATION_KEY

    def add_ir_node_as_dlc_layer(self, node, graph, model):
        log_assert(node.op.output_shape[0] == 1,
                   code_to_message.get_error_message("ERROR_ROI_POOL_BATCH_UNSUPPORTED"))


        model.add_roipooling_layer(node.op.name,                                                                                                                                                                        
                                   node.op.pooled_size_w,
                                   node.op.pooled_size_h,
                                   node.op.spatial_scale,
                                   node.op.output_shape,
                                   node.input_names,
                                   node.output_names[0])

From the bold fonts we can see batchsize of output of roipooling must be 1 in this translation. It is very werid because we need multi ROIs so the batchsize of output of roipooling should not be fixed to 1.

  • Up0
  • Down0
zhengxin.zhao
Join Date: 13 Mar 19
Posts: 12
Posted: Tue, 2019-11-05 18:28

Thanks. I got it. From the link we can see ROI Pooling is supported by Caffe Framework. Line 880 in $SNPE_ROOT/lib/python/snpe/converters/common/converter_ir/ir_to_dlc.py defines ROIPooling layer translation.

@register
class DlcRoiPoolingTranslation(DlcTranslationBase):
    TARGET = op_adapter.RoiPoolingOp.TRANSLATION_KEY

    def add_ir_node_as_dlc_layer(self, node, graph, model):
        log_assert(node.op.output_shape[0] == 1,
                   code_to_message.get_error_message("ERROR_ROI_POOL_BATCH_UNSUPPORTED"))


        model.add_roipooling_layer(node.op.name,                                                                                                                                                                        
                                   node.op.pooled_size_w,
                                   node.op.pooled_size_h,
                                   node.op.spatial_scale,
                                   node.op.output_shape,
                                   node.input_names,
                                   node.output_names[0])

From the bold fonts we can see batchsize of output of roipooling must be 1 in this translation. It is very werid because we need multi ROIs so the batchsize of output of roipooling should not be fixed to 1.

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.