项目作者: HiKapok

项目描述 :
Rotate RoI Align and Rotate Position Sensitive RoI Align Operation in Caffe
高级语言: Cuda
项目地址: git://github.com/HiKapok/Caffe_Rotate_Pool.git
创建时间: 2018-12-05T06:40:17Z
项目社区:https://github.com/HiKapok/Caffe_Rotate_Pool

开源协议:Apache License 2.0

下载


Rotate RoI Align Pooling and Rotate Position Sensitive RoI Align Pooling in Caffe

This repository contains codes of two popular Rotate RoI Pooling operation in Caffe, modified from the regular implementation in codes.

#

Usage

  • You need firstly perform conversion from point-from (x1, y1, x2, y2, x3, y3, x4, y4) of the quadrilaterals to rotate bouding boxes in (x, y, w, h, angle). Please consider the following pseudo codes:

    1. pt1 = (x1, y1), pt2 = (x2, y2), pt3 = (x3, y3), pt4 = (x4, y4)
    2. edge1 = sqrt((pt1[0] - pt2[0]) ^ 2 + (pt1[1] - pt2[1]) ^ 2)
    3. edge2 = sqrt((pt2[0] - pt3[0]) ^ 2 + (pt2[1] - pt3[1]) ^ 2)
    4. width = min(edge1, edge2)
    5. height = max(edge1, edge2)
    6. if edge1 > edge2:
    7. angle = 90.0 if pt1[0] - pt2[0] == 0 else -arctan((pt1[1] - pt2[1]) / (pt1[0] - pt2[0])) / pi * 180
    8. elif edge2 >= edge1:
    9. angle = 90.0 if pt2[0] - pt3[0] == 0 else -arctan((pt2[1] - pt3[1]) / (pt2[0] - pt3[0])) / pi * 180
    10. while angle < -45.0:
    11. angle = angle + 180
    12. x = (pt1[0] + pt3[0]) / 2.0
    13. y = (pt1[1] + pt3[1]) / 2.0
  • Now you can add these operation in caffe.proto and rebuild the library, then call with params similar as the regular ones

#

Apache License, Version 2.0