Skip to content

gitE0Z9/pytorch-implementations

Repository files navigation

Pytorch 實作系列

english-version

中文版本

此專案初衷是實作多年來學習的深度學習模型,並提供 notebook 跟 medium 文章學習,而非一個專注於特定領域的 production-ready 庫

接下來的開發方向會往 monorepo 延伸

套件

一般

套件名: common

Model Article Link Package
K-Means - kmeans
Kernel PCA medium kernel_pca

圖像分類

套件名: image_classification

Model Article Link Package
ResNet50, ResNet-B, ResNet-C, ResNet-D medium resnet
ResNeXt50-32x4d medium resnext
ResNeSt50 medium resnest
Res2Net50 medium res2net
SE-ResNet50, SE-ResNeXt50 medium senet
SKNet medium sknet
Residual attention network(AttentionNet56) medium residual_attention
DenseNet medium densenet
Highway Network medium highway
MobileNet v1 medium mobilenet
MobileNet v2 medium mobilenetv2
MobileNet v3 medium mobilenetv3
EfficientNet v1 medium efficientnet
EfficientNet v2 medium efficientnetv2
GhostNet medium ghostnet
GhostNet v2 - ghostnetv2
ShuffleNet medium shufflenet
ShuffleNetV2 medium shufflenetv2
SqueezeNet medium squeezenet
SqueezeNeXt medium squeezenext
Extraction medium extraction
DarkNet19 medium darknet19
Vision transformer (ViT) medium vit
Distillated Vision transformer (DeiT) medium deit

物件偵測

套件名: object_detection

Model Article Link Package
You only look once (YOLO) medium yolov1
Tiny YOLOv1 - yolov1_tiny
YOLOv2 medium yolov2
Single shot multibox detector (SSD) - ssd
RetinaNet - retinanet

語義分割

套件名: semantic_segmentation

Model Article Link Package
UNet medium unet
Fully convolution network (FCN) medium fcn
Pyramid spatial pooling network (PSPNet) medium pspnet
Dual attention(DANet) medium dual_attention
DeepLab v1 - deeplabv1
DeepLab v2 - deeplabv2
DeepLab v3 - deeplabv3
Lite reduced ASPP (LR-ASPP) - lr_aspp
Reduced ASPP (R-ASPP) - r_aspp
Multi-scale context aggregation by dilation - mscad
ParseNet - parsenet
Segmentation transformer (SETR) medium setr

光學文字辨識

套件名: ocr

Model Article Link Package
Convolution recurrent neural network (CRNN) medium crnn

圖像生成

套件名: image_generation

Model Article Link Package
Variational autoencoder (VAE) medium vae
Generative adversarial network (GAN) medium gan
Deep convolution GAN (DCGAN) medium dcgan

風格遷移

套件名: style_transfer

Model Article Link Package
Neural style transfer medium neural_style_transfer
Neural Doodle medium neural_doodle
Fast style transfer medium fast_style_transfer
Adaptive instance normalization (AdaIN) medium adain
Pix2Pix medium pix2pix

序列資料

套件名: sequence_data

Model Article Link Package
Long and short term memory (LSTM) medium lstm
Bidirectional LSTM (BiLSTM) medium lstm
Gated recurrent unit (GRU) medium gru
Temporal convolution network (TCN) medium tcn
Seq2Seq medium seq2seq
Transformer - transformer

語言模型

套件名: language_model

Model Article Link Package
Word2vec medium word2vec
GloVe medium glove
Vector log-bilinear language model (vLBL/ivLBL) medium vlbl

文本分類

套件名: text_classification

Model Article Link Package
TextCNN medium textcnn
Character CNN (CharCNN) medium charcnn
Very deep CNN (VDCNN) medium vdcnn
Recurrent CNN (RCNN) medium rcnn
Dynamic CNN (DCNN) medium dcnn
FastText - fasttext

標籤預測

套件名: tag_prediction

Model Article Link Package
Bidirectional LSTM - Conditional random field (BiLSTM-CRF) medium bilstm_crf

文本生成

套件名: text_generation

Model Article Link Package
Show and tell - show_and_tell

少樣本學習

套件名: few_shot

Model Article Link Package
Siamese network medium siamese
Prototypical network medium prototypical

表示學習

套件名: representation

Model Article Link Package
Positive pairwise mutual information (PPMI) medium ppmi
Hellinger PCA medium hellinger

圖神經網路

套件名: graph

Model Article Link Package
Graph Convolution Network (GCN) medium gcn
Graph Attention Network (GAT) medium attention
Graph Attention Network v2 (GAT v2) medium attention

增強學習

套件名: reinforcement_learning

Model Article Link Package
Deep Q Network medium dqn

開發環境

python: 3.11

安裝方式

pip install git+https://www.github.com/gite0z9/pytorch-implementations.git@main#torchlake --target=/torchlake

專案結構

notebooks: 展示如何使用 torchlake.

torchlake: 由不同應用領域組成的深度學習包.

每個領域大致上會有如下結構

├───adapter
├───artifacts
│   └───model_name
├───configs
│   └───model_name
├───constants
├───controller
├───datasets
│   └───dataset_name
|       └───datasets.py
├───models
│   ├───base
│   └───model_name
|       |───reference
|       |   └───paper
│       ├───model.py
│       ├───network.py
│       ├───loss.py
│       ├───helper.py
│       └───decode.py
├───runs
├───scripts
│   └───debug
├───tests
├───utils
└───requirements.txt

adapter: 介接 controller 和其他資源(model, model.loss, etc.)

configs: 模型設定檔,包括裝置定義、模型定義、訓練定義、推論定義,共四個面向

constants: 固定的值,包括 constant 和 enum

controller: 控制器,controller是共用基底,trainerevaluatorpredictor負責訓練、評估、預測三種工作

models: 模型定義,network.py是模型區塊,model.py是最後組裝的模型,loss.py是損失函數

datasets: 資料集,目前是照領域區分,有分 raw dataset 和 csv dataset,前者是讀取 raw data,後者是讀取處理過的 csv(如歸一化座標)

runs: 記載trainerevaluator的結果的 tensorboard log 資料夾

tests: 單元測試,使用 pytest

utils: 存放依賴性低且復用性高的函式

model 和 dataset 的 config 會用 pydantic 控制格式

模組依賴關係

modules drawio

About

Deep learning models implemented in PyTorch

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published