Skip to content

Commit

Permalink
fixing bugs for demo
Browse files Browse the repository at this point in the history
  • Loading branch information
andres committed Jul 27, 2023
1 parent 4962ef6 commit fba3eb7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion demo/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def get_parser():
if len(args.input) == 1:
for k in visualized_output.keys():
os.makedirs(k, exist_ok=True)
out_filename = os.path.join(k, args.output)
out_filename = os.path.join(args.output, k)
visualized_output[k].save(out_filename)
else:
for k in visualized_output.keys():
Expand Down
6 changes: 3 additions & 3 deletions demo/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,22 +224,22 @@ def non_empty_mask(self):
assert (
len(empty_ids) == 1
), ">1 ids corresponds to no labels. This is currently not supported"
return (self._seg != empty_ids[0]).numpy().astype(np.bool)
return (self._seg != empty_ids[0]).numpy().astype(bool)

def semantic_masks(self):
for sid in self._seg_ids:
sinfo = self._sinfo.get(sid)
if sinfo is None or sinfo["isthing"]:
# Some pixels (e.g. id 0 in PanopticFPN) have no instance or semantic predictions.
continue
yield (self._seg == sid).numpy().astype(np.bool), sinfo
yield (self._seg == sid).numpy().astype(bool), sinfo

def instance_masks(self):
for sid in self._seg_ids:
sinfo = self._sinfo.get(sid)
if sinfo is None or not sinfo["isthing"]:
continue
mask = (self._seg == sid).numpy().astype(np.bool)
mask = (self._seg == sid).numpy().astype(bool)
if mask.sum() > 0:
yield mask, sinfo

Expand Down

0 comments on commit fba3eb7

Please sign in to comment.