Created
July 29, 2020 05:26
-
-
Save Praveen76/d918368878842367bdf965fe021ff5ab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pick a random image | |
filepath = df.sample()['fileName'].values[0] | |
# get all rows for this image | |
df2 = df[df['fileName'] == filepath] | |
im = np.array(Image.open(filepath)) | |
# if there's a PNG it will have alpha channel | |
im = im[:,:,:3] | |
for idx, row in df2.iterrows(): | |
box = [ | |
row['xmin'], | |
row['ymin'], | |
row['xmax'], | |
row['ymax'], | |
] | |
print(box) | |
draw_box(im, box, color=(255, 0, 0)) | |
plt.axis('off') | |
plt.imshow(im) | |
plt.show() | |
show_image_with_boxes(data) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment