Rotated bounding boxes
For working with rotated bounding boxes, please reach out to [email protected] for your free license key.
Rotated bounding box are annotation boxes that have a rotation vs. the vertical or horizontal axis, for example:
Rotated bounding boxes allows to get a better focus around the object and are often used in satellite imagery and other use cases. Rotated bounding box is defined by 4 vertices in the corder, each one has x and y coordinates. We number them as x1,y,x2,y2...
For working with rotated bounding boxes, prepare a csv file in the following format (let's asume the file is named: annotations.csv
)
index,filename,x1,y1,x2,y2,x3,y3,x4,y4,label
0,images/10011_0_0.tiff,828.32,18.09,866.47,43.15,775.87,181.07,737.72,156.01,pylon
1,images/10011_0_0.tiff,817.9,155.27,864.29,185.28,740.46,376.68,694.07,346.67,pylon
2,images/10011_0_0.tiff,834.47,685.91,875.96,712.86,782.08,857.43,740.59,830.48,pylon
3,images/10011_0_0.tiff,816.47,431.04,865.36,464.02,743.65,644.47,694.76,611.49,pylon
4,images/10011_0_0.tiff,719.43,-35.14,770.69,0.74,737.59,48.01,686.33,12.12,pylon
5,images/10011_0_0.tiff,834.54,344.16,874.27,369.97,779.75,515.51,740.02,489.7,pylon
Note: the format is not tolerant for changes in column names.
Run fastdup pointing to the annotations file:
import fastdup
fd = fastdup.create(input_dir='.', work_dir='output')
fd.run(annotations='annotatotions.csv', overwrite=True, license='YOUR_LICENSE_KEY', bounding_box='rotated', augmentation_additive_margin=15,
verbose=False, ccthreshold=0.95)
Note that fastdup handles the rotated bounding box on the c++ side that there is a significant speed gain vs. cropping them in python first.
Full example is here.
Updated about 1 year ago