-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to run weed detection #177
Comments
The weed detection workflow requires the input image to be georeferenced. The output is a set of shapefiles, so the workflow needs to be able to map each pixel to a location. The bounding geometry will also be used to crop the parts of the image used in the workflow so you need to ensure the locations overlap at some point. If you'd like to test the workflow out with this image, you can convert the png file to a tif with a mock geometry using the GDAL library and generate a bounding shapefile with GeoPandas. |
Hi Alex, Thanks for the suggestion. I have tried the method above to generate a bounding shapefile for the image. Below is a detailed scenario of processing my image and generating a shapefile. I have created both files (convertor.py), which converts a PNG file to a tif file, and (convert_tif_shp.py), which converts a tif file into a shp file. I have also used the same image as shown above for this workflow. convertor.py
In the convertor.py file, the outputBounds' value I gave is exactly the same as the geojson file from "https://github.com/microsoft/farmvibes-ai/blob/main/notebooks/heatmaps/sensor_farm_boundary.geojson". convert_tif_shp.py
After generating my shapefile, I parse it in the location where it can be downloaded (http://10.42.0.1:8000/testfarmvibe/bounding.shp) to the URL parameter. However, this time I am getting a different error "ValueError: Could not find raster asset in asset list: [AssetVibe(type=None, id='cdc5cc486fedabc761bd5ecacc440832ed7ae4c84c68ee44f812e2eb96476cb7', path_or_url='/mnt/data/assets/cdc5cc486fedabc761bd5ecacc440832ed7ae4c84c68ee44f812e2eb96476cb7/bounding_box.shp', _is_local=True, _local_path='/mnt/data/assets/cdc5cc486fedabc761bd5ecacc440832ed7ae4c84c68ee44f812e2eb96476cb7/bounding_box.shp')]." Is it possible to provide some examples like shapefile or script that helps us to generate a shapefile out of an image if the above code is not working correctly. Thanks again for all the help. |
This worked for me given the posted image. Let me know if you still have issues running the workflow.
|
Hi Alex, After giving the above code a try, I am getting a different error (RuntimeError: Failed to run op weed_detection in workflow run id c58f031a-5864-4c34-b13b-22586d62b747 for input with message id 00-c58f031a58644c34b13b22586d62b747-c1a11fe835ffc40d-01. Error description: <class 'RuntimeError'>: ValueError('Input shapes do not overlap raster.') Would it be possible if you can share an example of your geojson file? Just curious, is this where u get your geojson file (https://github.com/microsoft/farmvibes-ai/blob/main/notebooks/heatmaps/sensor_farm_boundary.geojson)? Best, |
I did not use a geojson file; I used the shapefile output from the above script as the boundary for the weed detection workflow. |
Below is the weed.py similar to the notebook example.
After running the above workflow, with the shapefile generated by the code you shared. I am getting the following error.
Apart from the above error, If I am generating my own shape file, do I need a url parse in the notebook? Would you mind sharing your workflow file so that I can compare and understand better? Best, |
It looks like you're trying to get GeoPandas to read the remote file. You can download the relevant files to the local machine.
|
After making gpd to read the output.shp locally, I am getting the following issue.
I just realized that, I need a url hash as an input to the workflow. Below is the updated of my workflow
|
The urls member of the ExternalReferenceList should contain the location of the raster. In your code, this parameter should be something more like |
In which step did you encounter the bug?
FarmVibes.AI setup
Are you using a local or a remote (AKS) FarmVibes.AI cluster?
Local cluster
Bug description
I have set up my weed detection environment and a server providing access to my local files using a URL so that it can download both geojson and raster images. However, when I execute the code, I can get the workflow to unpack and download, but not running the weed detection model successfully. I looked a little into the code and noticed that the output function is returning None since the status return failed. Apart from that, I am getting an error of "ValueError: Must pass either crs or epsg." I am not entirely sure what is missing in between. Any help would be greatly appreciated
Steps to reproduce the problem
$micromamba activate weed_detection
$ python3 -m http.server
weed.png (I am not sure if this can cause an issue to the model)
sensor_farm_boundary.geojson (took the geojson from here to test)
https://github.com/microsoft/farmvibes-ai/blob/main/notebooks/heatmaps/sensor_farm_boundary.geojson
The text was updated successfully, but these errors were encountered: