Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
qim3d
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
QIM
Tools
qim3d
Commits
ba974ff9
Commit
ba974ff9
authored
1 year ago
by
ofhkr
Browse files
Options
Downloads
Patches
Plain Diff
small changes to update UNet channels
parent
353731d4
No related branches found
No related tags found
1 merge request
!47
(Work in progress) Implementation of adaptive Dataset class which adapts to different data structures
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
qim3d/models/unet.py
+10
-4
10 additions, 4 deletions
qim3d/models/unet.py
qim3d/utils/models.py
+4
-2
4 additions, 2 deletions
qim3d/utils/models.py
with
14 additions
and
6 deletions
qim3d/models/unet.py
+
10
−
4
View file @
ba974ff9
...
@@ -35,7 +35,8 @@ class UNet(nn.Module):
...
@@ -35,7 +35,8 @@ class UNet(nn.Module):
up_kernel_size
=
3
,
up_kernel_size
=
3
,
activation
=
'
PReLU
'
,
activation
=
'
PReLU
'
,
bias
=
True
,
bias
=
True
,
adn_order
=
'
NDA
'
adn_order
=
'
NDA
'
,
img_channels
=
1
):
):
super
().
__init__
()
super
().
__init__
()
if
size
not
in
[
'
small
'
,
'
medium
'
,
'
large
'
]:
if
size
not
in
[
'
small
'
,
'
medium
'
,
'
large
'
]:
...
@@ -50,8 +51,9 @@ class UNet(nn.Module):
...
@@ -50,8 +51,9 @@ class UNet(nn.Module):
self
.
activation
=
activation
self
.
activation
=
activation
self
.
bias
=
bias
self
.
bias
=
bias
self
.
adn_order
=
adn_order
self
.
adn_order
=
adn_order
self
.
img_channels
=
img_channels
self
.
model
=
self
.
_model_choice
()
self
.
_model_choice
()
def
_model_choice
(
self
):
def
_model_choice
(
self
):
...
@@ -64,7 +66,7 @@ class UNet(nn.Module):
...
@@ -64,7 +66,7 @@ class UNet(nn.Module):
model
=
monai_UNet
(
model
=
monai_UNet
(
spatial_dims
=
2
,
spatial_dims
=
2
,
in_channels
=
1
,
#TODO: check if image has 1 or multiple input channels
in_channels
=
self
.
img_channels
,
#TODO: check if image has 1 or multiple input channels
out_channels
=
1
,
out_channels
=
1
,
channels
=
self
.
channels
,
channels
=
self
.
channels
,
strides
=
(
2
,)
*
(
len
(
self
.
channels
)
-
1
),
strides
=
(
2
,)
*
(
len
(
self
.
channels
)
-
1
),
...
@@ -75,8 +77,12 @@ class UNet(nn.Module):
...
@@ -75,8 +77,12 @@ class UNet(nn.Module):
bias
=
self
.
bias
,
bias
=
self
.
bias
,
adn_ordering
=
self
.
adn_order
adn_ordering
=
self
.
adn_order
)
)
return
model
self
.
model
=
model
def
update_params
(
self
):
self
.
_model_choice
()
def
forward
(
self
,
x
):
def
forward
(
self
,
x
):
x
=
self
.
model
(
x
)
x
=
self
.
model
(
x
)
...
...
This diff is collapsed.
Click to expand it.
qim3d/utils/models.py
+
4
−
2
View file @
ba974ff9
...
@@ -144,8 +144,10 @@ def model_summary(dataloader,model):
...
@@ -144,8 +144,10 @@ def model_summary(dataloader,model):
print(summary)
print(summary)
"""
"""
images
,
_
=
next
(
iter
(
dataloader
))
images
,
_
=
next
(
iter
(
dataloader
))
batch_size
=
tuple
(
images
.
shape
)
model_s
=
summary
(
model
,
model_s
=
summary
(
model
,
batch_size
,
depth
=
torch
.
inf
)
input_size
=
images
.
size
(),
depth
=
torch
.
inf
)
return
model_s
return
model_s
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment