MIT License

项目介绍

zspacelabs/bimm 是一个托管在 GitHub 上的开源项目,主要使用 Rust 编写,采用 MIT License 许可证,目前获得 28 个 Star、0 次 Fork。

仓库全名
zspacelabs/bimm
开源许可证
MIT License
Star 数
28
未关闭 Issue
2

README 摘要

Burn Image Models Overview This is a repository for burn image models; inspired by the Python timm package. The future feature list is: timm => bimm Contributing See the CONTRIBUTING guide for build and contribution instructions. Crates bimm - the main crate for image models. bimm::cache - weight loading cache. bimm::layers - reusable neural network modules. bimm::layers::activation - activation layers…

完整内容见 GitHub 原始 README 或本页 。

常见问题

bimm 用什么语言开发?

主要使用 Rust 编写,采用 MIT License 许可证,目前有 28 个 Star。

bimm 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 bimm 的源码?

可以直接克隆仓库:git clone https://github.com/zspacelabs/bimm.git,默认分支为 main;安装与运行步骤见仓库 README。

bimm 最近还在维护吗?

仓库最近一次更新为 5月22日,当前有 2 个未关闭 Issue;Star 数为 28,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

bimm aims to build out support machinery for burn image modeling.

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
30
价值分
16
活跃状态
活跃

语言占比

Rust
Shell

Release

贡献者

README

Burn Image Models

Coverage Status

Overview

This is a repository for burn image models; inspired by the Python timm package.

The future feature list is:

  • timm => bimm

Contributing

See the CONTRIBUTING guide for build and contribution instructions.

Crates

bimm - the main crate for image models.

Crates.io Version docs.rs

Example

Example of building a pretrained model:

use burn::backend::Wgpu;
use bimm::cache::disk::DiskCacheConfig;
use bimm::models::resnet::{PREFAB_RESNET_MAP, ResNet};

let device = Default::default();

let prefab = PREFAB_RESNET_MAP.expect_lookup_prefab("resnet18");

let weights = prefab
    .expect_lookup_pretrained_weights("tv_in1k")
    .fetch_weights(&DiskCacheConfig::default())
    .expect("Failed to fetch weights");

let model: ResNet<Wgpu> = prefab
    .to_config()
    .to_structure()
    .init(&device)
    .load_pytorch_weights(weights)
    .expect("Failed to load weights")
    // re-head the model to 10 classes:
    .with_classes(10)
    // Enable (drop_block_prob) stochastic block drops for training:
    .with_stochastic_drop_block(0.2)
    // Enable (drop_path_prob) stochastic depth for training:
    .with_stochastic_path_depth(0.1);

Example resnet_finetune - Pretrained ResNet finetuning example.

Available pretrained models:
* "resnet18"
ResNetContractConfig { layers: [2, 2, 2, 2], num_classes: 1000, stem_width: 64, output_stride: 32, bottleneck_policy: None, normalization: Batch(BatchNormConfig { num_features: 0, epsilon: 1e-5, momentum: 0.1 }), activation: Relu }
  - "resnet18.tv_in1k": TorchVision ResNet-18
  - "resnet18.a1_in1k": RSB Paper ResNet-18 a1
  - "resnet18.a2_in1k": RSB Paper ResNet-18 a2
  - "resnet18.a3_in1k": RSB Paper ResNet-18 a3
* "resnet26"
ResNetContractConfig { layers: [2, 2, 2, 2], num_classes: 1000, stem_width: 64, output_stride: 32, bottleneck_policy: Some(BottleneckPolicyConfig { pinch_factor: 4 }), normalization: Batch(BatchNormConfig { num_features: 0, epsilon: 1e-5, momentum: 0.1 }), activation: Relu }
  - "resnet26.bt_in1k": ResNet-26 pretrained on ImageNet
* "resnet34"
ResNetContractConfig { layers: [3, 4, 6, 3], num_classes: 1000, stem_width: 64, output_stride: 32, bottleneck_policy: None, normalization: Batch(BatchNormConfig { num_features: 0, epsilon: 1e-5, momentum: 0.1 }), activation: Relu }
  - "resnet34.tv_in1k": TorchVision ResNet-34
  - "resnet34.a1_in1k": RSB Paper ResNet-32 a1
  - "resnet34.a2_in1k": RSB Paper ResNet-32 a2
  - "resnet34.a3_in1k": RSB Paper ResNet-32 a3
  - "resnet34.bt_in1k": ResNet-34 pretrained on ImageNet
* "resnet50"
ResNetContractConfig { layers: [3, 4, 6, 3], num_classes: 1000, stem_width: 64, output_stride: 32, bottleneck_policy: Some(BottleneckPolicyConfig { pinch_factor: 4 }), normalization: Batch(BatchNormConfig { num_features: 0, epsilon: 1e-5, momentum: 0.1 }), activation: Relu }
  - "resnet50.tv_in1k": TorchVision ResNet-50
* "resnet101"
ResNetContractConfig { layers: [3, 4, 23, 3], num_classes: 1000, stem_width: 64, output_stride: 32, bottleneck_policy: Some(BottleneckPolicyConfig { pinch_factor: 4 }), normalization: Batch(BatchNormConfig { num_features: 0, epsilon: 1e-5, momentum: 0.1 }), activation: Relu }
  - "resnet101.tv_in1k": TorchVision ResNet-101
  - "resnet101.a1_in1k": ResNet-101 pretrained on ImageNet
* "resnet152"
ResNetContractConfig { layers: [3, 8, 36, 3], num_classes: 1000, stem_width: 64, output_stride: 32, bottleneck_policy: Some(BottleneckPolicyConfig { pinch_factor: 4 }), normalization: Batch(BatchNormConfig { num_features: 0, epsilon: 1e-5, momentum: 0.1 }), activation: Relu }
  - "resnet152.tv_in1k": TorchVision ResNet-152

bimm-contracts - a crate for static shape contracts for tensors.

Crates.io Version docs.rs

This crate is now hosted in its own repository: bimm-contracts

This crate provides a stand-alone library for defining and enforcing tensor shape contracts in-line with the Burn framework modules and methods.

use bunsen::contracts::{unpack_shape_contract, shape_contract, run_periodically};

pub fn window_partition<B: Backend, K>(
    tensor: Tensor<B, 4, K>,
    window_size: usize,
) -> Tensor<B, 4, K>
where
    K: BasicOps<B>,
{
    let [b, h_wins, w_wins, c] = unpack_shape_contract!(
        [
            "batch",
            "height" = "h_wins" * "window_size",
            "width" = "w_wins" * "window_size",
            "channels"
        ],
        &tensor,
        &["batch", "h_wins", "w_wins", "channels"],
        &[("window_size", window_size)],
    );

    let tensor = tensor
        .reshape([b, h_wins, window_size, w_wins, window_size, c])
        .swap_dims(2, 3)
        .reshape([b * h_wins * w_wins, window_size, window_size, c]);

    // Run an amortized check on the output shape.
    //
    // `run_periodically!{}` runs the first 10 times,
    // then on an incrementally lengthening schedule,
    // until it reaches its default period of 1000.
    //
    // Due to amortization, in release builds, this averages ~4ns:
    assert_shape_contract_periodically!(
        [
            "batch" * "h_wins" * "w_wins",
            "window_size",
            "window_size",
            "channels"
        ],
        &tensor,
        &[
            ("batch", b),
            ("h_wins", h_wins),
            ("w_wins", w_wins),
            ("window_size", window_size),
            ("channels", c),
        ]
    );

    tensor
}

bimm-firehose - a data loading and augmentation framework.

Crates.io Version docs.rs

This crate provides a SQL-inspired table + operations framework for modular data pipeline construction.

It’s still very much a work in progress, and any issues/design bugs reported are very appreciated.

This crate provides a set of image-specific operations for bimm-firehose.

Add-on crates:

评论

暂无评论