GithubHelp home page GithubHelp logo

esfnet-pytorch's Introduction

ESFNet: Efficient Networks for Building Extraction from High-Resolution Images

The implementation of novel efficient neural network ESFNet

Clone the Repository

git clone https://github.com/mrluin/ESFNet-Pytorch.git
cd ./ESFNet-Pytorch

Installation using Conda

conda env create -f environment.yml
conda activate esfnet

Sample Dataset

For training, you can use as an example the WHU Building Datase.

You would need to download the cropped aerial images. The 3rd option

Directory Structure

Directory:
            #root | -- train 
                  | -- valid
                  | -- test
                  | -- save | -- {model.name} | -- datetime | -- ckpt-epoch{}.pth.format(epoch)
                            |                               | -- best_model.pth
                            |
                            | -- log | -- {model.name} | -- datetime | -- history.txt
                            | -- test| -- log | -- {model.name} | --datetime | -- history.txt
                                     | -- predict | -- {model.name} | --datetime | -- *.png

Training

  1. set root_dir in ./configs/config.cfg, change the root_path like mentioned above.
  2. set divice_id to choose which GPU will be used.
  3. set epochs to control the length of the training phase.
  4. setup the train.py script as follows:
python -m visdom.server -env_path='./visdom_log/' -port=8097 # start visdom server
python train.py

-env_path is where the visdom logfile store in, and -port is the port for visdom. You could also change the -port in train.py.

If my work give you some insights and hints, star me please! Thank you~

esfnet-pytorch's People

Contributors

mrluin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

esfnet-pytorch's Issues

ESFNet-interp8x & ESFNet-mini-ex

@mrluin
Can you add interp8x & mini-ex models for training.
They seem interesting, because they have higher fps & lesser parameters than base ESFNet.
You can send the code to me privately by email if you don't want to share.

Bad prediction results

@mrluin
After training the WHU Building Dataset (The cropped aerial image tiles and raster labels) for 300 epoch, I used the checkpoint-best.pth for predicting an image, but:

  • The prediction results were really bad.
  • Every time I ran predict.py, the predicted result was different from before each time.

The files are attached below, containing (log, input, output, groundtruth, model):
results.zip

Here are some images of the results,
First example:

result

Second example:

result2

Prepare Training Data: image color & extension

@mrluin
When training using my training data (download the file here), I get an error message:

python train.py -gpu 1
.
.
.
)
CrossEntropyLoss()
     + Visualization init ... ...
     + Loaded, Training !
Epoch 1 validation done !
Traceback (most recent call last):
  File "train.py", line 183, in <module>
    main(config= config, args = args)
  File "train.py", line 114, in main
    visdom=viz)
  File "train.py", line 39, in for_train
    Trainer.train()
  File "/home/home/programs/ESFNet-Pytorch/BaseTrainer.py", line 285, in train
    eval_log = self._eval_epoch(epoch)
  File "/home/home/programs/ESFNet-Pytorch/BaseTrainer.py", line 451, in _eval_epoch
    ave_iou.average(), ave_acc.average(), ave_total_loss.average()))
TypeError: unsupported format string passed to NoneType.__format__

测试问题

您好,我想知道如何利用训练好的权重直接预测图片,是直接运行launcher.py吗? 谢谢

How to predict image directly

Good code! But I just predict image directly without training processing.
I have not seen model parameter file such as .pth. How to run predict.py?
Thanks!

数据格式

我直接用whubuilding数据跑了,结果不对,请问是数据格式用改吗?

train.py [SyntaxError: invalid syntax] & visdom [No such file or directory]

@mrluin Thank you for your hard work,

When running the training commands that you stated, I get error messages:

(esfnet) home@home-desktop:~/programs/ESFNet$ python -m visdom.server -env_path='./visdom_log' -port=8098 # start visdom server
Checking for scripts.
It's Alive!
Traceback (most recent call last):
  File "/home/home/anaconda3/envs/esfnet/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/home/anaconda3/envs/esfnet/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/home/anaconda3/envs/esfnet/lib/python3.6/site-packages/visdom/server.py", line 1308, in <module>
    download_scripts_and_run()
  File "/home/home/anaconda3/envs/esfnet/lib/python3.6/site-packages/visdom/server.py", line 1304, in download_scripts_and_run
    main()
  File "/home/home/anaconda3/envs/esfnet/lib/python3.6/site-packages/visdom/server.py", line 1299, in main
    print_func=print_func, user_credential=user_credential)
  File "/home/home/anaconda3/envs/esfnet/lib/python3.6/site-packages/visdom/server.py", line 1218, in start_server
    readonly=readonly, user_credential=user_credential)
  File "/home/home/anaconda3/envs/esfnet/lib/python3.6/site-packages/visdom/server.py", line 145, in __init__
    env_jsons = [i for i in os.listdir(env_path) if '.json' in i]
FileNotFoundError: [Errno 2] No such file or directory: './visdom_log'

Also when running train.py:

(esfnet) home@home-desktop:~/programs/ESFNet$ python train.py
  File "train.py", line 58
    ,)
    ^
SyntaxError: invalid syntax

Training & prediction of High-resolution images using Patches

@mrluin Thank you for your hard work,
Issue:

  1. One of the biggest issues currently facing ESFNet is not being able to train & predict
    High-resolution images without loading the entire image into the memory.

  2. Also, the images used for training & prediction are Multi-resolution images, they don't have identical Hight x Width.

Solution:

  1. Create cropped Patches from the original High-resolution image in both training & prediction.
    This will allow images to be processed without throttling the memory.
  2. Also add margins to the cropped patches to avoid border effects.

Note: an implementation of the suggested solution is already available at the Robin repository.

  • In-which dataset.py creates patches with margins using the input images
  • Then train using train.py
  • Finally, run binarize.py which takes input high-resolution multisized images, and recognizes it from it's patches.

Waiting for your reply

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.