Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SVLT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
ALMF
SVLT
Commits
a851ef4a
Commit
a851ef4a
authored
5 months ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
PatchStack no longer loses slice information when doing channel separation
parent
b5d80b38
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
model_server/base/accessors.py
+4
-0
4 additions, 0 deletions
model_server/base/accessors.py
tests/base/test_accessors.py
+6
-1
6 additions, 1 deletion
tests/base/test_accessors.py
with
10 additions
and
1 deletion
model_server/base/accessors.py
+
4
−
0
View file @
a851ef4a
...
...
@@ -486,6 +486,10 @@ class PatchStack(InMemoryDataAccessor):
def
shape_dict
(
self
):
return
dict
(
zip
((
'
P
'
,
'
Y
'
,
'
X
'
,
'
C
'
,
'
Z
'
),
self
.
data
.
shape
))
def
get_channels
(
self
,
channels
:
list
,
mip
:
bool
=
False
):
nda
=
super
().
get_channels
(
channels
,
mip
).
data
return
self
.
_derived_accessor
([
nda
[
i
][
self
.
_slices
[
i
]]
for
i
in
range
(
0
,
self
.
count
)])
def
get_list
(
self
,
crop
=
True
):
if
crop
:
return
[
self
.
_data
[
i
][
self
.
_slices
[
i
]]
for
i
in
range
(
0
,
self
.
count
)]
...
...
This diff is collapsed.
Click to expand it.
tests/base/test_accessors.py
+
6
−
1
View file @
a851ef4a
...
...
@@ -272,7 +272,7 @@ class TestPatchStackAccessor(unittest.TestCase):
def
test_make_3d_patch_stack_from_nonuniform_list
(
self
):
w
=
256
h
=
512
c
=
1
c
=
3
nz
=
5
n
=
4
...
...
@@ -296,6 +296,11 @@ class TestPatchStackAccessor(unittest.TestCase):
ps_list_uncropped
=
acc
.
get_list
(
crop
=
False
)
self
.
assertTrue
(
all
([
p
.
shape
==
acc
.
shape
[
1
:]
for
p
in
ps_list_uncropped
]))
# test that this persists after channel selection
for
i
in
range
(
0
,
acc
.
count
):
self
.
assertEqual
(
patches
[
i
].
shape
[
0
:
2
],
acc
.
get_channels
([
0
]).
iat
(
i
,
crop
=
True
).
shape
[
0
:
2
])
self
.
assertEqual
(
patches
[
i
].
shape
[
3
],
acc
.
get_channels
([
0
]).
iat
(
i
,
crop
=
True
).
shape
[
3
])
def
test_make_3d_patch_stack_from_list_force_long_dim
(
self
):
def
_r
(
h
,
w
):
return
np
.
random
.
randint
(
0
,
2
**
8
,
size
=
(
h
,
w
,
1
,
1
),
dtype
=
'
uint8
'
)
...
...
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