0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【宣伝】PyTorch C++サンプルプログラム

Posted at

PyTorch C++のサンプルプログラムをたくさん書いたので,その宣伝をしたいと思います!
リポジトリ:https://github.com/koba-jon/pytorch_cpp

1. リポジトリ概要

本リポジトリは,PyTorchのC++ API (LibTorch) を用いて主要な深層学習モデルを再実装し,Pythonに依存しない研究・実務環境を目指したものです.
実応用・製造現場・推論サーバなど,C++で完結させたい人向けの実装例集です!
IMG_5625.PNG

2. 実装したモデル

📊 多クラス分類(Multiclass Classification)

Category Model Paper Conference/Journal Code
CNNs AlexNet A. Krizhevsky et al. NeurIPS 2012 AlexNet
VGGNet K. Simonyan et al. ICLR 2015 VGGNet
ResNet K. He et al. CVPR 2016 ResNet
Discriminator A. Radford et al. ICLR 2016 Discriminator
EfficientNet M. Tan et al. ICML 2019 EfficientNet
Transformers Vision Transformer A. Dosovitskiy et al. ICLR 2021 ViT

🔽 次元削減(Dimensionality Reduction)

Model Paper Conference/Journal Code
Autoencoder G. E. Hinton et al. Science 2006 AE1d
AE2d
Denoising Autoencoder P. Vincent et al. ICML 2008 DAE2d

🎨 生成モデリング(Generative Modeling)

Category Model Paper Conference/Journal Code
VAEs Variational Autoencoder D. P. Kingma et al. ICLR 2014 VAE2d
Wasserstein Autoencoder I. Tolstikhin et al. ICLR 2018 WAE2d GAN
WAE2d MMD
VQ-VAE A. v. d. Oord et al. NeurIPS 2017 VQ-VAE
VQ-VAE-2 A. Razavi et al. NeurIPS 2019 VQ-VAE-2
GANs DCGAN A. Radford et al. ICLR 2016 DCGAN
Flows Planar Flow D. Rezende et al. ICML 2015 Planar-Flow2d
Radial Flow D. Rezende et al. ICML 2015 Radial-Flow2d
Real NVP L. Dinh et al. ICLR 2017 Real-NVP2d
Glow D. P. Kingma et al. NeurIPS 2018 Glow
Diffusion Models DDPM J. Ho et al. NeurIPS 2020 DDPM2d
DDPM2d-v
DDIM J. Song et al. ICLR 2021 DDIM2d
DDIM2d-v
PNDM L. Liu et al. ICLR 2022 PNDM2d
PNDM2d-v
LDM R. Rombach et al. CVPR 2022 LDM
LDM-v
Flow Matching Flow Matching Y. Lipman et al. ICLR 2023 FM2d
Rectified Flow X. Liu et al. ICLR 2023 RF2d
Autoregressive Models PixelCNN A. v. d. Oord et al. ICML 2016 PixelCNN-Gray
PixelCNN-RGB
PixelSNAIL X. Chen et al. ICML 2018 PixelSNAIL-Gray
PixelSNAIL-RGB

🖼️ 画像変換(Image-to-Image Translation)

Model Paper Conference/Journal Code
U-Net O. Ronneberger et al. MICCAI 2015 U-Net Regression
Pix2Pix P. Isola et al. CVPR 2017 Pix2Pix
CycleGAN J.-Y. Zhu et al. ICCV 2017 CycleGAN

🧩 セマンティックセグメンテーション(Semantic Segmentation)

Model Paper Conference/Journal Code
SegNet V. Badrinarayanan et al. CVPR 2015 SegNet
U-Net O. Ronneberger et al. MICCAI 2015 U-Net Classification

🎯 物体検出(Object Detection)

Model Paper Conference/Journal Code
YOLOv1 J. Redmon et al. CVPR 2016 YOLOv1
YOLOv2 J. Redmon et al. CVPR 2017 YOLOv2
YOLOv3 J. Redmon et al. arXiv 2018 YOLOv3
YOLOv5 Ultralytics - YOLOv5
YOLOv8 Ultralytics - YOLOv8

🧠 表現学習(Representation Learning)

Model Paper Conference/Journal Code
SimCLR T. Chen et al. ICML 2020 SimCLR
Masked Autoencoder K. He et al. CVPR 2022 MAE

🚨 異常検知(Anomaly Detection)

Model Paper Conference/Journal Code
AnoGAN T. Schlegl et al. IPMI 2017 AnoGAN2d
DAGMM B. Zong et al. ICLR 2018 DAGMM2d
EGBAD H. Zenati et al. ICLR Workshop 2018 EGBAD2d
GANomaly S. Akçay et al. ACCV 2018 GANomaly2d
Skip-GANomaly S. Akçay et al. IJCNN 2019 Skip-GANomaly2d

3. 早速実行したい人へ

必要なライブラリ:LibTorchOpenCVOpenMPBoostGnuplotlibpng/png++/zlib

LibTorchのインストール方法はこちらへ↓
https://qiita.com/koba-jon/items/2b15865f5b4c0c9fbbf7

1. クローン

$ git clone https://github.com/koba-jon/pytorch_cpp.git
$ cd pytorch_cpp
$ sudo apt install g++-8

2. 実行

(1) ディレクトリ移動 (例:AE1d

$ cd Dimensionality_Reduction/AE1d

(2) ビルド

$ mkdir build
$ cd build
$ cmake ..
$ make -j4
$ cd ..

(3) データセット設定 (データセット:Normal Distribution Dataset

$ cd datasets
$ git clone https://github.com/koba-jon/normal_distribution_dataset.git
$ ln -s normal_distribution_dataset/NormalDistribution ./NormalDistribution
$ cd ..

(4) 学習

$ sh scripts/train.sh

(5) テスト

$ sh scripts/test.sh

実行できましたでしょうか?
以上のような手順で他のモデルも動作するはずです!
もし何かあれば,コメント等ください!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?