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 with Tile2Net in Google Colab #35

Closed ambarja closed 11 months ago

ambarja commented 11 months ago

Recently I run tile2net with Google colab but I have the follow error , I have seen the issue #16

raster.inference()
INFO       Running ['python', '-m', 'tile2net', 'inference', '--city_info', 'example_dir/boston_common/tiles/boston_common_256_info.json', '--interactive']
ERROR      Command ['python', '-m', 'tile2net', 'inference', '--city_info', 'example_dir/boston_common/tiles/boston_common_256_info.json', '--interactive'] returned non-zero exit status 1.
Stdout: Using regular batch norm
ignore_label = -1
num_classes = 4
Found 60 folder imgs
all imgs 60
Using Per Image based weighted loss
Using Cross Entropy Loss
Loading weights from: checkpoint=/content/tile2net/src/tile2net/raster/resources/assets/weights/satellite_2021.pth
=> init weights from normal distribution
=> loading pretrained model /content/tile2net/src/tile2net/raster/resources/assets/weights/hrnetv2_w48_imagenet_pretrained.pth
Trunk: hrnetv2
Model params = 72.1M

Stderr: 2023-08-19 16:20:26.627047: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX512F FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-08-19 16:20:27.862952: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
DEBUG      Inference unpiped
INFO       Inferencing. Segmentation results will be saved to example_dir/boston_common/segmentation
INFO       Using base_tilesize=256 from source
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/content/tile2net/src/tile2net/__main__.py", line 7, in <module>
    argh.dispatch_commands([
  File "/usr/local/lib/python3.10/dist-packages/argh/dispatching.py", line 349, in dispatch_commands
    dispatch(parser, *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/argh/dispatching.py", line 179, in dispatch
    for line in lines:
  File "/usr/local/lib/python3.10/dist-packages/argh/dispatching.py", line 290, in _execute_command
    for line in result:
  File "/usr/local/lib/python3.10/dist-packages/argh/dispatching.py", line 243, in _call
    result = function(namespace_obj)
  File "/content/tile2net/src/tile2net/namespace.py", line 640, in wrapper
    return func(namespace, **kwargs)
  File "/content/tile2net/src/tile2net/tileseg/inference/__init__.py", line 303, in inference
    run_inference()
  File "/content/tile2net/src/tile2net/tileseg/inference/__init__.py", line 202, in run_inference
    validate(val_loader, net, criterion=None, optim=None, epoch=0,
  File "/content/tile2net/src/tile2net/tileseg/inference/__init__.py", line 262, in validate
    dumper.dump(
  File "/content/tile2net/src/tile2net/tileseg/utils/misc.py", line 354, in dump
    grid.tiles[grid.pose_dict[int(idd_)]].map_features(np.array(prediction_pil), img_array=True)
  File "/content/tile2net/src/tile2net/raster/tile.py", line 295, in map_features
    roads = self.mask2poly(src_img,
  File "/content/tile2net/src/tile2net/raster/tile.py", line 256, in mask2poly
    simplified.to_crs(self.crs, inplace=True)
  File "/usr/local/lib/python3.10/dist-packages/geopandas/geodataframe.py", line 1424, in to_crs
    geom = df.geometry.to_crs(crs=crs, epsg=epsg)
  File "/usr/local/lib/python3.10/dist-packages/pandas/core/generic.py", line 5902, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'Series' object has no attribute 'to_crs'. Did you mean: 'to_csv'?

---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
[<ipython-input-16-b133e1b4c6d9>](https://localhost:8080/#) in <cell line: 1>()
----> 1 raster.inference()

3 frames
[/usr/lib/python3.10/subprocess.py](https://localhost:8080/#) in run(input, capture_output, timeout, check, *popenargs, **kwargs)
    524         retcode = process.poll()
    525         if check and retcode:
--> 526             raise CalledProcessError(retcode, process.args,
    527                                      output=stdout, stderr=stderr)
    528     return CompletedProcess(process.args, retcode, stdout, stderr)

CalledProcessError: Command '['python', '-m', 'tile2net', 'inference', '--city_info', 'example_dir/boston_common/tiles/boston_common_256_info.json', '--interactive']' returned non-zero exit status 1.
Mary-h86 commented 11 months ago

@ambarja Thank you for providing your google colab script. I have made some adjustments to the convex_hull function which should resolve the issue. Please do a git pull or a fresh clone and run again. Let me know if you encounter any other problems.

ambarja commented 11 months ago

Thank you for your support, the exit is now successful. image