You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for building such a helpful tool for converting georeferenced vector annotations to COCO-compatible json.
I'm trying to generate COCO-formatted labels for agricultural fields in the AI4Boundaries dataset, which includes vector annotations for Sentinel-2 image tiles as well as an aerial orthophoto centered in but smaller (by a factor of 1/4th) than the S2 tiles. Ultimately I would like to have the aerial orthophoto as the reference image to be passed into my DL model with the COCO-formatted labels.
When I tried generating the COCO-formatted labels using the S2 images I noticed that the annotations had been split up into 4 parts, which is not the behavior I expected. I observed that the append_dataset function requires a window_bounds which, I think, needs to be smaller than the size of the image. At least when I try to pass a window_bounds=[(512,512)] into the append_dataset I get an error saying that no WindowSchema objects could be created from the given bounds, because the width_step and height_step which are passed into WindowSchema need to be greater than 0. Is there a way to turn off the windowed read entirely, since I would rather not use it for my conversion of the labels?
Relevant code:
test_img = # <-- path to orthophoto TIFF
test_label = # <-- path to geojson
output_dir = # <-- pathlib to output_dir
output_name = # <-- pathlib filename to give output
description = 'Test AI4B dataset'
contributor = 'fangzp'
dataset = create_dataset(description=description, contributor=contributor)
with open(test_label) as f:
labels = geojson.load(f)
raster_source = rasterio.open(test_img)
labels = gpd.GeoDataFrame.from_features(labels['features'], crs=labels['crs']['properties']['name'])
dataset = append_dataset(dataset=dataset,
images_dir = output_dir, # output directory for all label images
labels=labels, # GeoDataFrame containing labels and class info
src=raster_source, # open rasterio reader for input raster
window_bounds=[(raster_source.width, raster_source.height)], # list of window bounds for each tile
id_attribute='category_id', #Column containing category_id values
name_attribute='category_name', # Column with category_name values
super_attribute=None) # Optional column with supercategory values
Final function is where I'm getting the WindowSchema error. Thanks in advance!
The text was updated successfully, but these errors were encountered:
Thanks for building such a helpful tool for converting georeferenced vector annotations to COCO-compatible json.
I'm trying to generate COCO-formatted labels for agricultural fields in the AI4Boundaries dataset, which includes vector annotations for Sentinel-2 image tiles as well as an aerial orthophoto centered in but smaller (by a factor of 1/4th) than the S2 tiles. Ultimately I would like to have the aerial orthophoto as the reference image to be passed into my DL model with the COCO-formatted labels.
When I tried generating the COCO-formatted labels using the S2 images I noticed that the annotations had been split up into 4 parts, which is not the behavior I expected. I observed that the append_dataset function requires a window_bounds which, I think, needs to be smaller than the size of the image. At least when I try to pass a window_bounds=[(512,512)] into the append_dataset I get an error saying that no WindowSchema objects could be created from the given bounds, because the width_step and height_step which are passed into WindowSchema need to be greater than 0. Is there a way to turn off the windowed read entirely, since I would rather not use it for my conversion of the labels?
Relevant code:
Final function is where I'm getting the WindowSchema error. Thanks in advance!
The text was updated successfully, but these errors were encountered: