Skip to content

MultiGrain: a unified image embedding for classes and instances

License

Notifications You must be signed in to change notification settings

zjykzj/multigrain-pytorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Language: 🇺🇸 🇨🇳

«MultiGrain» re-implements the paper MultiGrain: a unified image embedding for classes and instances

实现逻辑:

  1. 先完成分类任务训练
  2. 然后扩展到分类+检索任务联合训练

如果仅仅进行分类任务训练,那么它是简单的。包括模型(ResNet50)、损失函数(CrossEntropyLoss)、优化器(SGD)的格式 和之前的方式差别不大

如果是加入检索任务训练,那么需要在数据采样、模型输出、损失函数计算、优化器更新上均进行了变化

先进行分类任务训练,基于ImageNet数据集,使用MultiGrain提供的预处理器、模型、损失函数以及优化器

然后加入检索任务训练

cd classification

export PYTHONPATH=.

python3 train.py --model resnet50 --lr 1e-2 --data-path /data/sdf/imagenet/ --output-dir ./outputs --ra-reps 1 --batch-size 128 --epochs 120
torchrun --nproc_per_node=8 train.py --model resnet50 --lr 1e-2 --data-path /data/sdf/imagenet/ --output-dir ./outputs --ra-reps 1 --batch-size 128 --epochs 120

Table of Contents

Background

MultiGrain provides a unified framework to simultaneously train classification and retrieval tasks. In addition, it also provides source code implementation - facebookresearch/multigrain. This warehouse is modified on the original basis to deepen the understanding and use of the MultiGrain framework.

Installation

...

Usage

...

Maintainers

  • zhujian - Initial work - zjykzj

Thanks

@ARTICLE{2019arXivMultiGrain,
       author = {Berman, Maxim and J{\'e}gou, Herv{\'e} and Vedaldi Andrea and
         Kokkinos, Iasonas and Douze, Matthijs},
        title = "{{MultiGrain}: a unified image embedding for classes and instances}",
      journal = {arXiv e-prints},
         year = "2019",
        month = "Feb",
}

Contributing

Anyone's participation is welcome! Open an issue or submit PRs.

Small note:

License

Apache License 2.0 © 2022 zjykzj

About

MultiGrain: a unified image embedding for classes and instances

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages