Giter VIP home page Giter VIP logo

mixbag's Introduction

Illustration Takanori Asanomi, Shinnosuke Matsuo, Daiki Suehiro, Ryoma Bise

Learning from label proportions (LLP) is a promising weakly supervised learning problem. In LLP, a set of instances (bag) has label proportions, but no instance-level labels are given. LLP aims to train an instance-level classifier by using the label proportions of the bag. In this paper, we propose a bag-level data augmentation method for LLP called MixBag, based on the key observation from our preliminary experiments; that the instance-level classification accuracy improves as the number of labeled bags increases even though the total number of instances is fixed. We also propose a confidence interval loss designed based on statistical theory to use the augmented bags effectively.

Requirements

  • python >= 3.9
  • cuda && cudnn

We strongly recommend using a virtual environment like Anaconda or Docker. The following is how to build the virtual environment for this code using anaconda.

# pytorch install
$ pip install torch==1.9.1+cu111 torchvision==0.10.1+cu111 torchaudio==0.9.1 -f https://download.pytorch.org/whl/torch_stable.html
$ pip install -r requirements.py

Dataset

You can create dataset by running following code. Dataset will be saved in ./data directory.

$ python create_dataset.py

The Data structure of ./data directory is written as belows.

./data
     └── cifar10  # dataset name
     │    ├── 0  # 5-fold 
     │    │   ├── train_bags.npy          # train data (512, 10, 32, 32, 3) = (the number of bags, bag size, height, width, channel)
     │    │   ├── train_labels.npy        # train class label of each data (512, 10) = (the number of bags, bag size)
     │    │   ├── train_lps.npy           # train label proportions (512, 10) = (the number of bags, class label proportions)
     │    │   ├── val_bags.npy            # val data (10, 64, 32, 32, 3) = (the number of bags, bag size, height, width, channel)
     │    │   ├── val_labels.npy          # val class label of each data (10, 64) = (the number of bags, bag size)
     │    │   └── val_lps.npy             # val label proportions(10, 10) = (the number of bags, class label proportions)
     │    │                
     │    ├── :
     │    │
     │    ├── 4  # 5-fold 
     │    │   ├── train_bags.npy          # train data (512, 10, 32, 32, 3) = (the number of bags, bag size, height, width, channel)
     │    │   ├── train_labels.npy        # train class label of each data (512, 10) = (the number of bags, bag size)
     │    │   ├── train_lps.npy           # train label proportions (512, 10) = (the number of bags, class label proportions)
     │    │   ├── val_bags.npy            # val data (10, 64, 32, 32, 3) = (the number of bags, bag size, height, width, channel)
     │    │   ├── val_labels.npy          # val class label of each data (10, 64) = (the number of bags, bag size)
     │    │   └── val_lps.npy             # val label proportions(10, 10) = (the number of bags, class label proportions)
     │    │
     │    ├── test_data.npy               # (10000, 32, 32, 3) = (the number of data, height, width, channel)
     │    │
     │    └── test_label.npy              # (10000,) = (the number of data labels)
     │
     ├──  svhn  # dataset name
     │    ├── 0  # 5-fold
     :    :

Training & Test

After creating your python environment and Dataset which can be made by following above command, you can run Mixbag code.
If you want to train network, please run following command. 5 fold cross-validation is implemented and Test is automatically done in our code.

$ python run.py

If you want to train network in all 8 dataset, please run following command.
The training and test will be automatically done in 8 dataset.
(However, This process takes a lot of time, so you should be carefull.)

sh run_all_dataset.sh

Arguments

You can set up any parameters at arguments.py

Citation

If you find MixBag useful in your work, please cite our paper:

@inproceedings{asanomi2023mixbag,
  title={MixBag: Bag-Level Data Augmentation for Learning from Label Proportions},
  author={Asanomi, Takanori and Matsuo, Shinnosuke and Suehiro, Daiki and Bise, Ryoma},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
  pages={16570--16579},
  year={2023}
}

Author

👤 Takanori Asanomi

mixbag's People

Contributors

asanomitakanori avatar matsuo-shinnosuke avatar

Stargazers

 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.