Replace type(1) == int
with isinstance(1, int)
(#4217)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
committed by
GitHub
parent
ff5fa57415
commit
7dcdca3bf4
@ -158,7 +158,7 @@ class FastSAMPrompt:
|
||||
contour_all = []
|
||||
temp = np.zeros((original_h, original_w, 1))
|
||||
for i, mask in enumerate(annotations):
|
||||
if type(mask) == dict:
|
||||
if isinstance(mask, dict):
|
||||
mask = mask['segmentation']
|
||||
annotation = mask.astype(np.uint8)
|
||||
if not retina:
|
||||
@ -383,7 +383,7 @@ class FastSAMPrompt:
|
||||
points = [[int(point[0] * w / target_width), int(point[1] * h / target_height)] for point in points]
|
||||
onemask = np.zeros((h, w))
|
||||
for i, annotation in enumerate(masks):
|
||||
mask = annotation['segmentation'] if type(annotation) == dict else annotation
|
||||
mask = annotation['segmentation'] if isinstance(annotation, dict) else annotation
|
||||
for i, point in enumerate(points):
|
||||
if mask[point[1], point[0]] == 1 and pointlabel[i] == 1:
|
||||
onemask += mask
|
||||
|
Reference in New Issue
Block a user