-
-
Save akTwelve/dc79fc8b9ae66828e7c7f648049bc42d to your computer and use it in GitHub Desktop.
@madhavajay, I updated the gist with your suggested fix. Thanks again for the fix!
Hi @akTwelve, upon visualizing my own custom dataset I noticed that the masks of some instances did not get displayed while those of some did. This was due to segmentation_points
being a numpy
array, so sometimes the array when stringified looked like this '241, 5, 242, ..., 244, 5, 245]'
. It can be avoided by adding:
segmentation_points = list (segmentation_points)
after the following line of the function display_image
in the notebook.
segmentation_points = np.multiply(segmentation_points, adjusted_ratio).astype(int)
.
Thanks for sharing!
I quickly added the option to visualize keypoints
. I simply added the parameter in the display_image
function:
def display_image(self, image_id, show_polys=True, show_bbox=True, show_crowds=True, show_keypoints=True, use_url=False):
and in the function body below the if show_bbox
block I added:
if show_keypoints:
for i, segm in enumerate(self.segmentations[image_id]):
keypoints = segm.get('keypoints', None)
if not keypoints is None:
for k in range(0, segm.get('num_keypoints', 0)):
x = keypoints[k * 3 + 0]
y = keypoints[k * 3 + 1]
visibility = keypoints[k * 3 + 2]
html += '<circle cx="{}" cy="{}" r="3" fill="{}" />'.format(x, y, "red")
this will draw all keypoints using red svg circles, regardless of their visibility.
Thank you for sharing!
For photos with non-landscape orientation I had to add this to your code: https://stackoverflow.com/a/63798032/1616037
Thanks for sharing this fix! I’ll take a look when I get a chance.