VSainteuf / pytorch-psetae

PyTorch implementation of the model presented in "Satellite Image Time Series Classification with Pixel-Set Encoders and Temporal Self-Attention"
MIT License
179 stars 39 forks source link

geomfeat in paper #5

Closed dgketchum closed 3 years ago

dgketchum commented 4 years ago

Hi VSainteuf! I really like your paper. I'm trying to reproduce LTAE using PSE on my own data from irrigated and unirrigated parcels in the US. I wonder what you used to populate 'geomfeat.json'? I've extracted latitude, longitude, and elevation, did you use something like this? Thanks!

VSainteuf commented 4 years ago

Hi! Thanks very much for your interest! We pre-computed 4 features per parcel to populate geomfeat.json:

As the name of the file suggests all these are geometric features describing the parcel's shape. For now we did not use the features you mentioned (lat/lon, elevation), mainly because the parcels of our dataset are all located in the same Sentinel-2 tile. But if you intend to apply the model on a wider geographical scope, it's definitely a good idea to also include this information.

SouhaMourou commented 1 year ago

Hi! Thanks very much for your interest! We pre-computed 4 features per parcel to populate geomfeat.json:

  • Parcel Perimeter (meters)
  • Parcel Area (squared meters)
  • Perimeter / Area
  • Cover ratio : the number of pixels in the parcels divided by the number of pixels in the rectangular bounding box containing the parcel.

As the name of the file suggests all these are geometric features describing the parcel's shape. For now we did not use the features you mentioned (lat/lon, elevation), mainly because the parcels of our dataset are all located in the same Sentinel-2 tile. But if you intend to apply the model on a wider geographical scope, it's definitely a good idea to also include this information.

How can we identify the Number of pixels in the rectangular bounding box containing the parcel??? is there a specific script to generate the geomfeat file for a custom dataset

VSainteuf commented 1 year ago

You can use the shapely library for that. Loading you parcel boundaries as Polygon objects, then calling polygon.envelope.area gives you the area of the bounding box. So you obtain the cover ratio by dividing polygon.area / polygon.envelope.area