百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
P

pywick

> 编程语言
开源

包含高级电池的 神经网络 训练库,适用于 Pytorch

399 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

包含高级电池的 神经网络 训练库,适用于 Pytorch

Pywick

High-Level Training framework for Pytorch

Pywick is a high-level Pytorch training framework that aims to get you up and running quickly with state of the art neural networks. Does the world need another Pytorch framework? Probably not. But we started this project when no good frameworks were available and it just kept growing. So here we are.

Pywick tries to stay on the bleeding edge of research into neural networks. If you just wish to run a vanilla CNN, this is probably going to be overkill. However, if you want to get lost in the world of neural networks, fine-tuning and hyperparameter optimization for months on end then this is probably the right place for you :)

Among other things Pywick includes:

  • State of the art normalization, activation, loss functions and optimizers not included in the standard Pytorch library (AdaBelief, Addsign, Apollo, Eve, Lookahead, Radam, Ralamb, RangerLARS etc).
  • A high-level module for training with callbacks, constraints, metrics, conditions and regularizers.
  • Hundreds of popular object classification and semantic segmentation models!
  • Comprehensive data loading, augmentation, transforms, and sampling capability.
  • Utility tensor functions.
  • Useful meters.
  • Basic GridSearch (exhaustive and random).

Docs

Hey, check this out, we now have docs! They're still a work in progress though so apologies for anything that's broken.

What's New (highlights)

v0.6.5 - Docker all the things!

Another great improvement to the framework - docker! You can now run the 17flowers demo right out of the box!

  • Grab our docker image at docker hub: docker pull achaiah/pywick:latest. Pytorch 1.8 and cuda dependencies are pre-installed.
  • Run 17flowers demo with: docker run --rm -it --ipc=host -v your_local_out_dir:/jobs/17flowers --init -e demo=true achaiah/pywick:latest
  • Or run the container in standalone mode so you can use your own data (don't forget to map your local dir to container):
    bash
      docker run --rm -it \
      --ipc=host \
      -v : \
      -v : \
      --init \
      achaiah/pywick:latest

Older Notes

  • Oct. 11, 2021 - We thought ya might like YAML!
    • So you're saying you like configuration files? You're saying you like examples too? Well, we've got you covered! Huge release today with a configuration-based training example! All you have to do is:
      • Get your favorite dataset (or download 17 flowers to get started and pywick/examples/17flowers_split.py to convert)
      • Adjust the configs/train_classifier.yaml file to fit your workspace
      • Then simply run: python3 train_classifier.py configs/train_classifier.yaml and watch it train!
  • May 6, 2021
    • Many SoTA classification and segmentation models added: Swin-Transformer variants, NFNet variants (L0, L1), Halo nets, Lambda nets, ECA variants, Rexnet + others
    • Many new loss functions added: RecallLoss, SoftInvDiceLoss, OhemBCEDicePenalizeBorderLoss, RMIBCEDicePenalizeBorderLoss + others
    • Bug fixes
  • Jun. 15, 2020
    • 700+ models added from rwightman's repo via torch.hub! See docs for all the variants!
    • Some minor bug fixes
  • Jan. 20, 2020
    • New release: 0.5.6 (minor fix from 0.5.5 for pypi)
    • Mish activation function (SoTA)
    • rwightman's models of pretrained/ported variants for classification (44 total)
      • efficientnet Tensorflow port b0-b8, with and without AP, el/em/es, cc
      • mixnet L/M/S
      • mobilenetv3
      • mnasnet
      • spnasnet
    • Additional loss functions
  • Aug. 1, 2019
    • New segmentation NNs: BiSeNet, DANet, DenseASPP, DUNet, OCNet, PSANet
    • New Loss Functions: Focal Tversky Loss, OHEM CrossEntropy Loss, various combination losses
    • Major restructuring and standardization of NN models and loading functionality
    • General bug fixes and code improvements

Install

Pywick requires pytorch >= 1.4

pip install pywick

or specific version from git:

pip install git+https://github.com/achaiah/[email protected]

ModuleTrainer

The ModuleTrainer class provides a high-level training interface which abstracts away the training loop while providing callbacks, constraints, initializers, regularizers, and more.

See the train_classifier.py example for a pretty complete configuration example. To get up and running with your own data quickly simply edit the configs/train_classifier.yaml file with your desired parameters and dataset location(s).

Note: Dataset needs to be organized for classification where each directory name is the name of a class and contains all images pertaining to that class

PyWick provides a wide range of callbacks, generally mimicking the interface found in Keras:

  • CSVLogger - Logs epoch-level metrics to a CSV file
  • CyclicLRScheduler - Cycles through min-max learning rate
  • EarlyStopping - Provides ability to stop training early based on supplied criteria
  • History - Keeps history of metrics etc. during the learning process
  • LambdaCallback - Allows you to implement your own callbacks on the fly
  • LRScheduler - Simple learning rate scheduler based on function or supplied schedule
  • ModelCheckpoint - Comprehensive model saver
  • ReduceLROnPlateau - Reduces learning rate (LR) when a plateau has been reached
  • SimpleModelCheckpoint - Simple model saver
  • Additionally, a TensorboardLogger is incredibly easy to implement via tensorboardX (now part of pytorch 1.1 release!)
python
from pywick.callbacks import EarlyStopping

callbacks = [EarlyStopping(monitor='val_loss', patience=5)]
trainer.set_callbacks(callbacks)

PyWick also provides regularizers:

  • L1Regularizer
  • L2Regularizer
  • L1L2Regularizer

and constraints:

  • UnitNorm
  • MaxNorm
  • NonNeg

Both regularizers and constraints can be selectively applied on layers using regular expressions and the module_filter argument. Constraints can be explicit (hard) constraints applied at an arbitrary batch or epoch frequency, or they can be implicit (soft) constraints similar to regularizers where the constraint deviation is added as a penalty to the total model loss.

python
from pywick.constraints import MaxNorm, NonNeg
from pywick.regularizers import L1Regularizer

# hard constraint applied every 5 batches
hard_constraint = MaxNorm(value=2., frequency=5, unit='batch', module_filter='*fc*')
# implicit constraint added as a penalty term to model loss
soft_constraint = NonNeg(lagrangian=True, scale=1e-3, module_filter='*fc*')
constraints = [hard_constraint, soft_constraint]
trainer.set_constraints(constraints)

regularizers = [L1Regularizer(scale=1e-4, module_filter='*conv*')]
trainer.set_regularizers(regularizers)

You can also fit directly on a torch.utils.data.DataLoader and can have a validation set as well :

python
from pywick import TensorDataset
from torch.utils.data import DataLoader

train_dataset = TensorDataset(x_train, y_train)
train_loader = DataLoader(train_dataset, batch_size=32)

val_dataset = TensorDataset(x_val, y_val)
val_loader = DataLoader(val_dataset, batch_size=32)

trainer.fit_loader(loader, val_loader=val_loader, num_epoch=100)

Extensive Library of Image Classification Models (most are pretrained!)

  • All standard models from Pytorch:
    • Densenet
    • Inception v3
    • MobileNet v2
    • ResNet
    • ShuffleNet v2
    • SqueezeNet
    • VGG
  • BatchNorm Inception
  • Deep High-Resolution Representation Learning for Human Pose Estimation
  • Deep Layer Aggregation
  • Dual Path Networks
  • EfficientNet variants (b0-b8, el, em, es, lite1-lite4, pruned, AP/NS)
  • ECA-Net: Efficient Channel Attention for Deep Convolutional Neural Networks
  • FBResnet
  • FBNet-C
  • Inception v4
  • InceptionResnet v2
  • Mixnet variants (l, m, s, xl, xxl)
  • MnasNet
  • MobileNet V3
  • NasNet variants (mnas, pnas, mobile)
  • PNASNet
  • Polynet
  • Pyramid Resnet
  • RegNet - Designing Network Design Spaces
  • Resnet variants (gluon, res2net, se, ssl, tv, wide)
  • ResNeSt: Split-Attention Networks
  • ResNext variants (ig, se, ssl, swsl, tv)
  • SE Net variants (gluon, resnet, resnext, inception)
  • SelecSLS Convolutional Net
  • Selective Kernel Networks
  • Semi-Supervised and Semi-Weakly Supervised ImageNet Models
  • Single-Pass NAS Net
  • TResNet: High Performance GPU-Dedicated Architecture
  • Wide Resnet
  • XCeption
  • All the newest classification models (200+) from rwightman's repo ECA-NFNet, GERNet, RegNet, SKResnext, SWIN-Transformer, VIT etc.)

Image Segmentation Models

  • BiSeNet (Bilateral Segmentation Network for Real-time Semantic Segmentation)
  • DANet (Dual Attention Network for Scene Segmentation)
  • Deeplab v2 (DeepLab: Semantic Image Segmentation with Deep Convolutional Nets, Atrous Convolution, and Fully Connected CRFs)
  • Deeplab v3 (Rethinking Atrous Convolution for Semantic Image Segmentation)
  • DenseASPP (DenseASPP for Semantic Segmentation in Street Scenes)
  • DRNNet (Dilated Residual Networks)
  • DUC, HDC (understanding convolution for semantic segmentation)
  • DUNet (Decoders Matter for Semantic Segmentation)
  • ENet (ENet: A Deep Neural Network Architecture for Real-Time Semantic Segmentation)
  • Vanilla FCN: FCN32, FCN16, FCN8, in the versions of VGG, ResNet and OptDenseNet respectively (Fully convolutional networks for semantic segmentation)
  • FRRN ([Full Resolution Residual Networks for Semantic Segmentation in Street Scenes](https://arxiv.org/abs/1611.08323

Issues· 1 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Pythonclassificationdeep-learningneural-networkspytorch

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言