Caffe-like explicit model constructor. C(onfig)Model
In order to allow using your own modules you have to redefine CModel.module_from_name
after imports. Example:
from mypackage.modules import MyModule
from pytorch_tools.models import CModel as OriginalCModel
class CModel(OriginalCModel):
@staticmethod
def module_from_name(name):
return eval(name)
# now you could use `MyModule` in your configs
All models here were either written from scratch or refactored from open-source implementations.
All models here use Activated Normalization
layers instead of traditional Normalization
followed by Activation
. It makes changing activation function and normalization layer easy and convenient. It also allows using Inplace Activated Batch Norm from the box, which is essential for reducing memory footprint in segmentation tasks.
All default weights from TorchVision repository are supported. There are also weights for modified Resnet family models trained on Imagenet 2012. It's hard to keep this README up to date with new weights, so check the code for all available weight for particular model.
All models have pretrained_settings
attribute with training size, mean, std and other useful information about the weights.
All models from this repo could be used as feature extractors for both object detection and semantic segmentation. Passing encoder=True
arg will overwrite forward
method of the model to return features at 5 different resolutions starting from 1/32 to 1/2.
- Unified API. Create
resnet, efficientnet, hrnet
models using the same code - Low memory footprint dy to heavy use of inplace operations. Could be reduced even more by using
norm_layer='inplaceabn'
- Fast models. As of
04.20
Efficient net's in this repo are the fastest available on GitHub (afaik) - Support for custom number of input channels in pretrained models. Try with
resnet34(pretrained='imagenet', in_channels=7)
- All core functionality covered with tests