{"id":22451465,"url":"https://github.com/chanlumerico/luma-neural","last_synced_at":"2025-03-27T12:26:51.289Z","repository":{"id":257331049,"uuid":"857933278","full_name":"ChanLumerico/luma-neural","owner":"ChanLumerico","description":"Deep Learning Models and Neural Network Utilities of Luma Python Library","archived":false,"fork":false,"pushed_at":"2024-11-04T10:37:15.000Z","size":316,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T17:11:22.675Z","etag":null,"topics":["deep-learning","neural-network","package"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChanLumerico.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-16T01:16:22.000Z","updated_at":"2024-11-04T10:37:18.000Z","dependencies_parsed_at":"2024-09-18T04:06:52.076Z","dependency_job_id":"8eb23388-8848-44bb-a87f-7b6f112a5596","html_url":"https://github.com/ChanLumerico/luma-neural","commit_stats":null,"previous_names":["chanlumerico/luma-neural"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChanLumerico%2Fluma-neural","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChanLumerico%2Fluma-neural/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChanLumerico%2Fluma-neural/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChanLumerico%2Fluma-neural/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChanLumerico","download_url":"https://codeload.github.com/ChanLumerico/luma-neural/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245843532,"owners_count":20681529,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","neural-network","package"],"created_at":"2024-12-06T06:08:05.881Z","updated_at":"2025-03-27T12:26:51.267Z","avatar_url":"https://github.com/ChanLumerico.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"https://raw.githubusercontent.com/ChanLumerico/luma/main/img/title/nn_dark.png\" alt=\"logo\" height=\"50%\" width=\"50%\"\u003e\n\nDeep learning models and neural network utilities of Luma\n\n---\n\n## Neural Layers\n\n*luma.neural.layer 🔗*\n\n### Convolution\n\n| Class | Input Shape | Output Shape |\n| --- | --- | --- |\n| `Conv1D` | $(N,C_{in},W)$ | $(N,C_{out},W_{pad})$ |\n| `Conv2D` | $(N,C_{in},H,W)$ | $(N,C_{out},H_{pad},W_{pad})$ |\n| `Conv3D` | $(N,C_{in},D,H,W)$ | $(N,C_{out},D_{pad},H_{pad},W_{pad})$ |\n| `DepthConv1D` | $(N,C,W)$ | $(N,C,W_{pad})$ |\n| `DepthConv2D` | $(N,C,H,W)$ | $(N,C,H_{pad},W_{pad})$ |\n| `DepthConv3D` | $(N,C,D,H,W)$ | $(N,C,D_{pad},H_{pad},W_{pad})$ |\n\n### Pooling\n\n| Class | Input Shape | Output Shape |\n| --- | --- | --- |\n| `Pool1D` | $(N,C,W_{in})$ | $(N,C,W_{out})$ |\n| `Pool2D` | $(N,C,H_{in},W_{in})$ | $(N,C,H_{out},W_{out})$ |\n| `Pool3D` | $(N,C,D_{in},H_{in},W_{in})$ | $(N,C,D_{out},H_{out},W_{out})$ |\n| `GlobalAvgPool1D` | $(N,C,W)$ | $(N,C,1)$ |\n| `GlobalAvgPool2D` | $(N,C,H,W)$ | $(N,C,1,1)$ |\n| `GlovalAvgPool3D` | $(N,C,D,H,W)$ | $(N,C,1,1,1)$ |\n| `AdaptiveAvgPool1D` | $(N,C,W_{in})$ | $(N,C,W_{out})$ |\n| `AdaptiveAvgPool2D` | $(N,C,H_{in},W_{in})$ | $(N,C,H_{out},W_{out})$ |\n| `AdaptiveAvgPool3D` | $(N,C,D_{in},H_{in},W_{in})$ | $(N,C,D_{out},H_{out},W_{out})$ |\n| `LpPool1D` | $(N,C,W_{in})$ | $(N,C,W_{out})$ |\n| `LpPool2D` | $(N,C,H_{in}, W_{in})$ | $(N,C,H_{out},W_{out})$ |\n| `LpPool3D` | $(N,C,D_{in},H_{in},W_{in})$ | $(N,C,D_{out},H_{out},W_{out})$ |\n\n### Dropout\n\n| Class | Input Shape | Output Shape |\n| --- | --- | --- |\n| `Dropout` | $(*)$ | $(*)$ |\n| `Dropout1D` | $(N,C,W)$ | $(N,C,W)$ |\n| `Dropout2D` | $(N,C,H,W)$ | $(N,C,H,W)$ |\n| `Dropout3D` | $(N,C,D,H,W)$ | $(N,C,D,H,W)$ |\n| `DropBlock1D` | $(N,C,W)$ | $(N,C,W)$ |\n| `DropBlock2D` | $(N,C,H,W)$ | $(N,C,H,W)$ |\n| `DropBlock3D` | $(N,C,D,H,W)$ | $(N,C,D,H,W)$ |\n\n### Linear\n\n| Class | Input Shape | Output Shape |\n| --- | --- | --- |\n| `Flatten` | $(N, *)$ | $(N, -1)$ |\n| `Reshape` | $(*_{in})$ | $(*_{out})$ |\n| `Transpose` | $(*_{in})$ | $(*_{\\mathcal{P}(in)})$ |\n| `Dense` | $(N,L_{in})$ | $(N,L_{out})$ |\n| `DenseND` | $(*,F_{in},*)$ | $(*,F_{out},*)$ |\n| `Identity` | $(*)$ | $(*)$ |\n\n### Normalization\n\n| Class | Input Shape | Output Shape |\n| --- | --- | --- |\n| `BatchNorm1D` | $(N,C,W)$ | $(N,C,W)$ |\n| `BatchNorm2D` | $(N,C,H,W)$ | $(N,C,H,W)$ |\n| `BatchNorm3D` | $(N,C,D,H,W)$ | $(N,C,D,H,W)$ |\n| `LocalResponseNorm` | $(N,C,*)$ | $(N,C,*)$ |\n| `GlobalResponseNorm` | $(N,C,*)$ | $(N,C,*)$ |\n| `LayerNorm` | $(N,*)$ | $(N,*)$ |\n\n### Attention\n\n| Class | Input Shape | Output Shape |\n| --- | --- | --- |\n| `ScaledDotProductAttention` | $(N,H,L,d_{head})$ | $(N,H,L,d_{head})$ |\n| `MultiHeadAttention` | $(N,L,d_{model})$ | $(N,L,d_{model})$ |\n| `CrossMultiHeadAttention` | $(N,L,d_{model})$ | $(N,L,d_{model})$ |\n\n### Utility\n\n| Class | Input Shape | Output Shape |\n| --- | --- | --- |\n| `Slice` | $(*)$ | $(*_{sliced})$ |\n\n---\n\n## Neural Blocks\n\n*luma.neural.block 🔗*\n\n### Standard Blocks\n\n| Class | # of Layers | Input Shape | Output Shape |\n| --- | --- | --- | --- |\n| `ConvBlock1D` | 2~3 | $(N,C_{in},W_{in})$ | $(N,C_{out},W_{out})$ |\n| `ConvBlock2D` | 2~3 | $(N,C_{in},H_{in}, W_{in})$ | $(N,C_{out},H_{out}, W_{out})$ |\n| `ConvBlock3D` | 2~3 | $(N,C_{in},D_{in},H_{in},W_{in})$ | $(N,C_{out},D_{out},H_{out},W_{out})$ |\n| `SeparableConv1D` | 3~5 | $(N,C_{in},W_{in})$ | $(N,C_{out},W_{out})$ |\n| `SeparableConv2D` | 3~5 | $(N,C_{in},H_{in}, W_{in})$ | $(N,C_{out},H_{out}, W_{out})$ |\n| `SeparableConv3D` | 3~5 | $(N,C_{in},D_{in},H_{in},W_{in})$ | $(N,C_{out},D_{out},H_{out},W_{out})$ |\n| `DenseBlock` | 2~3 | $(N,L_{in})$ | $(N,L_{out})$ |\n\n### Inception Blocks\n\n| Class | # of Layers | Input Shape | Output Shape |\n| --- | --- | --- | --- |\n| `IncepBlock.V1` | 19 | $(N,C_{in},H_{in},W_{in})$ | $(N,C_{out},H_{out},W_{out})$ |\n| `IncepBlock.V2_TypeA` | 22 | $(N,C_{in},H_{in},W_{in})$ | $(N,C_{out},H_{out},W_{out})$ |\n| `IncepBlock.V2_TypeB` | 31 | $(N,C_{in},H_{in},W_{in})$ | $(N,C_{out},H_{out},W_{out})$ |\n| `IncepBlock.V2_TypeC` | 28 | $(N,C_{in},H_{in},W_{in})$ | $(N,C_{out},H_{out},W_{out})$ |\n| `IncepBlock.V2_Redux` | 16 | $(N,C_{in},H_{in},W_{in})$ | $(N,C_{out},H_{out},W_{out})$ |\n| `IncepBlock.V4_Stem` | 38 | $(N,3,299,299)$ | $(N,384,35,35)$ |\n| `IncepBlock.V4_TypeA` | 24 | $(N,384,35,35)$ | $(N,384,35,35)$ |\n| `IncepBlock.V4_TypeB` | 33 | $(N,1024,17,17)$ | $(N,1024,17,17)$ |\n| `IncepBlock.V4_TypeC` | 33 | $(N,1536,8,8)$ | $(N,1536,8,8)$ |\n| `IncepBlock.V4_ReduxA` | 15 | $(N,384,35,35)$ | $(N,1024,17,17)$ |\n| `IncepBlock.V4_ReduxB` | 21 | $(N,1024,17,17)$ | $(N,1536,8,8)$ |\n\n### Inception-Res Blocks\n\n| Class | # of Layers | Input Shape | Output Shape |\n| --- | --- | --- | --- |\n| `IncepResBlock.V1_TypeA` | 22 | $(N,256,35,35)$ | $(N,256,35,35)$ |\n| `IncepResBlock.V1_TypeB` | 16 | $(N,896,17,17)$ | $(N,896,17,17)$ |\n| `IncepResBlock.V1_TypeC` | 16 | $(N,1792,8,8)$ | $(N,1792,8,8)$ |\n| `IncepResBlock.V1_Redux` | 24 | $(N,896,17,17)$ | $(N,1792,8,8)$ |\n| `IncepResBlock.V2_TypeA` | 22 | $(N,384,35,35)$ | $(N,384,35,35)$ |\n| `IncepResBlock.V2_TypeB` | 16 | $(N,1280,17,17)$ | $(N,1280,17,17)$ |\n| `IncepResBlock.V2_TypeC` | 16 | $(N,2272,8,8)$ | $(N,2272,8,8)$ |\n| `IncepResBlock.V2_Redux` | 24 | $(N,1280,17,17)$ | $(N,2272,8,8)$ |\n\n### ResNet Blocks\n\n| Class | # of Layers | Input Shape | Output Shape |\n| --- | --- | --- | --- |\n| `ResNetBlock.Basic` | 7~ | $(N,C_{in},H_{in},W_{in})$ | $(N,C_{out},H_{out},W_{out})$ |\n| `ResNetBlock.Bottleneck` | 10~ | $(N,C_{in},H_{in},W_{in})$ | $(N,C_{out},H_{out},W_{out})$ |\n| `ResNetBlock.PreActBottleneck` | 10~ | $(N,C_{in},H_{in},W_{in})$ | $(N,C_{out},H_{out},W_{out})$ |\n| `ResNetBlock.Bottleneck_SE` | 16~ | $(N,C_{in},H_{in},W_{in})$ | $(N,C_{out},H_{out},W_{out})$ |\n\n### Xception Blocks\n\n| Class | # of Layers | Input Shape | Output Shape |\n| --- | --- | --- | --- |\n| `XceptionBlock.Entry` | 42 | $(N,3,299,299)$ | $(N,728,19,19)$ |\n| `XceptionBlock.Middle` | 14 | $(N,728,19,19)$ | $(N,728,19,19)$ |\n| `XceptionBlock.Exit` | 11 | $(N,728,19,19)$ | $(N,1024,9,9)$ |\n\n### SE(Squeeze \u0026 Excitation) Blocks\n\n| Class | # of Layers | Input Shape | Output Shape |\n| --- | --- | --- | --- |\n| `SEBlock1D` | 6 | $(N,C,W)$ | $(N,C,W)\\text{ or }(N,C)$ |\n| `SEBlock2D` | 6 | $(N,C,H,W)$ | $(N,C,H,W)\\text{ or }(N,C)$ |\n| `SEBlock3D` | 6 | $(N,C,D,H,W)$ | $(N,C,D,H,W)\\text{ or }(N,C)$ |\n\n### MobileNet Blocks\n\n| Class | # of Layers | Input Shape | Output Shape |\n| --- | --- | --- | --- |\n| `MobileNetBlock.InvRes` | 6~9 | $(N,C_{in},H_{in},W_{in})$ | $(N,C_{out},H_{out},W_{out})$ |\n| `MobileNetBlock.InvRes_SE` | 14~17 | $(N,C_{in},H_{in},W_{in})$ | $(N,C_{out},H_{out},W_{out})$ |\n\n### DenseNet Blocks\n\n| Class | # of Layers | Input Shape | Output Shape |\n| --- | --- | --- | --- |\n| `DenseNetBlock.Composite` | 6 | $(N,C,H,W)$ | $(N,G,H,W)$ |\n| `DenseNetBlock.DenseUnit` | $6\\times l$ | $(N,C,H,W)$ | $(N,C+L\\times G,H,W)$ |\n| `DenseNetBlock.Transition` | 4 | $(N,C,H,W)$ | $(N,\\lfloor\\theta\\times C\\rfloor,\\lfloor H/2\\rfloor,\\lfloor W/2\\rfloor)$ |\n\n### EfficientNet Blocks\n\n| Class | # of Layers | Input Shape | Output Shape |\n| --- | --- | --- | --- |\n| `EfficientBlock.MBConv` | 14~17 | $(N,C_{in},H_{in},W_{in})$ | $(N,C_{out},H_{out},W_{out})$ |\n| `EfficientBlock.FusedMBConv` | 12~15 | $(N,C_{in},H_{in},W_{in})$ | $(N,C_{out},H_{out},W_{out})$ |\n\n### SK(Selective Kernel) Blocks\n\n| Class | # of Layers | Input Shape | Output Shape |\n| --- | --- | --- | --- |\n| `SKBlock1D` | $5k+8$ | $(N,C_{in},W)$ | $(N,C_{out},W)$ |\n| `SKBlock2D` | $5k+8$ | $(N,C_{in},H,W)$ | $(N,C_{out},H,W)$ |\n| `SKBlock3D` | $5k+8$ | $(N,C_{in},D,H,W)$ | $(N,C_{out},D,H,W)$ |\n\n### ResNeSt Block\n\n| Class | # of Layers | Input Shape | Output Shape |\n| --- | --- | --- | --- |\n| `ResNeStBlock` | $22\\sim 24+8r$ | $(N,C_{in},H_{in},W_{in})$ | $(N,C_{out},H_{out},W_{out})$ |\n\n### ConvNeXt Blocks\n\n| Class | # of Layers | Input Shape | Output Shape |\n| --- | --- | --- | --- |\n| `ConvNeXtBlock.V1` | 7 | $(N,C,H,W)$ | $(N,C,H,W)$ |\n| `ConvNeXtBlock.V2` | 8 | $(N,C,H,W)$ | $(N,C,H,W)$ |\n\n### Transformer Blocks\n\n| Class | # of Layers | Input Shape | Output Shape |\n| --- | --- | --- | --- |\n| `PositionwiseFeedForward` | 3 | $(N,L,d_{model})$ | $(N,L,d_{model})$ |\n| `Encoder` | 11 | $(N,L,d_{model})$ | $(N,L,d_{model})$ |\n| `Decoder` | 13 | $(N,L,d_{model})$ | $(N,L,d_{model})$ |\n| `EncoderStack` | $11n+0\\sim2$ | $(N,L,d_{model})$ | $(N,L,d_{model})$ |\n| `DecoderStack` | $13n$ | $(N,L,d_{model})$ | $(N,L,d_{model})$ |\n\n*Waiting for future updates…🔮*\n\n---\n\n## Neural Models\n\n*luma.neural.model 🔗*\n\n### Image Classification Models\n\n#### LeNet Series\n\n\u003e LeCun, Yann, et al. \"Backpropagation Applied to Handwritten Zip Code Recognition.\" Neural Computation, vol. 1, no. 4, 1989, pp. 541-551.\n\u003e \n\n| Class | # of Layers | Input Shape | Weights | Biases | Total Param. | Implemented |\n| --- | --- | --- | --- | --- | --- | --- |\n| `LeNet_1` | 6 | $(N,1,28,28)$ | 2,180 | 22 | 2,202 | ✅ |\n| `LeNet_4` | 8 | $(N,1,32,32)$ | 50,902 | 150 | 51,052 | ✅ |\n| `LeNet_5` | 10 | $(N,1,32,32)$ | 61,474 | 236 | 61,170 | ✅ |\n\n#### AlexNet Series\n\n\u003e Krizhevsky, Alex, Ilya Sutskever, and Geoffrey E. Hinton. \"ImageNet Classification with Deep Convolutional Neural Networks.\" Advances in Neural\nInformation Processing Systems, 2012.\n\u003e \n\n| Class | # of Layers | Input Shape | Weights | Biases | Total Param. | Implemented |\n| --- | --- | --- | --- | --- | --- | --- |\n| `AlexNet` | 21 | $(N,3,227,227)$ | 62,367,776 | 10,568 | 62,378,344 | ✅ |\n| `ZFNet` | 21 | $(N,3,227,227)$ | 58,292,000 | 9,578 | 58,301,578 | ✅ |\n\n#### VGGNet Series\n\n\u003e Simonyan, Karen, and Andrew Zisserman. \"Very Deep Convolutional Networks for Large-Scale Image Recognition.\" arXiv preprint arXiv:1409.1556, 2014.\n\u003e \n\n| Class | # of Layers | Input Shape | Weights | Biases | Total Param. | Implemented |\n| --- | --- | --- | --- | --- | --- | --- |\n| `VGGNet_11` | 27 | $(N,3,224,224)$ | 132,851,392 | 11,944 | 132,863,336 | ✅ |\n| `VGGNet_13` | 31 | $(N,3,224,224)$ | 133,035,712 | 12,136 | 133,047,848 | ✅ |\n| `VGGNet_16` | 37 | $(N,3,224,224)$ | 138,344,128 | 13,416 | 138,357,544 | ✅ |\n| `VGGNet_19` | 43 | $(N,3,224,224)$ | 143,652,544 | 14,696 | 143,667,240 | ✅ |\n\n#### Inception Series\n\n*Inception-v1, v2, v3*\n\n\u003e Szegedy, Christian, et al. “Going Deeper with Convolutions.” Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2015, pp. 1-9.\n\u003e \n\n| Class | # of Layers | Input Shape | Weights | Biases | Total Param. | Implemented |\n| --- | --- | --- | --- | --- | --- | --- |\n| `Inception_V1` | 182 | $(N,3,224,224)$ | 6,990,272 | 8,280 | 6,998,552 | ✅ |\n| `Inception_V2` | 242 | $(N,3,299,299)$ | 24,974,688 | 20,136 | 24,994,824 | ✅ |\n| `Inception_V3` | 331 | $(N,3,299,299)$ | 25,012,960 | 20,136 | 25,033,096 | ✅ |\n\n*Inception-v4, Inception-ResNet-v1, v2*\n\n\u003e Szegedy, Christian, et al. “Inception-v4, Inception-ResNet and the Impact of Residual Connections on Learning.” Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence, 2017, pp. 4278-4284.\n\u003e \n\n| Class | # of Layers | Input Shape | Weights | Biases | Total Param. | Implemented |\n| --- | --- | --- | --- | --- | --- | --- |\n| `Inception_V4` | 504 | $(N,3,299,299)$ | 42,641,952 | 32,584 | 42,674,536 | ✅ |\n| `Inception_ResNet_V1` | 410 | $(N,3,299,299)$ | 21,611,648 | 33,720 | 21,645,368 | ✅ |\n| `Inception_ResNet_V2` | 431 | $(N,3,299,299)$ | 34,112,608 | 43,562 | 34,156,170 | ✅ |\n\n*Xception*\n\n\u003e Chollet, François. “Xception: Deep Learning with Depthwise Separable Convolutions.” Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017, pp. 1251-1258.\n\u003e \n\n| Class | # of Layers | Input Shape | Weights | Biases | Total Param. | Implemented |\n| --- | --- | --- | --- | --- | --- | --- |\n| `Xception` | 174 | $(N,3,299,299)$ | 22,113,984 | 50,288 | 22,164,272 | ✅ |\n\n#### ResNet Series\n\n*ResNet-18, 34, 50, 101, 152*\n\n\u003e He, Kaiming, et al. “Deep Residual Learning for Image Recognition.“ Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016, pp. 770-778.\n\u003e \n\n| Class | # of Layers | Input Shape | Weights | Biases | Total Param. | Implemented |\n| --- | --- | --- | --- | --- | --- | --- |\n| `ResNet_18` | 77 | $(N,3,224,224)$ | 11,688,512 | 5,800 | 11,694,312 | ✅ |\n| `ResNet_34` | 149 | $(N,3,224,224)$ | 21,796,672 | 9,512 | 21,806,184 | ✅ |\n| `ResNet_50` | 181 | $(N,3,224,224)$ | 25,556,032 | 27,560 | 25,583,592 | ✅ |\n| `ResNet_101` | 367 | $(N,3,224,224)$ | 44,548,160 | 53,762 | 44,601,832 | ✅ |\n| `ResNet_152` | 554 | $(N,3,244,244)$ | 60,191,808 | 76,712 | 60,268,520 | ✅ |\n\n*ResNet-200, 269, 1001*\n\n\u003e He, Kaiming, et al. “Identity Mappings in Deep Residual Networks.” European Conference on Computer Vision (ECCV), 2016, pp. 630-645.\n\u003e \n\n| Class | # of Layers | Input Shape | Weights | Biases | Total Param. | Implemented |\n| --- | --- | --- | --- | --- | --- | --- |\n| `ResNet_200` | 793 | $(N,3,244,244)$ | 64,668,864 | 89,000 | 64,757,864 | ✅ |\n| `ResNet_269` | 1,069 | $(N,3,244,244)$ | 102,068,416 | 127,400 | 102,195,816 | ✅ |\n| `ResNet_1001` | 1,657 | $(N,3,224,224)$ | 159,884,992 | 208,040 | 160,093,032 | ✅ |\n\n#### MobileNet Series\n\n*MobileNet-v1*\n\n\u003e Howard, Andrew G., et al. “MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications.” arXiv, 17 Apr. 2017, [arxiv.org/abs/1704.04861](http://arxiv.org/abs/1704.04861).\n\u003e \n\n*MobileNet-v2*\n\n\u003e Sandler, Mark, et al. “MobileNetV2: Inverted Residuals and Linear Bottlenecks.” Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018, pp. 4510-4520.\n\u003e \n\n*MobileNet-v3 Small, Large*\n\n\u003e Howard, Andrew, et al. “Searching for MobileNetV3.” Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), 2019, pp. 1314-1324.\n\u003e \n\n| Class | # of Layers | Input Shape | Weights | Biases | Total Param. | Implemented |\n| --- | --- | --- | --- | --- | --- | --- |\n| `MobileNet_V1` | 31 | $(N,3,224,224)$ | 4,230,976 | 11,944 | 4,242,920 | ✅ |\n| `MobileNet_V2` | 148 | $(N,3,224,224)$ | 8,418,624 | 19,336 | 8,437,960 | ✅ |\n| `MobileNet_V3_S` | 161 | $(N,3,224,224)$ | 32,455,856 | 326,138 | 32,781,994 | ✅ |\n| `MobileNet_V3_L` | 180 | $(N,3,224,224)$ | 167,606,960 | 1,136,502 | 168,743,462 | ✅ |\n\n#### SENet Series\n\n\u003e Hu, Jie, et al. “Squeeze-and-Excitation Networks.” Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018, pp. 7132-7141.\n\u003e \n\n| Class | # of Layers | Input Shape | Weights | Biases | Total Param. | Implemented |\n| --- | --- | --- | --- | --- | --- | --- |\n| `SE_ResNet_50` | 263 | $(N,3,224,224)$ | 35,615,808 | 46,440 | 35,662,248 | ✅ |\n| `SE_ResNet_152` | 803 | $(N,3,224,224)$ | 86,504,512 | 136,552 | 86,641,064 | ✅ |\n| `SE_Inception_ResNet_V2` | 569 | $(N,3,299,299)$ | 58,794,080 | 80,762 | 58,874,842 | ✅ |\n| `SE_DenseNet_121` | 388 | $(N,3,224,224)$ | 9,190,272 | 14,760 | 9,205,032 | ✅ |\n| `SE_DenseNet_169` | 532 | $(N,3,224,224)$ | 16,515,968 | 19,848 | 16,535,816 | ✅ |\n| `SE_ResNeXt_50` | 299 | $(N,3,224,224)$ | 37,135,680 | 53,992 | 37,189,672 | ✅ |\n| `SE_ResNeXt_101` | 605 | $(N,3,224,224)$ | 65,197,376 | 110,568 | 65,307,944 | ✅ |\n\n#### DenseNet Series\n\n\u003e Huang, Gao, et al. \"Densely Connected Convolutional Networks.\" Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2017, pp. 4700-4708.\n\u003e \n\n| Class | # of Layers | Input Shape | Weights | Biases | Total Param. | Implemented |\n| --- | --- | --- | --- | --- | --- | --- |\n| `DenseNet_121` | 364 | $(N,3,224,224)$ | 7,977,856 | 11,240 | 7,989,096 | ✅ |\n| `DenseNet_169` | 508 | $(N,3,224,224)$ | 14,148,480 | 15,208 | 14,163,688 | ✅ |\n| `DenseNet_201` | 604 | $(N,3,299,299)$ | 20,012,928 | 18,024 | 20,030,952 | ✅ |\n| `DenseNet_264` | 794 | $(N,3,299,299)$ | 33,336,704 | 23,400 | 33,360,104 | ✅ |\n\n#### EfficientNet Series\n\n*EfficientNet-B0, B1, B2, B3, B4, B5, B6, B7*\n\n\u003e Tan, Mingxing, and Quoc V. Le. \"EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks.\" International Conference on Machine Learning, 2020, pp. 6105-6114. arXiv:1905.11946.\n\u003e\n\n*EfficientNet-v2-S, M, L, XL*\n\n\u003eTan, Mingxing, and Quoc Le. “EfficientNetV2: Smaller Models and Faster Training.” Proceedings of the 38th International Conference on Machine Learning (ICML), vol. 139, 2021, pp. 10096-10106.\n\u003e\n\n| Class | # of Layers | Input Shape | Weights | Biases | Total Param. | Implemented |\n| --- | --- | --- | --- | --- | --- | --- |\n| `EfficientNet_B0` | 262 | $(N,3,224,224)$ | 4,803,040 | 24,268 | 4,827,308 | ✅ |\n| `EfficientNet_B1` | 310 | $(N,3,240,240)$ | 6,544,500 | 32,568 | 6,577,068 | ✅ |\n| `EfficientNet_B2` | 358 | $(N,3,260,260)$ | 8,503,007 | 40,160 | 8,543,167 | ✅ |\n| `EfficientNet_B3` | 435 | $(N,3,300,300)$ | 13,657,980 | 57,390 | 13,715,370 | ✅ |\n| `EfficientNet_B4` | 515 | $(N,3,380,380)$ | 17,877,155 | 72,278 | 17,949,433 | ✅ |\n| `EfficientNet_B5` | 611 | $(N,3,456,456)$ | 24,674,011 | 94,261 | 24,768,272 | ✅ |\n| `EfficientNet_B6` | 768 | $(N,3,528,528)$ | 38,260,230 | 132,704 | 38,392,934 | ✅ |\n| `EfficientNet_B7` | 925 | $(N,3,600,600)$ | 56,528,906 | 178,066 | 56,706,972 | ✅ |\n| `EfficientNet_V2_S` | 634 | $(N,3,384,384)$ | 18,414,552 | 86,116 | 18,500,668 | ✅ |\n| `EfficientNet_V2_M` | 864 | $(N,3,480,480)$ | 46,012,920 | 162,264 | 46,175,184 | ✅ |\n| `EfficientNet_V2_L` | 1,292 | $(N,3,480,480)$ | 104,084,896 | 303,032 | 104,387,928 | ✅ |\n| `EfficientNet_V2_XL` | 1,530 | $(N,3,480,480)$ | 201,762,976 | 450,227 | 202,213,203 | ✅ |\n\n#### ResNeXt Series\n\n*ResNeXt-50, 101*\n\n\u003eXie, Saining, et al. \"Aggregated Residual Transformations for Deep Neural Networks.\" Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017, pp. 1492-1500.\n\u003e\n\n| Class | # of Layers | Input Shape | Weights | Biases | Total Param. | Implemented |\n| --- | --- | --- | --- | --- | --- | --- |\n| `ResNeXt_50` | 187 | $(N,3,224,224)$ | 25,027,904 | 35,112 | 25,063,016 | ✅ |\n| `ResNeXt_101` | 374 | $(N,3,224,224)$ | 44,176,704 | 69,928 | 44,246,632 | ✅ |\n\n#### SKNet Series\n\n\u003eLi, Xiang, et al. \"Selective Kernel Networks.\" Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2019, pp. 510-519.\n\u003e\n\n| Class | # of Layers | Input Shape | Weights | Biases | Total Param. | Implemented |\n| --- | --- | --- | --- | --- | --- | --- |\n| `SK_ResNet_50` | 443 | $(N,3,224,224)$ | 57,236,160 | 39,124 | 57,275,284 | ✅ |\n| `SK_ResNet_101` | 902 | $(N,3,224,224)$ | 104,298,688 | 78,564 | 104,377,252 | ✅ |\n| `SK_ResNeXt_50` | 443 | $(N,3,224,224)$ | 29,915,712 | 58,240 | 29,973,952 | ✅ |\n| `SK_ResNeXt_101` | 902 | $(N,3,224,224)$ | 53,399,104 | 119,712 | 53,518,816 | ✅ |\n\n#### ResNeSt Series\n\n\u003eZhang, Hang, et al. “ResNeSt: Split-Attention Networks.” Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2020, pp. 2736-2746.\n\u003e\n\n| Class | # of Layers | Input Shape | Weights | Biases | Total Param. | Implemented |\n| --- | --- | --- | --- | --- | --- | --- |\n| `ResNeSt_50` | 517 | $(N,3,224,224)$ | 26,535,136 | 39,944 | 26,575,080 | ✅ |\n| `ResNeSt_101` | 1,044 | $(N,3,224,224)$ | 46,371,552 | 80,200 | 46,451,752 | ✅ |\n| `ResNeSt_200` | 2,067 | $(N,3,224,224)$ | 67,392,736 | 134,664 | 67,527,400 | ✅ |\n| `ResNeSt_269` | 2,780 | $(N,3,224,224)$ | 106,451,680 | 193,864 | 106,645,544 | ✅ |\n\n#### ConvNeXt Series\n\n*ConvNeXt-v1*\n\n\u003eLiu, Zhuang, et al. \"A ConvNet for the 2020s.\" Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022, pp. 11976-11986.\n\u003e\n\n*ConvNeXt-v2*\n\n\u003eZhou, Xinyu, et al. \"ConvNeXt V2: Co-designing and Scaling ConvNets with Masked Autoencoders.\" arXiv preprint arXiv:2301.00808 (2023).\n\u003e\n\n| Class | # of Layers | Input Shape | Weights | Biases | Total Param. | Implemented |\n| --- | --- | --- | --- | --- | --- | --- |\n| `ConvNeXt_T` | 137 | $(N,3,224,224)$ | 28,524,000 | 42,184 | 28,566,184 | ✅ |\n| `ConvNeXt_S` | 263 | $(N,3,224,224)$ | 50,096,352 | 83,656 | 50,180,008 | ✅ |\n| `ConvNeXt_B` | 263 | $(N,3,224,224)$ | 88,422,016 | 111,208 | 88,533,224 | ✅ |\n| `ConvNeXt_L` | 263 | $(N,3,224,224)$ | 197,513,664 | 166,312 | 197,679,976 | ✅ |\n| `ConvNeXt_XL` | 263 | $(N,3,224,224)$ | 349,859,072 | 221,416 | 350,080,488 | ✅ |\n| `ConvNeXt_V2_A` | 108 | $(N,3,224,224)$ | 3,690,800 | 12,640 | 3,703,440 | ✅ |\n| `ConvNeXt_V2_F` | 108 | $(N,3,224,224)$ | 5,212,320 | 14,968 | 5,227,288 | ✅ |\n| `ConvNeXt_V2_P` | 108 | $(N,3,224,224)$ | 9,038,720 | 19,624 | 9,058,344 | ✅ |\n| `ConvNeXt_V2_N` | 124 | $(N,3,224,224)$ | 15,584,480 | 28,120 | 15,612,600 | ✅ |\n| `ConvNeXt_V2_T` | 156 | $(N,3,224,224)$ | 28,576,992 | 42,184 | 28,619,176 | ✅ |\n| `ConvNeXt_V2_B` | 300 | $(N,3,224,224)$ | 88,566,400 | 111,208 | 88,677,608 | ✅ |\n| `ConvNeXt_V2_L` | 300 | $(N,3,224,224)$ | 197,730,240 | 166,312 | 197,896,552 | ✅ |\n| `ConvNeXt_V2_H` | 300 | $(N,3,224,224)$ | 659,875,040 | 304,072 | 660,179,112 | ✅ |\n\n#### CoAtNet Series\n\n*Waiting for future updates…🔮*\n\n### Sequence-to-Sequence Models\n\n#### Transformer Series\n\n*Transformer-(Base, Big)*\n\n\u003eVaswani, Ashish, et al. \"Attention Is All You Need.\" Advances in Neural Information Processing Systems, vol. 30, 2017.\n\u003e\n\n| Class | # of Layers | Input Shape | Weights | Biases | Total Param. | Implemented |\n| --- | --- | --- | --- | --- | --- | --- |\n| `Transformer_Base` | 147 | $(N,L,512)$ | 62,984,192 | 104,584 | 63,088,776 | ✅ |\n| `Transformer_Big` | 147 | $(N,L,1024)$ | 214,048,768 | 172,168 | 214,220,936 | ✅ |\n\n*Waiting for future updates…🔮*\n\n---\n\n## How to Use `NeuralModel`\n\n*luma.neural.base.NeuralModel 🔗*\n\nThe class `NeuralModel` is an abstract base class(ABC) for neural network models, supporting customized neural networks and dynamic model construction.\n\n### 1️⃣ Create a new model class\n\nCreate a class for your custom neural model, inheriting `NeuralModel`.\n\n```python\nclass MyModel(NeuralModel): ...\n```\n\n### 2️⃣ Build a constructor method\n\nAdd a constructor method `__init__` with all the necessary arguments for `NeuralModel` included. You can add additional arguments if needed. All the necessary arguments will be auto-completed.\n\n```python\nclass MyModel(NeuralModel):\n    def __init__(\n        self,\n        batch_size: int,\n        n_epochs: int,\n        valid_size: float,\n        early_stopping: bool,\n        patience: int,\n        shuffle: bool,\n        random_state: int | None,\n        deep_verbose: bool,\n    ) -\u003e None:\n        ...\n```\n\n### 3️⃣ Initialize `self.model` attribute as a new instance of `Sequential`\n\nYour new custom neural model’s components(i.e. layers, blocks) are stacked up at the inherited `self.model`. \n\n```python\ndef __init__(self, ...) -\u003e None:\n    ...\n    self.model = Sequential(\n        # Insert Layers if needed\n    )\n```\n\n### 4️⃣ Call `init_model()` to initialize the model attribute\n\nYou must call the inherited method `init_model()` inside `__init__` in order to initialize `self.model`.\n\n```python\ndef __init__(self, ...) -\u003e None:\n    ...\n    self.model = Sequential(...)\n    self.init_model()  # Necessary\n```\n\n### 5️⃣ Call `build_model()` to construct the neural network model\n\nYou must call the inherited abstract method `build_model()` inside `__init__`  in order to construct the neural network.\n\n```python\ndef __init__(self, ...) -\u003e None:\n    ...\n    self.model = Sequential(...)\n    self.init_model()\n    self.build_model()  # Necessary\n```\n\n### 6️⃣ Implement `build_model()`\n\nUse `Sequential`’s methods(i.e. `add()`, `extend()`) to build your custom neural network. \n\n```python\ndef build_method(self) -\u003e None:\n    self.model.add(\n        Conv2D(3, 64, 3),\n    )\n    self.model.extend(\n        Conv2D(64, 64, 3),\n        BatchNorm2D(64),\n        Activation.ReLU(),\n    )\n    ...  # Additional Layers\n```\n\n### 7️⃣ Set optimizer, loss function, and LR scheduler\n\nAn optimizer and a loss function must be assigned to the model. Learning Rate(LR) scheduler is optional.\n\n```python\nmodel = MyModel(...)\n\n# Necessary\nmodel.set_optimizer(AdamOptimizer(...))\nmodel.set_loss(CrossEntropy())\n\n# Optional\nmodel.set_lr_scheduler(ReduceLROnPlateau(...))\n```\n\n### 8️⃣ Fit the model\n\nUse `NeuralModel`’s method `fit_nn()` to train the model with a train dataset.\n\n```python\nmodel.fit_nn(X_train, y_train)\n```\n\n### 9️⃣ Make predictions\n\nUse `NeuralModel`’s method `predict_nn()` to predict an unseen dataset.\n\n```python\ny_pred = model.predict_nn(X_test, argmax=True)\n```\n\n### See Also\n\nFor more detailed information, please refer to the source code of `NeuralModel`.\n\n## Recommendations\n\nSince Luma's neural package supports `MLX` acceleration, platforms with **Apple Silicon** are recommended.\n\nApple's Metal Performance Shader(MPS) will be automatically detected if available, and `MLX` acceleration will be applied.\n\nOtherwise, the default CPU operations are applied.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchanlumerico%2Fluma-neural","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchanlumerico%2Fluma-neural","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchanlumerico%2Fluma-neural/lists"}