nasaharvest / presto

Lightweight, Pre-trained Transformers for Remote Sensing Timeseries
https://arxiv.org/abs/2304.14065
MIT License
151 stars 26 forks source link

Lat/long looks flipped by pyproj.Transformer #6

Closed miraanand closed 1 year ago

miraanand commented 1 year ago

Hi, this is really interesting! I'm trying out the downstream task notebook as I am looking into applying this approach to wetland classification.

This repo uses pyproj's Transformer.transform() (eg in the downstream task notebook) which can sometimes swap the order of coordinates depending on the coordinate system. Specifically, EPSG:4326 uses lat/long whereas the input UTM data uses long/lat. In the example I linked, this results in the two variables being switched.

Adding always_xy=True to the transformer would keep the ordering consistent throughout (see the warning on the docs).

It's not clear to me whether this would affect the pre-trained model, but I see the same line in at least the eurosat and treesat eval files. It doesn't seem to significantly affect the F1 score on the example notebook however.

Even if there aren't other impacts I think that updating the order so that the variables are named correctly would avoid confusion.

Thanks!

gabrieltseng commented 1 year ago

Hi @miraanand ,

Thank you for your interest in the project, and for spotting this. Fortunately, it doesn't affect the pre-trained model, since no transformation of the coordinates is necessary for the pretraining data.

However, you are right that this affects the EuroSat and TreeSatAI tasks. I have rerun everything with the corrected latlons (results are in #7 ), and implemented the always_xy fix you suggested.

Thanks again!