Git Product home page Git Product logo

soprc's Introduction

SOPRC

An implement of the NeurIPS 2022 paper: Exploring the Algorithm-Dependent Generalization of AUPRC Optimization with List Stability.

Environments

  • Ubuntu 16.04
  • CUDA 11.1
  • Python 3.8.10
  • Pytorch 1.8.2+cu11

See requirement.txt for others.

Data preparation

Download SOP, PKU VehicleID, and iNaturalist. Unzip these files and place then in ./data/[dataset]/images.

Training

Download the pretrained model of ResNet-50 in ./pretrained_models.

Run the following command for training & validation

bash scripts/run.sh config/$DATASET/$CONFIG $gpu_id

For example,

bash scripts/run.sh config/iNaturalist/soprc_sgd.yaml 0

Evaluation

bash scripts/test.sh config/$DATASET/$CONFIG $gpu_id

For example,

bash scripts/test.sh config/iNaturalist/soprc_sgd.yaml 0

Losses

The following methods are provided in this repository (see Appendix in our paper):

  • Pairwise Losses, including Contrastive Loss, Triplet Loss, Multi-Similarity (MS) Loss, Cross-Batch Memory (XBM)
  • Ranking-Based Losses, including SmoothAP, FastAP, DIR, BlackBox, Area Under the ROC Curve Loss (AUROC), and SOPRC (Ours)

See losses/loss_warpper.py for usage.

By default, these losses take a dict with keys "feat" and "target" as input. Here the feature is an $(N\times M) \times D$ tensor, where $N$ is the number of ids, $M$ is the number of positive examples for each id and $D$ is feature dimension. The target is an $(N\times M) \times 1$ tensor, where the first $M$ examples belong to the same id, and so on. See config/demo.yaml for more details on configures. For example, by setting batchsize = 224, num_sample_per_id = 4, output_channels = 512, we have $N = 56, M = 4, D = 512$, and the target could be $[2,2,2,2,1,1,1,1,4,4,4,4,...]$.

References

If this code is helpful to you, please consider citing our paper:

@inproceedings{wen2022exploring,
  title={Exploring the Algorithm-Dependent Generalization of AUPRC Optimization with List Stability},
  author={Wen, Peisong and Xu, Qianqian and Yang, Zhiyong and He, Yuan and Huang, Qingming},
  booktitle={Annual Conference on Neural Information Processing Systems},
  year={2022}
}

soprc's People

Contributors

kid-7391 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.