I have .tif raster files from the SpaceNet dataset, along with corresponding object descriptions in geojson files. I want to be able to generate Darknet style bounding box information ([object_class, x_center, y_center, width, height]) from this data. Note that the class is same for all objects in one geojson file.
I am unable to find any suitable tutorial or guide to perform this transformation. The spacenet utilities guide on GitHub is old and doesn't work. Could anybody please help me with this transformation? I am not sure if rasterio can be used to do this.
Download sample .geojson file here: https://ufile.io/drcjt
Download sample .tif file here: https://ufile.io/wsq92
Edit: Please note that the Darknet style bounding box ([object_class, x_center, y_center, width, height]) assumes a rectangle in output, rather than a polygon.
x_center
andy_center
have to be in geographic coordinates or in array coordinates?width
andheight
in degrees or number of pixels? – Loïc Dutrieux Jul 21 '18 at 5:07