Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions connectomics/data/utils/data_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def getSegType(mid):

def relabel(seg, do_type=False):
# get the unique labels
uid = np.unique(seg)
uid = np.unique(seg).astype(np.int64)
# ignore all-background samples
if len(uid) == 1 and uid[0] == 0:
return seg
Expand All @@ -41,7 +41,7 @@ def relabel(seg, do_type=False):
m_type = getSegType(mid)
mapping = np.zeros(mid, dtype=m_type)
mapping[uid] = np.arange(1, len(uid) + 1, dtype=m_type)
return mapping[seg]
return mapping[seg.astype(np.int64)]


def remove_small(seg, thres=100):
Expand Down Expand Up @@ -302,7 +302,7 @@ def seg_to_targets(label_orig: np.ndarray,
if len(topt) == 1:
topt = topt + '-2d-0' # 2d DT without padding (default)
_, mode, padding = topt.split('-')
out[tid] = edt_instance(label.copy(), mode, padding=bool(int(padding))
out[tid] = edt_instance(label.copy(), mode, padding=bool(int(padding)))
elif topt[0] == '6': # distance transform (semantic)
if len(topt) == 1:
topt = topt + '-2d-8-50'
Expand Down