Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
model_server
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
Christopher Randolph Rhodes
model_server
Commits
6a1d1e40
Commit
6a1d1e40
authored
9 months ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Trying to complete meaningful test with both raw and derived channels
parent
655fbb62
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!50
Release 2024.06.03
,
!48
Issue0032
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_roiset.py
+14
-16
14 additions, 16 deletions
tests/test_roiset.py
with
14 additions
and
16 deletions
tests/test_roiset.py
+
14
−
16
View file @
6a1d1e40
...
@@ -74,18 +74,8 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
...
@@ -74,18 +74,8 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
self
.
assertTrue
(
zmask_acc
.
is_mask
())
self
.
assertTrue
(
zmask_acc
.
is_mask
())
def
test_create_roiset_with_no_objects
(
self
):
def
test_create_roiset_with_no_objects
(
self
):
zero_obmap
=
InMemoryDataAccessor
(
np
.
zeros
(
self
.
seg_mask
.
shape
,
self
.
seg_mask
.
dtype
))
obmap
=
InMemoryDataAccessor
(
np
.
zeros
(
self
.
seg_mask
.
shape
,
self
.
seg_mask
.
dtype
))
roiset
=
RoiSet
(
self
.
stack_ch_pa
,
zero_obmap
)
roiset
=
RoiSet
(
self
.
stack_ch_pa
,
obmap
,
params
=
RoiSetMetaParams
(
mask_type
=
'
boxes
'
,
filters
=
{
'
area
'
:
{
'
min
'
:
1e3
,
'
max
'
:
1e4
}},
expand_box_by
=
(
128
,
2
)
)
)
self
.
assertEqual
(
roiset
.
count
,
0
)
self
.
assertEqual
(
roiset
.
count
,
0
)
def
test_slices_are_valid
(
self
):
def
test_slices_are_valid
(
self
):
...
@@ -212,7 +202,7 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
...
@@ -212,7 +202,7 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
return
roiset
return
roiset
def
test_classify_by_multiple_channels
(
self
):
def
test_classify_by_multiple_channels
(
self
):
roiset
=
self
.
_make_roi_set
(
)
roiset
=
RoiSet
.
from_segmentation
(
self
.
stack
,
self
.
seg_mask
)
roiset
.
classify_by
(
'
dummy_class
'
,
[
0
,
1
],
DummyInstanceSegmentationModel
())
roiset
.
classify_by
(
'
dummy_class
'
,
[
0
,
1
],
DummyInstanceSegmentationModel
())
self
.
assertTrue
(
all
(
roiset
.
get_df
()[
'
classify_by_dummy_class
'
].
unique
()
==
[
1
]))
self
.
assertTrue
(
all
(
roiset
.
get_df
()[
'
classify_by_dummy_class
'
].
unique
()
==
[
1
]))
self
.
assertTrue
(
all
(
np
.
unique
(
roiset
.
object_class_maps
[
'
dummy_class
'
].
data
)
==
[
0
,
1
]))
self
.
assertTrue
(
all
(
np
.
unique
(
roiset
.
object_class_maps
[
'
dummy_class
'
].
data
)
==
[
0
,
1
]))
...
@@ -223,14 +213,22 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
...
@@ -223,14 +213,22 @@ class TestRoiSetMonoProducts(BaseTestRoiSetMonoProducts, unittest.TestCase):
def
infer
(
self
,
img
,
mask
):
def
infer
(
self
,
img
,
mask
):
return
PatchStack
(
super
().
infer
(
img
,
mask
).
data
*
img
.
chroma
)
return
PatchStack
(
super
().
infer
(
img
,
mask
).
data
*
img
.
chroma
)
roiset
=
self
.
_make_roi_set
()
roiset
=
RoiSet
.
from_segmentation
(
self
.
stack
,
self
.
seg_mask
,
params
=
RoiSetMetaParams
(
# mask_type=mask_type,
filters
=
{
'
area
'
:
{
'
min
'
:
1e3
,
'
max
'
:
1e4
}},
# expand_box_by=(128, 2)
)
)
roiset
.
classify_by
(
roiset
.
classify_by
(
'
multiple_input_model
'
,
'
multiple_input_model
'
,
[
0
,
1
],
[
0
,
1
],
ModelWithDerivedInputs
(),
ModelWithDerivedInputs
(),
derived_channel_functions
=
[
derived_channel_functions
=
[
lambda
acc
:
PatchStack
(
2
*
acc
.
data
),
lambda
acc
:
PatchStack
(
2
*
acc
.
get_channels
([
0
]).
data
),
lambda
acc
:
PatchStack
((
0.5
*
acc
.
data
).
astype
(
'
uint8
'
))
lambda
acc
:
PatchStack
((
0.5
*
acc
.
get_channels
([
1
]).
data
).
astype
(
'
uint8
'
))
]
]
)
)
self
.
assertTrue
(
all
(
roiset
.
get_df
()[
'
classify_by_multiple_input_model
'
].
unique
()
==
[
3
]))
self
.
assertTrue
(
all
(
roiset
.
get_df
()[
'
classify_by_multiple_input_model
'
].
unique
()
==
[
3
]))
...
...
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