Skip to content

Commit

Permalink
refactor deepcell transform to pixelwise (#56)
Browse files Browse the repository at this point in the history
* refactor deepcell transform to pixelwise

* leave 'deepcell' as a lookup for postprocessing functions for backwards compat
  • Loading branch information
willgraf authored Aug 23, 2019
1 parent 239094e commit 791293e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions redis_consumer/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def mibi(prediction, edge_threshold=.25, interior_threshold=.25):
boundary is reached.
Args:
prediction: output from a deepcell transform (edge, interior, bg)
prediction: output from a pixelwise transform (edge, interior, bg)
edge_threshold: confidence threshold to determine edge pixels
interior_threshold: confidence threshold to determine interior pixels
Expand Down Expand Up @@ -158,12 +158,12 @@ def watershed(image, min_distance=10, threshold_abs=0.05):
return results


def deepcell(prediction, threshold=.8):
"""Post-processing for deepcell transform predictions.
def pixelwise(prediction, threshold=.8):
"""Post-processing for pixelwise transform predictions.
Uses the interior predictions to uniquely label every instance.
Args:
prediction: deepcell transform prediction
prediction: pixelwise transform prediction
threshold: confidence threshold for interior predictions
Returns:
Expand Down
6 changes: 3 additions & 3 deletions redis_consumer/processing_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ def test_mibi():
np.testing.assert_equal(mibi_img.shape, (300, 300, 1))


def test_deepcell():
def test_pixelwise():
channels = 4
img = np.random.rand(300, 300, channels)
deepcell_img = processing.deepcell(img)
np.testing.assert_equal(deepcell_img.shape, (300, 300, 1))
pixelwise_img = processing.pixelwise(img)
np.testing.assert_equal(pixelwise_img.shape, (300, 300, 1))


def test_watershed():
Expand Down
3 changes: 2 additions & 1 deletion redis_consumer/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ def _strip(x):
'normalize': processing.noramlize,
},
'post': {
'deepcell': processing.deepcell,
'deepcell': processing.pixelwise, # TODO: this is deprecated.
'pixelwise': processing.pixelwise,
'mibi': processing.mibi,
'watershed': processing.watershed,
'retinanet': processing.retinanet_to_label_image,
Expand Down

0 comments on commit 791293e

Please sign in to comment.