VIDA-NYU / tile2net

Automated mapping of pedestrian networks from aerial imagery tiles
BSD 3-Clause "New" or "Revised" License
146 stars 22 forks source link

How to use self prepared raster? #42

Closed twoyoung91 closed 7 months ago

twoyoung91 commented 8 months ago

The instruction says:“You may also instantiate a Raster using a local directory of tiles, given that the tiles are in the correct {Xtile}{Y_tile}.{file_format} xyz format. In this case you must specify the zoom of the local tiles.

raster = Raster( location=location, name='central_park', input_dir='<path/to/tiles/z/y/x.png>', zoom=19, ) raster”

The format suggested in the first sentence seems different from your example code (X_Y.png, vs 19\Y\X.png), would you please clarify the correct folder structure of self-prepared PNG rasters? Then how to call it in the command?

Thanks a lot for your help!

dhodcz2 commented 8 months ago

The reason for this discrepancy as you have noticed is that the first line is outdated documentation. The folder structure is arbitrary, it parses the X and Y from the path defined so the user need not restructure their directories to use Tile2Net. So you would literally type out something like input_dir='/home/twoyoung91/central_park/18/x__y.png' and it selects all the files in that directory using that format.

If you are asking about the commandline, you would pass the same string to the --input option in the commandline. You can see options using python -m tile2net generate --help:

 --input INPUT_DIR, -i INPUT_DIR
 The path to the input directory, implicating the format of the files, containing the xtile, ytile, and extension, and possibly containing the zoom level, e.g. path/to/tiles/z/x/y.ext or path/to/tiles/x_y.ext (default: -)

Thanks for your interest in Tile2Net and for pointing this out.

twoyoung91 commented 8 months ago

The reason for this discrepancy as you have noticed is that the first line is outdated documentation. The folder structure is arbitrary, it parses the X and Y from the path defined so the user need not restructure their directories to use Tile2Net. So you would literally type out something like input_dir='/home/twoyoung91/central_park/18/x__y.png' and it selects all the files in that directory using that format.

If you are asking about the commandline, you would pass the same string to the --input option in the commandline. You can see options using python -m tile2net generate --help:

 --input INPUT_DIR, -i INPUT_DIR
 The path to the input directory, implicating the format of the files, containing the xtile, ytile, and extension, and possibly containing the zoom level, e.g. path/to/tiles/z/x/y.ext or path/to/tiles/x_y.ext (default: -)

Thanks for your interest in Tile2Net and for pointing this out.

Thanks for your help, I was able to make predictions on my custom raster dataset. However, the model does not work well in suburban areas of Southern states, I think that is due to the training set you used being mostly from urban areas of high-density cities. If I wish to re-train the model, is there an API I can use in your package now?

Mary-h86 commented 8 months ago

@twoyoung91 Thank you for your interest and happy to know you were able to run it on your own data!

Regarding the model performance, yes. As of now the model performs best in the areas with urban fabric similar to the highly dense urbanized areas it was trained on. However, we are extending the model both in terms of number of classes and variation of the built environment to be able to generalize better for suburban and lower-density areas. The training code is not available publicly yet, but once the new model is trained, we will share the weights and update our documentation.

Mary-h86 commented 7 months ago

Since your issue has been resolved, I am closing this thread. Thank you for bringing it to our attention, and feel free to open a new issue if you encounter any more problems or have further questions.