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
73251c71
Commit
73251c71
authored
5 months ago
by
Christopher Randolph Rhodes
Browse files
Options
Downloads
Patches
Plain Diff
Can load and use simple binary threshold classifier instead of ilastik pixel classifier
parent
6ad5df42
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_ilastik/test_roiset_workflow.py
+43
-24
43 additions, 24 deletions
tests/test_ilastik/test_roiset_workflow.py
with
43 additions
and
24 deletions
tests/test_ilastik/test_roiset_workflow.py
+
43
−
24
View file @
73251c71
...
...
@@ -64,27 +64,40 @@ class BaseTestRoiSetMonoProducts(object):
'
deproject_channel
'
:
0
,
}
def
_get_models
(
self
):
# tests can either use model objects directly, or load in API via project file string
fp_px
=
classifiers
[
'
px
'
][
'
path
'
].
__str__
()
fp_ob
=
classifiers
[
'
seg_to_obj
'
][
'
path
'
].
__str__
()
# def _get_models(self): # tests can either use model objects directly, or load in API via project file string
# fp_px = classifiers['px']['path'].__str__()
# fp_ob = classifiers['seg_to_obj']['path'].__str__()
# return {
# 'pixel_classifier_segmentation': {
# 'name': 'ilastik_px_mod',
# 'project_file': fp_px,
# 'model': ilm.IlastikPixelClassifierModel(
# {
# 'project_file': fp_px,
# 'px_class': 0,
# 'px_prob_threshold': 0.5,
# },
# ),
# },
# 'object_classifier': {
# 'name': 'ilastik_ob_mod',
# 'project_file': fp_ob,
# 'model': ilm.IlastikObjectClassifierFromSegmentationModel(
# {'project_file': fp_ob},
# )
# },
# }
def
_get_models
(
self
):
from
model_server.base.models
import
BinaryThresholdSegmentationModel
,
PermissiveInstanceSegmentationModel
return
{
'
pixel_classifier_segmentation
'
:
{
'
name
'
:
'
ilastik_px_mod
'
,
'
project_file
'
:
fp_px
,
'
model
'
:
ilm
.
IlastikPixelClassifierModel
(
{
'
project_file
'
:
fp_px
,
'
px_class
'
:
0
,
'
px_prob_threshold
'
:
0.5
,
},
),
'
name
'
:
'
min_px_mod
'
,
'
model
'
:
BinaryThresholdSegmentationModel
({
'
tr
'
:
1e4
}),
},
'
object_classifier
'
:
{
'
name
'
:
'
ilastik_ob_mod
'
,
'
project_file
'
:
fp_ob
,
'
model
'
:
ilm
.
IlastikObjectClassifierFromSegmentationModel
(
{
'
project_file
'
:
fp_ob
},
)
'
name
'
:
'
min_ob_mod
'
,
'
model
'
:
PermissiveInstanceSegmentationModel
()
},
}
...
...
@@ -115,17 +128,18 @@ class TestRoiSetWorkflow(BaseTestRoiSetMonoProducts, unittest.TestCase):
{
f
'
{
k
}
_
'
:
v
[
'
model
'
]
for
k
,
v
in
self
.
_get_models
().
items
()},
**
params
.
dict
()
)
self
.
assertEqual
(
trace
.
pop
(
'
annotated_patches_2d
'
).
count
,
13
)
self
.
assertEqual
(
trace
.
pop
(
'
patches_2d
'
).
count
,
13
)
self
.
assertEqual
(
trace
.
pop
(
'
annotated_patches_2d
'
).
count
,
26
)
self
.
assertEqual
(
trace
.
pop
(
'
patches_2d
'
).
count
,
26
)
trace
.
write_interm
(
Path
(
output_path
)
/
'
trace
'
,
'
roiset_worfklow_trace
'
,
skip_first
=
False
,
skip_last
=
False
)
self
.
assertTrue
(
'
ob_id
'
in
trace
.
keys
())
self
.
assertEqual
(
len
(
trace
[
'
labeled
'
].
unique
()[
0
]),
1
4
)
self
.
assertEqual
(
rois
.
count
,
13
)
self
.
assertEqual
(
len
(
trace
[
'
labeled
'
].
unique
()[
0
]),
5
1
)
self
.
assertEqual
(
rois
.
count
,
26
)
self
.
assertEqual
(
len
(
trace
[
'
ob_id
'
].
unique
()[
0
]),
2
)
class
TestRoiSetWorkflowOverApi
(
conf
.
TestServerBaseClass
,
BaseTestRoiSetMonoProducts
):
# TODO: rename app
app_name
=
'
tests.test_ilastik.test_roiset_workflow:app
'
input_data
=
data
[
'
multichannel_zstack_raw
'
]
...
...
@@ -143,11 +157,16 @@ class TestRoiSetWorkflowOverApi(conf.TestServerBaseClass, BaseTestRoiSetMonoProd
return
self
.
assertPutSuccess
(
f
'
accessors/read_from_file/
{
fname
}
'
)
def
test_load_pixel_classifier
(
self
):
# mid = self.assertPutSuccess(
# 'ilastik/seg/load/',
# body={'project_file': self._get_models()['pixel_classifier_segmentation']['project_file']},
# )['model_id']
mid
=
self
.
assertPutSuccess
(
'
ilastik/seg
/load/
'
,
body
=
{
'
project_file
'
:
self
.
_get_models
()[
'
pixel_classifier_segmentation
'
][
'
project_file
'
]
},
'
models/seg/binary_threshold
/load/
'
,
body
=
{
'
tr
'
:
1e4
},
)[
'
model_id
'
]
self
.
assertTrue
(
mid
.
startswith
(
'
IlastikPixelClassifierModel
'
))
# self.assertTrue(mid.startswith('IlastikPixelClassifierModel'))
self
.
assertTrue
(
mid
.
startswith
(
'
BinaryThresholdSegmentationModel
'
))
return
mid
def
test_load_object_classifier
(
self
):
...
...
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