Caffe_Rotate_Pool icon indicating copy to clipboard operation
Caffe_Rotate_Pool copied to clipboard

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

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:

    t1 = (x1, y1), pt2 = (x2, y2), pt3 = (x3, y3), pt4 = (x4, y4)
    
    dge1 = sqrt((pt1[0] - pt2[0]) ^ 2 + (pt1[1] - pt2[1]) ^ 2)
    dge2 = sqrt((pt2[0] - pt3[0]) ^ 2 + (pt2[1] - pt3[1]) ^ 2)
    
    idth = min(edge1, edge2)
    eight = max(edge1, edge2)
    
    f edge1 > edge2:
    angle = 90.0 if pt1[0] - pt2[0] == 0 else -arctan((pt1[1] - pt2[1]) / (pt1[0] - pt2[0])) / pi * 180
    lif edge2 >= edge1:
    angle = 90.0 if pt2[0] - pt3[0] == 0 else -arctan((pt2[1] - pt3[1]) / (pt2[0] - pt3[0])) / pi * 180
    hile angle < -45.0:
    angle = angle + 180
    
     = (pt1[0] + pt3[0]) / 2.0
     = (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