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

Error when I run the reproducible example in bash #33

Closed ambarja closed 11 months ago

ambarja commented 11 months ago

Hi @aecio @remram44 @julianafreire @fabio-miranda I recently tried this freeware, good job and contribution to the community. I have a little problem when I run the example in bash. I thought the error was because I didn't have geopandas or shapely installed, but I do have it installed. What could be the problem 👀 ? Thanks in advance, greetings from Peru.

$ bash ./examples/example.sh
Please enter the output directory:

Tile generation will now begin.
INFO       Geocoding [42.3536483721, -71.0716891532, 42.3555518995, -71.0643742337], this may take awhile...
INFO       Using Massachusetts as the source at location=[42.3536483721, -71.0716891532, 42.3555518995, -71.0643742337]
INFO       Using base_tilesize=256 from source
INFO       Stitching Tiles...
           Checking 96 files...                   :   0%|          | 0/96 [00:00           Checking 96 files...                   : 100%|##########| 96/96 [00:00<00:00, 48268.18it/s]
INFO       All 96 tiles are on disk.
INFO       All tiles already stitched.
INFO       Dumping to .\example\tiles\example_256_info.json
DEBUG      Inference piped
INFO       Inferencing. Segmentation results will be saved to .\example\segmentation
INFO       Using base_tilesize=256 from source
INFO       Polygons are generated and saved!
INFO       Starting network creation...
Using regular batch norm
ignore_label = -1
num_classes = 4
Found 6 folder imgs
all imgs 6
Using Per Image based weighted loss
Using Cross Entropy Loss
Loading weights from: checkpoint=C:\Users\USER\Downloads\test-milagros\tile2net\src\tile2net\raster\resources\assets\weights\satellite_2021.pth
=> init weights from normal distribution
=> loading pretrained model C:\Users\USER\Downloads\test-milagros\tile2net\src\tile2net\raster\resources\assets\weights\hrnetv2_w48_imagenet_pretrained.pth
Trunk: hrnetv2
Model params = 72.1M
Inference [Iter: 1 / 6]
100%|##########| 32/32 [00:00<00:00, 6422.52it/s]
100%|##########| 32/32 [00:00<00:00, 4013.81it/s]
INFO       ..... creating the processed sidewalk network
C:\Python311\Lib\site-packages\geopandas\array.py:1486: UserWarning: CRS not set for some of the concatenation inputs. Setting output's CRS as WGS 84 / Pseudo-Mercator (the single non-null crs provided).
  warnings.warn(
100%|##########| 14/14 [00:00<00:00, 13530.01it/s]
100%|##########| 14/14 [00:00<00:00, 7022.27it/s]
C:\Python311\Lib\site-packages\shapely\linear.py:208: RuntimeWarning: invalid value encountered in shortest_line
  return lib.shortest_line(a, b, **kwargs)

Here some libraries when I run pip list 👇

geopandas                     0.13.2
geopy                            2.3.0
numpy                          1.24.4
opencv-python            4.8.0.74
osmnx                          1.6.0
packaging                     23.1
pandas                          2.0.3
rasterio                        1.3.8
tile2net                         0.3.0                   
torch                             2.1.0.dev20230805+cu121
torchaudio                    2.1.0.dev20230805+cu121
torchvision                   0.16.0.dev20230805+cu121
ambarja commented 11 months ago

However, when I run the script in jupyter Lab, this is successful 🥳 , I just have a question, in raster.generate(2), why 2 ?

question02

image

Mary-h86 commented 11 months ago

@ambarja Thank you for your interest in Tile2Net! Regarding the bash run, your code has run successfully! The message you are seeing is not an error, it is a warning and it does not stop the code execution. The reason you are not seeing any outputs being saved is that you did not provide any path for the outputs to be saved when you were prompted "Please enter the output directory:" and I guess you only pressed enter. The program will run in this case but the outputs will not be saved.

Regarding the interactive run, the input that generate takes, is called stitch_step, this is the number of tiles to stitch together to create larger tiles so the segmentation model has more context to work with. When stitch step is 1 (default when you construct the grid), no stitching will occur, 2, means we stitch every 2 tiles together, and If you want to stitch every 4 tiles together, you would pass 4. generally, if you are zoom level 20, and base tile size of 256, stitch step=4 works the best. if you use the default zoom level 19 with base size 256, 2 is a better choice, it gives enough context to the model and still preserves the details.

Hope these answers your questions! We will modify the notebook description for that cell to reflect this more clearly.

Mary-h86 commented 11 months ago

Since there was no error, I will close this issue. Feel free to re-open should you have any questions.

ambarja commented 11 months ago

@Mary-h86 thanks you for you support