-
Notifications
You must be signed in to change notification settings - Fork 110
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
Couple of changes/enhancements #135
base: master
Are you sure you want to change the base?
Conversation
If multiple countries are provided as part of list, or if AOI overlaps two countries, downloads across borders.
aoi_name is useful to give a name extension to the classification.geojson. country as list allows downloading of multiple countries at once.
Converted it to ares to roughly match a Sentinel-2 pixel size.
with open(download_file, 'wb') as w: | ||
for line in r: | ||
w.write(line) | ||
for ctr in country: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iterating over country list
mbtiles_file_zoomed = op.join(dest_folder, '{}-z{!s}.mbtiles'.format(country, zoom)) | ||
|
||
if not op.exists(mbtiles_file_zoomed): | ||
filtered_geo = kwargs.get('geojson') or op.join(dest_folder, '{}.geojson'.format(country)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, I am not sure I understand why kwargs.get('geojson') is picked up here for the variable. This would assume that the geojson provided in the config.json
file contains the label features on which to generate the labelled output for classification, object detection or segmentation.
However, I cannot see a use case where someone would provide their labelled features as a standalone geojson file, because then would they really need to use the label-maker?
If we keep the geojson
attribute in its current defintion, I still see the value of an aoi
field to provide the AOI in the form of geometries, as an alternative to the country+bbox
combination.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wouellette the geojson
attribute is provided so users can add a standalone GeoJSON file. label-maker
still provides value here in that it will chip up the imagery and GeoJSON labels, rasterize or create object labels, etc. We need to keep this attribute as it's used in a number of existing workflows.
label_maker/main.py
Outdated
@@ -85,12 +85,11 @@ def cli(): | |||
|
|||
# custom validation for top level keys | |||
# require either: country & bounding_box or geojson | |||
if 'geojson' not in config.keys() and not ('country' in config.keys() and 'bounding_box' in config.keys()): | |||
raise Exception('either "geojson" or "country" and "bounding_box" must be present in the configuration JSON') | |||
if not ('country' in config.keys() and 'geojson' in config.keys()) and not ('country' in config.keys() and 'bounding_box' in config.keys()): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change relates to the change of the filtered_geo
variable, where I interpreted the geojson
attribute to be an alternative to provide the AOI instead of country+bbox
combination.
@wouellette 👍 on multiple countries and the label_area addition, see my comments inline for the |
Apology on the clumsy implementation, I was planning on reworking it, but just wanted to discuss the value of the changes first. About the |
label_maker/label.py
Outdated
label_bool2 = label_bool | ||
label_area2 = label_area | ||
if ctr == country[-1]: | ||
json.dump(fc(features), open(op.join(dest_folder, f'classification_{zoom}.geojson'), 'w')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added zoom
to file name to identify the zoom level at which labelled output was generated.
Ha, apologies, I meant that my implementation of the |
@wouellette giving a more thorough look now. Can you add a test case for this also? It breaks all of the tests now because of the country list change and change to the output; I can help with updating those |
Better late than never, I updated the test cases, but the WMS endpoint is still failing because the usgs wms used for the test is not matching the fixture tile. I guess they updated the imagery in usgs to cause this mismatch? Edit: I am working on the integration tests too FYI. |
@wouellette awesome; if you pull in master I updated the WMS test to point to a new endpoint |
sync with original repo
# Conflicts: # requirements.txt
The integration tests were also updated. They all passed, but I had to update the label tile outputs as the former ones were reflecting the presence/absence with 1s and 0s of a class, whereas now it is the surface area which is represented (values other than 0s and 1s). |
@wouellette thanks, I will likely get a chance to check this out this week; can you remove your |
Change base SentinelHub layer, close developmentseed#139
@wouellette gave a quick look today and looks really solid. Two other requests:
|
Regarding your two requests:
|
Hi Drew,
Sorry for taking so long to get back to this, but in the mean time I have been working on my own head and I came up with more than just the "label_area" improvement suggested in the previous pull request, so decided to create a new one here to discuss the additional changes I came up with, and that I think would be of common interest, especially the support for create labels across country borders. See list of improvements below:
country
can be provided aslist()
instead of single string, thus allowing the download and label generation for multiple countries in one go. This stemmed from the need to generate labels for AOIs overlapping two countries.ml_type=classification
from Add "label_area" attribute to classification.geojson #128 is taken up here.geojson
attribute of providing one's own labelled features. When would that be the case? I interpreted it as an alternative to providing the AOI instead of thebounding_box+country
combination. Maybe keeping the originalgeojson
attribute and adding anaoi
attribute to cover my intended functionality could make sense.Let's discuss on the common ground for this pull request, what could be taken up from what couldn't, and once we agree I can work on the tests.
Cheers,
William