Giter Club home page Giter Club logo

adaptivecontext's Introduction

Adaptive Contextual Perception

The code for paper Adaptive Contextual Perception: How to Generalize to New Backgrounds and Ambiguous Objects

Zhuofan Ying, Peter Hase, Mohit Bansal

main_fig

Setup environment and data

Environment

Create and activate conda environment:

conda create -n AdaCont python=3.7
conda activate AdaCont

Install the dependencies with:

pip install -r requirements.txt

Setup data

# preprocess COCO
python coco.py
# preprocess Places
python places.py
  • Create ColorObject and SceneObject dataset, including in-distribution (ID) train, ID val, ID test, Background-Invariance (OOD1) test, Object-Disambiguation (OOD2) test, probing data for probing method, perturbation data for geometric method, and perturbation data for sets:
python data_gen.py

Training

  • Run scripts in scripts/ to train all baseline models and augmentation models for our analysis:
./scripts/train_color.sh
./scripts/train_scene.sh

For all scripts, see scripts/all_scripts.sh

Data Analysis

  • To compute feature factorization and feature weighting metrics for models, run ComputeMetrics.ipynb. This will save the metrics to saved_dict_ColorObject.pkl and saved_dict_SceneCOCO.pkl.
  • To reproduce our regression and causal analysis, run RegressionAnalysis.ipynb and CausalAnalysis.ipynb

Acknowledgement

This code is based on TRM.

Citation

adaptivecontext's People

Contributors

zfying avatar

Stargazers

 avatar  avatar Shoubin avatar  avatar

Watchers

 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.