fuzailpalnak / building-footprint-segmentation

Building footprint segmentation from satellite and aerial imagery
https://fuzailpalnak-buildingextraction-appbuilding-extraction-s-ov1rp9.streamlitapp.com/
Apache License 2.0
127 stars 32 forks source link

import error with latest albumentation versions #37

Closed Tclack88 closed 2 years ago

Tclack88 commented 2 years ago

Hello, I tried running your example, but there's an error. The one I got to was

ImportError: cannot import name 'from_dict' from 'albumentations' (/usr/local/lib/python3.7/dist-packages/albumentations/core/__init__.py)

I suspect in one of the albumentations updates, the locations of some methods were shifted around. There may be other import errors, I haven't gotten past this one just yet, but you may be quicker at finding it as you're more familiar with your code

fuzailpalnak commented 2 years ago

Which version of albumentations did you use ? is it 0.5.0 ?

Tclack88 commented 2 years ago

The latest 1.2.0

I just now looked at your requirements.txt. Excuse me for not looking at it earlier. I'll try those versions and check back (But it would be nice to work with the latest version)

Tclack88 commented 2 years ago

That issue is taken care of now, it's

AttributeError: module 'building_footprint_segmentation.seg.binary.models' has no attribute 'AlBuNet'

Is that something you had locally?

Also, I can see there's certainly going to be other problems, with this specific location "D:\Cypherics" :

.
.
loader = segmentation.load_loader(
    root_folder=r"D:\Cypherics\Library\building-footprint-segmentation\data",
.
.

callbacks = CallbackList([BinaryTestCallback(r"D:\Cypherics\lib_check\out_data")])

# Ouptut from all the callbacks caller will be stored at the path specified in log_dir
for caller in  ["TrainChkCallback", "TimeCallback", "TensorBoardCallback", "TrainStateCallback", "BinaryTestCallback"]:
    callbacks.append(load_callback(r"D:\Cypherics\lib_check\out_data", caller))

All these lines which specifically call on D:\Cypherics, which looks like some local user directory will probably cause an error trying to run

fuzailpalnak commented 2 years ago

Apologies, totally my bad, had the model removed, you can choose from any of these available models [ReFineNetLite, MFRN, ReFineNet] and yes you will have to configure the path and remove the hard coded path

fuzailpalnak commented 2 years ago

Please refer the updated examples in branch exmaples, you will now just have to configure the path for dataset and log dir.

Tclack88 commented 2 years ago

That makes sense. Thank you. Sorry for all the handholding, but I have further questions. I assume I need to download the training data, you listed the massachussets and inria data set, where do those get placed?

I imagine it would be in the root_folder of this line:

root_folder=r"D:\Cypherics\Library\building-footprint-segmentation\data",

But it seems like it should be split into training and validation data, unless pytorch just takes care of all that somehow

Also load callback, is this supposed to be some initially empty directory?

  callbacks.append(load_callback(r"D:\Cypherics\lib_check\out_data", caller))
fuzailpalnak commented 2 years ago

for data you will have to download and split the data the library does not handle data splits the library expects the data be present in the following format

├── train
│   ├── images          # images to train
│   ├── labels          # corresponding ground truth
|
├── val
│   ├── images          # images to validate
│   ├── labels          # corresponding ground truth
│
├── test
│   ├── images 

and for logging it could be any directory and if the directory does not exists then the library creates one. hope this helps

Tclack88 commented 2 years ago

It helps a lot, thank you very much!