Skip to content

Commit

Permalink
black
Browse files Browse the repository at this point in the history
  • Loading branch information
ziw-liu committed Feb 24, 2024
1 parent 4340cb8 commit 4fa3844
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
1 change: 1 addition & 0 deletions viscy/evaluation/evaluation_metrics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Metrics for model evaluation"""

from typing import Sequence, Union
from warnings import warn

Expand Down
26 changes: 13 additions & 13 deletions viscy/light/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,19 +268,19 @@ def _log_segmentation_metrics(
self.log_dict(
{
# semantic segmentation
"test_metrics/accuracy": accuracy(
pred_binary, target_binary, task="binary"
)
if compute
else -1,
"test_metrics/dice": dice(pred_binary, target_binary)
if compute
else -1,
"test_metrics/jaccard": jaccard_index(
pred_binary, target_binary, task="binary"
)
if compute
else -1,
"test_metrics/accuracy": (
accuracy(pred_binary, target_binary, task="binary")
if compute
else -1
),
"test_metrics/dice": (
dice(pred_binary, target_binary) if compute else -1
),
"test_metrics/jaccard": (
jaccard_index(pred_binary, target_binary, task="binary")
if compute
else -1
),
"test_metrics/mAP": coco_metrics["map"] if compute else -1,
"test_metrics/mAP_50": coco_metrics["map_50"] if compute else -1,
"test_metrics/mAP_75": coco_metrics["map_75"] if compute else -1,
Expand Down
1 change: 1 addition & 0 deletions viscy/preprocessing/generate_masks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Generate masks from sum of flurophore channels"""

import iohub.ngff as ngff

import viscy.utils.aux_utils as aux_utils
Expand Down
4 changes: 1 addition & 3 deletions viscy/utils/image_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ def im_bit_convert(im, bit=16, norm=False, limit=[]):
/ (limit[1] - limit[0] + sys.float_info.epsilon)
* (2**bit - 1)
)
im = np.clip(
im, 0, 2**bit - 1
) # clip the values to avoid wrap-around by np.astype
im = np.clip(im, 0, 2**bit - 1) # clip the values to avoid wrap-around by np.astype
if bit == 8:
im = im.astype(np.uint8, copy=False) # convert to 8 bit
else:
Expand Down
1 change: 1 addition & 0 deletions viscy/utils/normalize.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Image normalization related functions"""

import sys

import numpy as np
Expand Down

0 comments on commit 4fa3844

Please sign in to comment.