Geeks_Z の Blog Geeks_Z の Blog
首页
  • 学习笔记

    • 《HTML》
    • 《CSS》
    • 《JavaWeb》
    • 《Vue》
  • 后端文章

    • Linux
    • Maven
    • 汇编语言
    • 软件工程
    • 计算机网络概述
    • Conda
    • Pip
    • Shell
    • SSH
    • Mac快捷键
    • Zotero
  • 学习笔记

    • 《数据结构与算法》
    • 《算法设计与分析》
    • 《Spring》
    • 《SpringMVC》
    • 《SpringBoot》
    • 《SpringCloud》
    • 《Nginx》
  • 深度学习文章
  • 学习笔记

    • 《PyTorch》
    • 《ReinforementLearning》
    • 《MetaLearning》
  • 学习笔记

    • 《高等数学》
    • 《线性代数》
    • 《概率论与数理统计》
  • 增量学习
  • 哈希学习
GitHub (opens new window)

Geeks_Z

AI小学生
首页
  • 学习笔记

    • 《HTML》
    • 《CSS》
    • 《JavaWeb》
    • 《Vue》
  • 后端文章

    • Linux
    • Maven
    • 汇编语言
    • 软件工程
    • 计算机网络概述
    • Conda
    • Pip
    • Shell
    • SSH
    • Mac快捷键
    • Zotero
  • 学习笔记

    • 《数据结构与算法》
    • 《算法设计与分析》
    • 《Spring》
    • 《SpringMVC》
    • 《SpringBoot》
    • 《SpringCloud》
    • 《Nginx》
  • 深度学习文章
  • 学习笔记

    • 《PyTorch》
    • 《ReinforementLearning》
    • 《MetaLearning》
  • 学习笔记

    • 《高等数学》
    • 《线性代数》
    • 《概率论与数理统计》
  • 增量学习
  • 哈希学习
GitHub (opens new window)
  • Python

  • MLTutorials

  • 卷积神经网络

  • 循环神经网络

  • Transformer

  • VisionTransformer

  • 扩散模型

  • 计算机视觉

  • PTM

  • MoE

  • LoRAMoE

  • LongTailed

  • 多模态

  • 知识蒸馏

  • PEFT

  • 对比学习

  • 小样本学习

  • 迁移学习

  • 零样本学习

  • 集成学习

  • Mamba

  • PyTorch

    • PyTorch概述

    • Tensors

    • 数据处理

    • 模型

    • 训练

    • 并行计算

    • 可视化

    • 实战

    • timm

      • timm概述
        • 概述
        • timm库特点
          • 所有的模型都有默认的API
          • 训练方式支持
      • timm使用教程
      • timm代码解读
      • timm-vit代码解读
      • create_model解读
    • Pytorch Lightning

    • 数据增强

    • 面经与bug解决

    • 常用代码片段

    • Reference
  • CL

  • CIL

  • 小样本类增量学习FSCIL

  • UCIL

  • 多模态增量学习MMCL

  • LTCIL

  • DIL

  • 论文阅读与写作

  • 分布外检测

  • GPU

  • 深度学习调参指南

  • AINotes
  • PyTorch
  • timm
Geeks_Z
2024-10-16
目录

timm概述

概述

PyTorchImageModels,简称 timm,是一个巨大的 PyTorch 代码集合,包括了一系列:

  • image models
  • layers
  • utilities
  • optimizers
  • schedulers
  • data-loaders / augmentations
  • training / validation scripts

旨在将各种 SOTA 模型整合在一起,并具有复现 ImageNet 训练结果的能力。虽然模型架构是 timm 的重点,但它还包括许多数据增强 (data augmentations)、正则化技术 (regularization techniques)、优化器 (optimizers) 和学习率策略 (learning rate schedulers) 的实现。

作者github链接:rwightman - Overview (opens new window) timm库链接:rwightman/pytorch-image-models (opens new window)

timm库特点

所有的模型都有默认的API

  • accessing/changing the classifier - get_classifier and reset_classifier
  • 只对features做前向传播 - forward_features

所有模型都支持多尺度特征提取 (feature pyramids) (通过create_model函数):

  • create_model(name, features_only=True, out_indices=..., output_stride=...)

out_indices 指定返回哪个feature maps to return, 从0开始,out_indices[i]对应着 C(i + 1) feature level。

output_stride 通过dilated convolutions控制网络的output stride。大多数网络默认 stride 32 。

所有的模型都有一致的pretrained weight loader,adapts last linear if necessary。

训练方式支持

  • NVIDIA DDP w/ a single GPU per process, multiple processes with APEX present (AMP mixed-precision optional)

  • PyTorch DistributedDataParallel w/ multi-gpu, single process (AMP disabled as it crashes when enabled)

  • PyTorch w/ single GPU single process (AMP optional)

动态的全局池化方式可以选择:average pooling, max pooling, average + max, or concat([average, max]),默认是adaptive average。

Schedulers:

Schedulers 包括step,cosinew/ restarts,tanhw/ restarts,plateau 。

Optimizer:

  • rmsprop_tf adapted from PyTorch RMSProp by myself. Reproduces much improved Tensorflow RMSProp behaviour.
  • radam by https://github.com/LiyuanLucasLiu/RAdam (opens new window) (https://arxiv.org/abs/1908.03265 (opens new window))
  • novograd by https://github.com/convergence-lab/novograd (opens new window) (https://arxiv.org/abs/1905.11286 (opens new window))
  • lookahead adapted from impl by https://github.com/alphadl/lookahead.pytorch (opens new window) (https://arxiv.org/abs/1907.08610 (opens new window))
  • fused<name> optimizers by name with https://github.com/NVIDIA/apex/tree/master/apex/optimizers (opens new window) installed
  • adamp and sgdp by https://github.com/clovaai (opens new window) (https://arxiv.org/abs/2006.08217 (opens new window))
  • adafactor adapted from https://github.com/pytorch/fairseq/blob/master/fairseq/optim/adafactor.py (opens new window) (https://arxiv.org/abs/1804.04235 (opens new window))
  • adahessian by https://github.com/davda54/ada-hessian (opens new window) (https://arxiv.org/abs/2006.00719 (opens new window))
上次更新: 2025/06/25, 11:25:50
ViT解读
timm使用教程

← ViT解读 timm使用教程→

最近更新
01
帮助信息查看
06-08
02
常用命令
06-08
03
学习资源
06-07
更多文章>
Theme by Vdoing | Copyright © 2022-2025 Geeks_Z | MIT License
京公网安备 11010802040735号 | 京ICP备2022029989号-1
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式