Skip to content
Snippets Groups Projects
Commit ebaf5ac1 authored by Christopher Randolph Rhodes's avatar Christopher Randolph Rhodes
Browse files

Merged in RoiSet polygon logic so far from YOLO dev branch

parent 74f7c2aa
No related branches found
No related tags found
No related merge requests found
......@@ -288,7 +288,6 @@ def make_object_ids_from_df(df: pd.DataFrame, sd: dict) -> InMemoryDataAccessor:
class RoiSet(object):
# TODO: __init__ to take bounding boxes e.g. from obj det model; flag if overlaps are allowed
def __init__(
self,
acc_raw: GenericImageDataAccessor,
......@@ -302,15 +301,12 @@ class RoiSet(object):
:param df: dataframe containing at minimum bounding box and segmentation mask information
:param params: optional arguments that influence the definition and representation of ROIs
"""
# assert acc_obj_ids.chroma == 1
# self.acc_obj_ids = acc_obj_ids
self.acc_raw = acc_raw
self.accs_derived = []
self.params = params
self._df = df
self.count = len(self._df)
# self.object_class_maps = {} # classification results
def __iter__(self):
"""Expose ROI meta information via the Pandas.DataFrame API"""
......@@ -342,7 +338,6 @@ class RoiSet(object):
return RoiSet(acc_raw, df, params)
# TODO: add a generator for the object detection case
@staticmethod
def from_bounding_boxes(
acc_raw: GenericImageDataAccessor,
......@@ -857,7 +852,6 @@ class RoiSet(object):
def acc_obj_ids(self):
return make_object_ids_from_df(self._df, self.acc_raw.shape_dict)
# TODO: make this work with obj det dataset
@staticmethod
def deserialize(acc_raw: GenericImageDataAccessor, where: Path, prefix=''):
"""
......
......@@ -5,7 +5,7 @@ import numpy as np
from model_server.base.accessors import CziImageFileAccessor, generate_file_accessor, InMemoryDataAccessor, PatchStack, write_accessor_data_to_file
from model_server.extensions.ilastik import models as ilm
from model_server.extensions.ilastik.pipelines.px_then_ob import infer_px_then_ob_model
from model_server.base.roiset import _get_label_ids, RoiSet, RoiSetMetaParams
from model_server.base.roiset import get_label_ids, RoiSet, RoiSetMetaParams
from model_server.base.pipelines.segment import classify_pixels
import model_server.conf.testing as conf
......@@ -399,9 +399,9 @@ class TestIlastikObjectClassification(unittest.TestCase):
stack_ch_pa = stack.get_mono(conf.meta['roiset']['patches_channel'])
seg_mask = generate_file_accessor(data['multichannel_zstack_mask2d']['path'])
self.roiset = RoiSet(
self.roiset = RoiSet.from_binary_mask(
stack_ch_pa,
_get_label_ids(seg_mask),
seg_mask,
params=RoiSetMetaParams(
mask_type='boxes',
filters={'area': {'min': 1e3, 'max': 1e4}},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment