Giter VIP home page Giter VIP logo

model-uncertainty-for-adaptation's Introduction

In this package, we provide our PyTorch code for out CVPR 2021 paper on Model Adaptation for Segmentation. If you use our code, please cite us:

@inproceedings{teja2021uncertainty,
  author={S, Prabhu Teja and Fleuret, François},
  booktitle={2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)}, 
  title={Uncertainty Reduction for Model Adaptation in Semantic Segmentation}, 
  year={2021},
  volume={},
  number={},
  pages={9608-9618},
  doi={10.1109/CVPR46437.2021.00949}}

The PDF version of the paper is available here.

Requirements

We use PyTorch for the experiments. The conda environment required to run these codes can be installed by

conda create --name ucr --file spec-file.txt

While we aren't aware of any python version specific idiosyncracies, we tested this on Python 3.7 on Debian, with the above spec-file.txt. If you find any missing details, or have trouble getting it to run, please create an issue.

Training the network

Downloading pre-trained models

We use the pretrained models provided by MaxSquareLoss at https://drive.google.com/file/d/1QMpj7sPqsVwYldedZf8A5S2pT-4oENEn/view into a folder named pretrained

Setting up paths

First, the paths to the Cityscapes dataset has to be set in datasets/new_datasets.py in the dataset's constructor. The path to NTHU cities dataset can be set in utils/argparser.py in line 15 at DATA_TGT_DIRECTORY or can be added to the command line call at with --data-tgt-dir. The code trains the network and evaluates its performance and writes it into the log file in the savedir called training_logger.

Running the code

Then code can be run with

python do_segm.py --city {city} --no-src-data --freeze-classifier --unc-noise --lambda-ce 1 --lambda-ent 1  --save {savedir} --lambda-ssl 0.1

where city can in Rome or Rio or Tokyo or Taipei, and savedir is the path to save the logs and models.

Acknowledgements

This code borrows parts from MaxSquareLoss (the network definitions, and pretrained models) and CRST (class balanced pseudo-label generation). The author thanks Evann Courdier for parts of the clean datasets code.

License

This software is distributed with the MIT license which pretty much means that you can use it however you want and for whatever reason you want. All the information regarding support, copyright and the license can be found in the LICENSE file in the repository.

model-uncertainty-for-adaptation's People

Contributors

prabhuteja12 avatar

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.