Coder Social home page Coder Social logo

hierarchicalcontrastivelearning's Introduction

Use All The Labels: A Hierarchical Multi-Label Contrastive Learning Framework

This repo covers an reference implementation for the paper Use All The Labels: A Hierarchical Multi-Label Contrastive Learning Framework in PyTorch, using Deep Fashion In-Store as an illustrative example: Use All The Labels: A Hierarchical Multi-Label Contrastive Learning Framework.

Requirements

  • Pytorch 1.7.0
  • tensorboard_logger 0.1.0

Typo

  • We want to correct a typo in the paper. In Eq. 6 and 7, should be .

Running

  • This code is built upon two codebases: Supervised Contrastive Learning and MoCo.

  • Train pre-trained model on Deep Fashion In-store dataset

    • Perpare train-listfile, val-listfile. The format is as follows:
     {
       "images": [
         "/deep_fashion_in_store/img/WOMEN/Dresses/id_00000002/02_1_front.jpg",
         "/deep_fashion_in_store/img/WOMEN/Dresses/id_00000002/02_2_side.jpg",
         "/deep_fashion_in_store/img/WOMEN/Dresses/id_00000002/02_4_full.jpg",
         "/deep_fashion_in_store/img/WOMEN/Dresses/id_00000002/02_7_additional.jpg",
         "/deep_fashion_in_store/img/WOMEN/Blouses_Shirts/id_00000004/03_1_front.jpg"
       ],
       "categories": [
         "Dresses",
         "Dresses",
         "Dresses",
         "Dresses",
         "Blouses_Shirts"
       ]
     }
    
    
     python train_deepfashion.py --data ./deepfashion/ 
     --train-listfile ./train_listfile.json 
     --val-listfile ./val_listfile.json 
     --test-listfile ./test_listfile.json 
     --class-map-file ./classmap.json 
     --num-classes 17 
     --learning_rate 0.5 --temp 0.1
     --ckpt /pretrained_model/
     --dist-url 'tcp://localhost:10001' 
     --multiprocessing-distributed 
     --world-size 1 --rank 0 --cosine
    
    
    • To evaluate the model, run
     python eval_deepfashion.py --data ./deepfashion/ 
     --train-listfile ./train_listfile.json --val-listfile ./val_listfile.json 
     --class-map-file ./classmap.json 
     --num-classes 17 
     --learning_rate 0.5 --temp 0.1
     --ckpt /trained_model/
    
    

Reference

@inproceedings{hierarchicalContrastiveLearning,
      title={Use All The Labels: A Hierarchical Multi-Label Contrastive Learning Framework}, 
      author={Shu Zhang and Ran Xu and Caiming Xiong and Chetan Ramaiah},
      year={2022},
      booktitle={CVPR},
}

hierarchicalcontrastivelearning's People

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.