Skip to content

Commit

Permalink
InceptionV4S
Browse files Browse the repository at this point in the history
  • Loading branch information
ChanLumerico committed Jul 16, 2024
1 parent 578f20b commit cdcee2d
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 2 deletions.
3 changes: 2 additions & 1 deletion luma/__import__.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
InceptionBlockV2B,
InceptionBlockV2C,
InceptionBlockV2R,
InceptionBlockV4S,
)
from luma.neural.network import SimpleMLP, SimpleCNN
from luma.neural.network import (
Expand Down Expand Up @@ -302,7 +303,7 @@

ConvBlock1D, ConvBlock2D, ConvBlock3D, DenseBlock,
InceptionBlock, InceptionBlockV2A, InceptionBlockV2B,
InceptionBlockV2C, InceptionBlockV2R
InceptionBlockV2C, InceptionBlockV2R, InceptionBlockV4S

CrossEntropy, BinaryCrossEntropy, MSELoss

Expand Down
49 changes: 48 additions & 1 deletion luma/neural/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -1631,6 +1631,52 @@ def out_shape(self, in_shape: Tuple[int]) -> Tuple[int]:


class InceptionBlockV4S(Sequential):
"""
Inception block used in Inception V4 network stem part.
This block has fixed channels of inputs and outputs.
Structure
---------
Convolution2D(3, 32, stride=2) ->
Convolution2D(32, 32) ->
Convolution2D(32, 64) ->
|-> Pooling2D(filter_size=3, mode="max")
|-> Convolution2D(64, 96, stride=2)
Filter Concat ->
|-> Convolution2D(160, 64) -> Convolution2D(64, 96)
|-> Convolution2D(160, 64) -> Convolution2D(64, 64) ->
Convolution2D(64, 64) -> Convolution2D(64, 96)
Filter Concat ->
|-> Convolution2D(192, 192)
|-> Pooling2D(stride=2, mode="max")
Filter Concat
Parameters
----------
`activation` : FuncType, default=Activation.ReLU
Type of activation function
`optimizer` : Optimizer, optional, default=None
Type of optimizer for weight update
`initializer` : InitStr, default=None
Type of weight initializer
`lambda_` : float, default=0.0
L2 regularization strength
`do_batch_norm` : bool, default=False
Whether to perform batch normalization
`momentum` : float, default=0.9
Momentum for batch normalization
Notes
-----
- The input `X` must have the form of a 4D-array (`Tensor`).
```py
X.shape = (batch_size, height, width, channels)
```
"""

def __init__(
self,
activation: Activation.FuncType = Activation.ReLU,
Expand Down Expand Up @@ -1770,4 +1816,5 @@ def backward(self, d_out: Tensor) -> Tensor:

@override
def out_shape(self, in_shape: Tuple[int]) -> Tuple[int]:
... # TODO: Begin from here
batch_size, _, _, _ = in_shape
return batch_size, 384, 35, 35

0 comments on commit cdcee2d

Please sign in to comment.