Coder Social home page Coder Social logo

metric_learning_sample's Introduction

Metric_Learning_Sample

Metric Learningのサンプルコード

動作環境

ライブラリのバージョン
  • cuda 12.1
  • python 3.6.9
  • torch 1.8.1+cu111
  • torchaudio 0.8.1
  • torchinfo 1.5.4
  • torchmetrics 0.8.2
  • torchsummary 1.5.1
  • torchvision 0.9.1+cu111
  • timm 0.5.4
  • tlt 0.1.0
  • numpy 1.19.5
  • Pillow 8.4.0
  • scikit-image 0.17.2
  • scikit-learn 0.24.2
  • tqdm 4.64.0
  • opencv-python 4.5.1.48
  • opencv-python-headless 4.6.0.66
  • scipy 1.5.4
  • matplotlib 3.3.4
  • mmcv 1.7.1

ファイル&フォルダ一覧

学習用コード等
ファイル名 説明
metric_train.py Metric Learningを導入したResNetを学習するコード.
trainer.py 学習ループのコード.
metric_loss.py Metric Learningの損失のコード.
make_graph.py 学習曲線を可視化するコード.

実行手順

環境設定

先述の環境を整えてください.

学習

ハイパーパラメータは適宜調整してください.

Metric Learningを導入したResNetのファインチューニング(CIFAR-10)

Siamese Networkの学習

python3 metric_train.py --epoch 10 --batch_size 128 --amp --dataset cifar10 --method Siamese

Triplet Lossの学習

python3 metric_train.py --epoch 10 --batch_size 128 --amp --dataset cifar10 --method Triplet

Triplet Mining(Batch Hard Strategy)の学習

python3 metric_train.py --epoch 10 --batch_size 128 --amp --dataset cifar10 --method Hard

Triplet Mining(Batch All Strategy)の学習

python3 metric_train.py --epoch 10 --batch_size 128 --amp --dataset cifar10 --method All
Metric Learningを導入したResNetのファインチューニング(CIFAR-100)

Siamese Networkの学習

python3 metric_train.py --epoch 10 --batch_size 128 --amp --dataset cifar100 --method Siamese

Triplet Lossの学習

python3 metric_train.py --epoch 10 --batch_size 128 --amp --dataset cifar100 --method Triplet

Triplet Mining(Batch Hard Strategy)の学習

python3 metric_train.py --epoch 10 --batch_size 128 --amp --dataset cifar100 --method Hard

Triplet Mining(Batch All Strategy)の学習

python3 metric_train.py --epoch 10 --batch_size 128 --amp --dataset cifar100 --method All

参考文献

metric_learning_sample's People

Contributors

syunkitakase avatar

Watchers

Kostas Georgiou 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.