bunsen 0.0.1

burn neural network extension library
Documentation
//! # `ResNet`
//!
//! Implementation of the *`ResNet`* family of models for image recognition.
//! See: [arXiv:1512.03385v1 [cs.CV]](<https://arxiv.org/abs/1512.03385>)
//!
//! ## Example
//!
//! Examples of loading pretrained model:
//!
//! ```rust,no_run
//! use burn::backend::NdArray;
//! 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<NdArray> = 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);
//! ```
//!
//! ## Configuration
//!
//! This module uses 2-layer configuration.
//!
//! * [`ResNetContractConfig`]
//! * [`ResNetStructureConfig`]
//!
//! The high-level abstract config describes `ResNet` modules semantically,
//! while the low-level config describes the structural config.
//!
//! As the compatibility matrix grows; we may differentiate the abstract configs
//! for different variants of `ResNet`; but the goal is that for any given
//! family, there should be a simple to configure abstract config.
//!
//! The structural config is focused on the actual structure of the model,
//! and the intended user base is people working on variants of `ResNet`.
//!
//! It should continue to get cheaper to build `ResNet` variants.
//!
//! ## Compatibility
//!
//! `ResNet` has evolved into a large family of models, and this crate aims
//! to evolve towards equity with the ``timm`` library of models.
//!
//! Unfortunately, the equivalence matrix itself represents a large
//! amount of work and is not yet complete.
//!
//! An incomplete list of missing features includes:
//! * all the fancy-stem options
//! * injectable norm layers
//! * injectable activation layers
//! * conv / avg downsample switching
//! * anti-aliasing
//! * block attention

pub mod basic_block;
pub mod bottleneck_block;
pub mod downsample;
pub mod layer_block;
pub mod pretrained;
pub mod residual_block;
pub mod resnet_io;
pub mod resnet_model;
pub mod stems;
pub mod util;

pub use pretrained::*;
pub use resnet_model::*;