Package: kindle
Kindle - Making a PyTorch model easier than ever!DocumentationKindle is an easy model build package forPyTorch. Building a deep learning model became so simple that almost all model can be made by copy and paste from other existing model codes. So why code? when we can simply build a model with yaml markup file.Kindle builds a model with yaml file which its method is inspired fromYOLOv5.ContentsInstallationInstall with pipInstall from sourceFor contributorsAutoML with KindleUsageSupported modulesCustom module supportCustom module with yamlCustom module from sourcePretrainedModel supportModel profilerTest Time AugmentationInstallationInstall with pipPyTorchis required prior to install. Please visitPyTorch installation guideto install.You can installkindleby pip.$pipinstallkindleInstallkindlefor PyTorch under 1.7.1 (not tested)pipinstallkindle--no-deps
pipinstalltqdmptflopstimmtabulateeinopsInstall from sourcePlease visitInstall from source wiki pageFor contributorsPlease visitFor contributors wiki pageUsageBuild a modelMake model yaml fileExample modelhttps://pytorch.org/tutorials/beginner/blitz/cifar10_tutorial.htmlinput_size:[32,32]input_channel:3depth_multiple:1.0width_multiple:1.0backbone:[[-1,1,Conv,[6,5,1,0],{activation:LeakyReLU}],[-1,1,MaxPool,[2]],[-1,1,nn.Conv2d,[16,5,1,2],{bias:False}],[-1,1,nn.BatchNorm2d,[]],[-1,1,nn.ReLU,[]],[-1,1,MaxPool,[2]],[-1,1,Flatten,[]],[-1,1,Linear,[120,ReLU]],[-1,1,Linear,[84,ReLU]],]head:[[-1,1,Linear,[10]]]Build the model withkindlefromkindleimportModelmodel=Model("model.yaml"),verbose=True)idx|from|n|params|module|arguments|in_channel|out_channel|inshape|outshape|----------------------------------------------------------------------------------------------------------------------------------------------------------0|-1|1|616|Conv|[6,5,1,0],activation:LeakyReLU|3|8|[3,32,32]|[8,32,32]|1|-1|1|0|MaxPool|[2]|8|8|[83232]|[8,16,16]|2|-1|1|3,200|nn.Conv2d|[16,5,1,2],bias:False|8|16|[81616]|[16,16,16]|3|-1|1|32|nn.BatchNorm2d|[]|16|16|[161616]|[16,16,16]|4|-1|1|0|nn.ReLU|[]|16|16|[161616]|[16,16,16]|5|-1|1|0|MaxPool|[2]|16|16|[161616]|[16,8,8]|6|-1|1|0|Flatten|[]|-1|1024|[1688]|[1024]|7|-1|1|123,000|Linear|[120,'ReLU']|1024|120|[1024]|[120]|8|-1|1|10,164|Linear|[84,'ReLU']|120|84|[120]|[84]|9|-1|1|850|Linear|[10]|84|10|[84]|[10]|ModelSummary:20layers,137,862parameters,137,862gradientsAutoML with KindleKindleoffers the easiest way to build your own deep learning architecture. Beyond building a model, AutoML became easier withKindleandOptunaor other optimization frameworks.For further information, please refer tohttps://limjk.ai/kindle/usages/#automl-with-optunaSupported modulesDetailed documents can be foundhttps://limjk.ai/kindle/modules/ModuleComponentsArgumentsConvConv -> BatchNorm -> Activation[out_channels, kernel_size, stride, padding, groups, activation]DWConvDWConv -> BatchNorm -> Activation[out_channels, kernel_size, stride, padding, activation]FocusReshape x -> Conv -> Concat[out_channels, kernel_size, stride, padding, activation]BottleneckExpansion ConvBNAct -> ConvBNAct[out_channels, shortcut, groups, expansion, activation]BottleneckCSPCSP Bottleneck[out_channels, shortcut, groups, expansion, activation]C3CSP Bottleneck with 3 Conv[out_channels, shortcut, groups, expansion, activation]MV2BlockMobileNet v2 block[out_channels, stride, expand_ratio, activation]AvgPoolAverage pooling[kernel_size, stride, padding]MaxPoolMax pooling[kernel_size, stride, padding]GlobalAvgPoolGlobal Average Pooling[]SPPSpatial Pyramid Pooling[out_channels, [kernel_size1, kernel_size2, ...], activation]SPPFSpatial Pyramid Pooling - Fast[out_channels, kernel_size, activation]FlattenFlatten[]ConcatConcatenation[dimension]LinearLinear[out_channels, activation]AddAdd[]UpSampleUpSample[]IdentityIdentity[]YamlModuleCustom module from yaml file['yaml/file/path', arg0, arg1, ...]nn.{module_name}PyTorch torch.nn.* modulePlease refer tohttps://pytorch.org/docs/stable/nn.htmlPretrainedtimm.create_model[model_name, use_feature_maps, features_only, pretrained]PreTrainedFeatureMapBypass feature layer map fromPretrained[feature_idx]YOLOHeadYOLOv5 head module[n_classes, anchors, out_xyxy]MobileViTBlockMobileVit Block(experimental)[conv_channels, mlp_channels, depth, kernel_size, patch_size, dropout, activation]nn.{module_name}is currently experimental. This might change in the future release. Use with caution.For the supported model ofPretrainedmodule, please refer tohttps://rwightman.github.io/pytorch-image-models/resultsCustom module supportCustom module with yamlYou can make your own custom module with yaml file. Please refer tohttps://limjk.ai/kindle/tutorial/#2-design-custom-module-with-yamlfor further detail.Custom module from source codeYou can also make your own custom module from the source code. Please refer tohttps://limjk.ai/kindle/tutorial/#3-design-custom-module-from-sourcefor further detail.Pretrained model supportPre-trained model fromtimmcan be loaded in kindle yaml config file. Please refer tohttps://limjk.ai/kindle/tutorial/#4-utilize-pretrained-modelfor further detail.Model profilerKindle provides model profiling option for each layers and calculating MACs.Please refer tohttps://limjk.ai/kindle/functionality/#1-model-profilingfor further detail.Test Time AugmentationKindle model supports TTA with easy usability. Just pass the model input and augmentation function.Please refer tohttps://limjk.ai/kindle/functionality/#3-test-time-augmentationfor further detail.Recent changesVersionDescriptionDate0.4.16Fix decomposed conv fuse and add kindle version variable.2021. 10. 250.4.14Add MobileViTBlock module2021. 10. 180.4.12Add MV2Block module2021. 10. 140.4.11Add SPPF module in yolov5 v6.02021. 10. 130.4.10Fix ONNX export padding issue.2021. 10. 130.4.6Add YOLOHead to choose coordinates format.2021. 10. 090.4.5Add C3 Module2021. 10. 080.4.4Fix YOLOHead module issue with anchor scaling2021. 10. 080.4.2Add YOLOModel, and ConvBN fusion, and Fix activation apply issue2021. 09. 190.4.1Add YOLOHead, SPP, BottleneckCSP, and Focus modules2021. 09. 130.3.2Fix PreTrained to work without PreTrainedFeatureMap2021. 06. 030.3.1Calculating MACs in profiler2021. 05. 020.3.0Add PreTrained support2021. 04. 20Planned featuresCustom module supportCustom module with yaml supportUse pre-trained modelGraphical model file generatorEnsemble modelMore modules!