I have trained model on customvision.ai after I have downloaded model. Now I want to draw region on images but when I draw rectangle boxes on images on particular location it show draw different location. But when I Quick test in customvision.ai it show exact location.
Image_info=[{'height': 0.12021917,
'left': 0.34261709,
'top': 0.42452715,
'width': 0.13535754},
{'height': 0.0932456,
'left': 0.28444971,
'top': 0.24215404,
'width': 0.09772345},
{'height': 0.10766733,
'left': 0.28987014,
'top': 0.68129019,
'width': 0.11658862}]
My code:
import cv2
img = tf.image.decode_image(open('path of image','rb').read(),channels=3)
img=img.numpy()
for i in range(len(boxes)):
wh = np.flip(img.shape[0:2])
x1y1 = tuple((np.array(boxes[i][0:2]) * wh).astype(np.int32))
x2y2 = tuple((np.array(boxes[i][2:4]) * wh).astype(np.int32))
img = cv2.rectangle(img, x1y1, x2y2, (255,255,0), 5)
plt.imshow(img, cmap='gray')
plt.show()
I have used all combination of height, left, top, right but nothing works. Please help me out!!!