Comments (12)
You can upload it to me via this link.
from segment-geospatial.
This bug has been fixed in v0.3.0. Please update the package and try again.
from segment-geospatial.
I used raster to polygon geoprocessing tool in order to see how good the result is overlayed.
This is the geospatial reference information screen that shows the mask that is created with the sam-generate wgs84 coordinate system.
And this is the original tiff file that is used for mask generation. It also has wgs84 coordinate system as described in its geospatial reference information.
By the way, I would like to say huge thanks for creating this amazing module open source, thank you so much for your amazing work. @giswqs You are the real MVP in GIS.
I would like to say sorry if my workflow is not correct and flagged this as a bug. Regards.
from segment-geospatial.
What bbox
did you use?
from segment-geospatial.
Can you provide complete source code that can reproduce the issue?
from segment-geospatial.
I didn't pass any bbox value since I thought the clipped region that I derivated from the inclusive aerial image has already bbox regions inside of its metadata.
I didn't use this:
if m.user_roi_bounds() is not None:
bbox = m.user_roi_bounds()
else:
bbox = [-95.3704, 29.6762, -95.368, 29.6775]
and this function:
tms_to_geotiff(output=image, bbox=bbox, zoom=20, source='Satellite')
from segment-geospatial.
Can you share the input geotiff for debugging?
from segment-geospatial.
It appears that the inference runs successfully. You can use the following function directly to debug the issue.
https://samgeo.gishub.org/samgeo/#samgeo.samgeo.SamGeo.tiff_to_vector
def tiff_to_vector(tiff_path, output, simplify_tolerance=None, **kwargs):
"""Convert a tiff file to a gpkg file.
Args:
tiff_path (str): The path to the tiff file.
output (str): The path to the vector file.
simplify_tolerance (_type_, optional): The simplify tolerance. Defaults to None.
"""
import geopandas as gpd
import rasterio
from rasterio import features
with rasterio.open(tiff_path) as src:
band = src.read()
mask = band != 0
shapes = features.shapes(band, mask=mask, transform=src.transform)
fc = [
{"geometry": shapely.geometry.shape(shape), "properties": {"value": value}}
for shape, value in shapes
]
if simplify_tolerance is not None:
for i in fc:
i["geometry"] = i["geometry"].simplify(tolerance=simplify_tolerance)
gdf = gpd.GeoDataFrame.from_features(fc)
gdf.set_crs(epsg=src.crs.to_epsg(), inplace=True)
gdf.to_file(output, **kwargs)
from segment-geospatial.
Can you share the input geotiff for debugging?
Do you mind if I ask how to share the sample data with you? Which vendor do you prefer, I can send it with an uploaded file link(can share it here or right into your mailbox). The system doesn't allow data of more than 25 MB, and my sample data is around ~100MB. I refrain from choosing a method that is not suitable for you. I want to contribute even if this sample data will improve your workflow.
from segment-geospatial.
Okay, with the inference function you have provided, I was able to create a shape vector file with WKID code 3857 without any complications(it is a different projection so you cannot overlay it properly). However, when I try it with the code 4326, the shapefile was created with polygon attributes but you cannot show data on the map viewer.
I have tried a bunch of other epsg codes, so you can easily see output on the viewer but it cannot be overlayed on the real tiff data due to their projections do not match. They all work but in a way of is not expected.
This is how I debugged it:
And this is the output:
All of them work but their end results don't match(it is expected). The only one which is not worked: is the attempt with code 4326. The shapefile was created but cannot be seen.
Do you mind if I request to try it out with the sample I provided via your link? Thank you so much for your patience and efforts, dear Wu.
from segment-geospatial.
I think the problem is your input dataset. From the image extent numbers, it is clearly those numbers are not lat/lon. They are likely epsg:3857. But the CRS shows that it is WGS 1984, which is wrong. So my question is how did you get that dataset? The CRS was not assigned properly.
The correct one should look like this.
from segment-geospatial.
Thank you so much, dear Wu.
The problem is solved by changing the data's geospatial coordinate reference system into GCS_WGS_1984(4326) from pseudo-Mercator(3857), so extend parameters are converted into decimal degrees and the inference code worked flawlessly.
It is right that there is a problem with the main sample tiff, I derived it from our database(which is shown and used in [here](https://sehirharitasi.ibb.gov.tr/ as "2022 Uydu" in the layer selection section). The sample tiff was ESRGAN applied version of raw data(It was the project in which I enhanced raw data with super-resolution techniques). There could be an issue when mosaicking tile files into a raster file.
However, bear in mind: The function in the sample notebook still asks for crs for being set by the user while the inference function runs great if you set the crs in it.
shapefile = 'segment_gpu_new_decimal_degrees.shp'
sam.tiff_to_vector(mask, shapefile)
from segment-geospatial.
Related Issues (20)
- localtileserver issue HOT 9
- Add Batch process for fast same
- failed in activating conda environment HOT 3
- installing dependencies error HOT 2
- Add batch processing for Fast-SAM
- Add_vector is not working always, segment geopackage is not loading onto the map HOT 1
- Mask from automatic mask generator with batch mode not working
- samgeo.hq_sam not working in docker HOT 4
- Add SAM-based object detection using selecting just one sample of a class HOT 2
- Add support for EfficientSAM
- samgeo fails to load in conda/mamba environment HOT 1
- self.save_masks unique value mask results are covered HOT 1
- Initialise FastSAM is not working HOT 7
- samgeo installation failed on arcggis pro 2.9 HOT 2
- Problem with the Interactive segmentation using Points on Image HOT 1
- Arcgis Pro 3.2 samgeo installation error: rumtime error HOT 1
- batch predict
- sam.generate(): Error with uploaded images HOT 2
- warning libmamba Added empty dependency for problem type SOLVER_RULE_UPDATE Could not solve for environment specs The following package could not be installed └─ segment-geospatial is installable and it requires └─ pycocotools with the potential options HOT 5
- SamGeo() cannot download model vit_h (samgeo.hq_sam) HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from segment-geospatial.