1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! # `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 use *;
pub use *;