GithubHelp home page GithubHelp logo

cv4rs's Introduction

A Comparative Analysis of Multi-Task Learning Approaches in the Context of Multi-Label Remote Sensing Image Retrieval

Table of contents

General info

This project aims to compare the performance of multi-task approaches in content-based remote sensing image re-trieval (CBIR). The goal of all the methods in this work isto learn a metric for multi-label images, such that sampleswith maximum overlap in label sets are close. The three multi-task methods we compared are:

  1. Diverse Visual Feature Aggregation for Deep MetricLearning (Diva) git pdf
  2. Divide and Conquer the Embedding Space for MetricLearning (D&C) git pdf
  3. Deep Metric Learning with BIER: Boosting Indepen-dent Embedding Robustly (Bier) git pdf

One single-task approach for further comparisons:

  1. Graph Relation Network: Modeling Relations Between Scenes for Multilabel Remote-Sensing Image Classification and Retrieval (SNDL) pdf

Datasets

Data for:

  1. BigEarthNet
  2. MLRSNet

Downloaded data should be placed in a folder named Dataset and keep the original structure:

Dataset
└───BigEarthNet
|    └───S2A_MSIL2A_20170613T101031_0_48
|           │   S2A_MSIL2A_20170613T101031_0_48_B0
|           │   ...
|    ...
|
└───MLRSNet
|    |   Categories_names.xlsx
|    └───Images
|    |      └───airplane
|    |              │   airplane_00001.jpg
|    |              │   ...
|    |
|    └───labels
|    |      └───airplane.csv
|    ...

Assuming your folder is placed in e.g. <$path/Dataset/BigEarthNet>, pass $path/Dataset as input to --source_path

Requirements

  • python==3.6
  • torch==1.7.0
  • torchvision==0.8.1
  • faiss-gpu==1.6.5
  • hypia==0.0.3
  • GDAL==3.0.4
  • pretrainedmodels==0.7.4
  • wandb==0.10.20
  • vaex==4.0.0

Setup

An exemplary setup of a virtual environment containing everything needed:

(1) wget  https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
(2) bash Miniconda3-latest-Linux-x86_64.sh (say yes to append path to bashrc)
(3) source .bashrc
(4) conda create -n DL python=3.6
(5) conda activate DL
(6) conda install matplotlib scipy scikit-learn scikit-image tqdm vaex pillow xlrd
(7) conda install pytorch torchvision faiss-gpu cudatoolkit=10.0 -c pytorch
(8) pip install wandb pretrainedmodels hypia
(9) Run the scripts!

Training

Training is done by using train_baseline.py or train_bier.py or train_dac.py ortrain_sndl.py and setting the respective flags, all of which are listed and explained in parameters.py. A set of exemplary runs is provided in SampleRun.sh.

[I.] A basic sample run using default parameters would like this:

python train_diva.py --log_online \
                    --dataset MLRSNet  \
                    --source_path ".../Dataset" \
                    --save_path "../Training_Results" \
                    --project MLRSNet --group bier --savename 'bier' \
                    --num_samples_per_class 2  --use_npmem --eval_epoch 10 --nb_epochs 120  

Some Notes:

  • During training, metrics listed in --eval_metric will be logged for validation/test set. If you also want to log the overlap of embedding distance from intra and inter group, simply set the flag --is_plot_dist. A checkpoint is saved for improvements on recall@1 on validation set. The default metrics supported are Recall@K, R-Precision@K, MAP@K.
  • If the training is stopped accidentally, you can resume the training by set the flag --load_from_checkpoint, the training will be restarted from the last checkpoint epoch, and the training results will be written to the original checkpoint folder.

Logging results with W&B

  • Create an account here (free): https://wandb.ai
  • After the account is set, make sure to include your API key in parameters.py under --wandb_key.
  • Set the flag --log_online to use wandb logging, if the network is unavailable in your training environment, set the flag --wandb_dryrun to make wandb store the data locally, and you can upload the data with the command wandb sync <$path/wandb/offline..>

Evaluation

Evaluation is done by using evaluate_model.py and setting the respective flags, all of which are listed and explained in evaluate_model.py. A set of exemplary runs is provided in SampleRun.sh. The evaluation results will include a summary of metric scores, png files of retrieved samples, distance density plot of intra and inter group if the flag --is_plot_dist is set.

Implemented Methods

Loss functions

Batch miner

Architectures

Evaluation Metrics

Metrics based on samples

  • Recall@K
  • R-Precision@K
  • MAP@K

Contact

Created by Jun Xiang, email: [email protected] - feel free to contact me!

cv4rs's People

Contributors

junx0924 avatar paka0401 avatar

Watchers

 avatar  avatar  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.