DeepForest
DeepForest copied to clipboard
CRS not matching in utilities.shapefile_to_annotations
Hi, when I try use shapefile_to_annotations to convert my labels from a shapefile, an error raises as the crs does not match between the image and shapefile. It seems the crs of the shapefile containing an unknown vertical crs but not in the image, and the vertical crs cannot be removed from shapefile.
Codes:
ann = utilities.shapefile_to_annotations(shapefile = annotation + "bounding_box.shp",
rgb = img)
ann.shape
The error message is here:
ValueError Traceback (most recent call last)
in <cell line: 1>() ----> 1 ann = utilities.shapefile_to_annotations(shapefile = annotation +"bounding_box.shp", 2 rgb = img) 3 4 ann.shape /usr/local/lib/python3.10/dist-packages/deepforest/utilities.py in shapefile_to_annotations(shapefile, rgb, buffer_size, geometry_type, savedir) 298 # Check matching the crs 299 if not gdf.crs.to_string() == raster_crs.to_string(): --> 300 raise ValueError("The shapefile crs {} does not match the image crs {}".format( 301 gdf.crs, src.crs)) 302
ValueError: The shapefile crs COMPD_CS["NZGD2000 / New Zealand Transverse Mercator 2000 + unknown",PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",GEOGCS["NZGD2000",DATUM["New_Zealand_Geodetic_Datum_2000",SPHEROID["GRS 1980",6378137,298.257222101,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6167"]],PRIMEM["Greenwich",0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",173],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",1600000],PARAMETER["false_northing",10000000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH]],VERT_CS["unknown",VERT_DATUM["unknown",2005],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Gravity-related height",UP]]] does not match the image crs PROJCS["NZGD2000 / New Zealand Transverse Mercator 2000",GEOGCS["NZGD2000",DATUM["New_Zealand_Geodetic_Datum_2000",SPHEROID["GRS 1980",6378137,298.257222101004,AUTHORITY["EPSG","7019"]],AUTHORITY["EPSG","6167"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4167"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",173],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",1600000],PARAMETER["false_northing",10000000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Easting",EAST],AXIS["Northing",NORTH],AUTHORITY["EPSG","2193"]]
The shapefile was created in arcgis pro 3.1 based on the projection of image, and both shapefile and image has been reprojected use each other's coordination system before training.
Codes are running using google colab.
Not sure what would be the problem here.