How to get bounding box of multiple objects in a rendered image with Python?
A solution that worked for me was to use an File Output node instead of viewer node and save the image in openEXR format with full float color depth using this node setup



And then read that image via CV2 library instead of reading it from viewer node image.

Simply replace the following line in the code snippet in question 

pixels = np.array( bpy.data.images['Viewer Node'].pixels[:] ).reshape( [height, width, depth] )


with

pixels = cv2.imread(r"filepathOf.exr",  cv2.IMREAD_ANYCOLOR | cv2.IMREAD_ANYDEPTH)
pixels = cv2.flip(pixels,0)


and it should work fine giving you coordinates of the bounding boxes