Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MLAir
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
machine-learning
MLAir
Merge requests
!499
Resolve "release v2.3.0"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "release v2.3.0"
release_v2.3.0
into
master
Overview
0
Commits
70
Pipelines
5
Changes
2
Merged
Ghost User
requested to merge
release_v2.3.0
into
master
2 years ago
Overview
0
Commits
70
Pipelines
5
Changes
2
Expand
Closes
#440 (closed)
0
0
Merge request reports
Viewing commit
67fed817
Prev
Next
Show latest version
2 files
+
39
−
6
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
67fed817
moved branched ResNet and created single branch ResNet class (refac)
· 67fed817
leufen1
authored
2 years ago
mlair/model_modules/branched_input_networks.py
+
34
−
0
Options
@@ -10,6 +10,7 @@ from mlair.helpers import select_from_dict, to_list
from
mlair.model_modules.loss
import
var_loss
from
mlair.model_modules.recurrent_networks
import
RNN
from
mlair.model_modules.convolutional_networks
import
CNNfromConfig
from
mlair.model_modules.residual_networks
import
ResNet
from
mlair.model_modules.u_networks
import
UNet
@@ -522,3 +523,36 @@ class BranchedInputUNet(UNet, BranchedInputCNN): # pragma: no cover
print
(
self
.
model
.
summary
())
class
BranchedInputResNet
(
ResNet
,
BranchedInputCNN
):
# pragma: no cover
"""
A convolutional neural network with multiple input branches and residual blocks (skip connections).
```python
input_shape = [(65,1,9), (65,1,9)]
output_shape = [(4, )]
# model
layer_configuration=[
{
"
type
"
:
"
Conv2D
"
,
"
activation
"
:
"
relu
"
,
"
kernel_size
"
: (7, 1),
"
filters
"
: 32,
"
padding
"
:
"
same
"
},
{
"
type
"
:
"
MaxPooling2D
"
,
"
pool_size
"
: (2, 1),
"
strides
"
: (2, 1)},
{
"
type
"
:
"
residual_block
"
,
"
activation
"
:
"
relu
"
,
"
kernel_size
"
: (3, 1),
"
filters
"
: 32,
"
strides
"
: (1, 1),
"
kernel_regularizer
"
:
"
l2
"
},
{
"
type
"
:
"
residual_block
"
,
"
activation
"
:
"
relu
"
,
"
kernel_size
"
: (3, 1),
"
filters
"
: 32,
"
strides
"
: (1, 1),
"
kernel_regularizer
"
:
"
l2
"
},
{
"
type
"
:
"
residual_block
"
,
"
activation
"
:
"
relu
"
,
"
kernel_size
"
: (3, 1),
"
filters
"
: 64,
"
strides
"
: (1, 1),
"
kernel_regularizer
"
:
"
l2
"
,
"
use_1x1conv
"
: True},
{
"
type
"
:
"
residual_block
"
,
"
activation
"
:
"
relu
"
,
"
kernel_size
"
: (3, 1),
"
filters
"
: 64,
"
strides
"
: (1, 1),
"
kernel_regularizer
"
:
"
l2
"
},
{
"
type
"
:
"
residual_block
"
,
"
activation
"
:
"
relu
"
,
"
kernel_size
"
: (3, 1),
"
filters
"
: 128,
"
strides
"
: (1, 1),
"
kernel_regularizer
"
:
"
l2
"
,
"
use_1x1conv
"
: True},
{
"
type
"
:
"
residual_block
"
,
"
activation
"
:
"
relu
"
,
"
kernel_size
"
: (3, 1),
"
filters
"
: 128,
"
strides
"
: (1, 1),
"
kernel_regularizer
"
:
"
l2
"
},
{
"
type
"
:
"
MaxPooling2D
"
,
"
pool_size
"
: (2, 1),
"
strides
"
: (2, 1)},
{
"
type
"
:
"
Dropout
"
,
"
rate
"
: 0.25},
{
"
type
"
:
"
Flatten
"
},
{
"
type
"
:
"
Concatenate
"
},
{
"
type
"
:
"
Dense
"
,
"
units
"
: 128,
"
activation
"
:
"
relu
"
}
]
model = BranchedInputResNet(input_shape, output_shape, layer_configuration)
```
"""
def
__init__
(
self
,
input_shape
:
list
,
output_shape
:
list
,
layer_configuration
:
list
,
optimizer
=
"
adam
"
,
**
kwargs
):
super
().
__init__
(
input_shape
,
output_shape
,
layer_configuration
,
optimizer
=
optimizer
,
**
kwargs
)
Loading