微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法在python

如何解决无法在python

我正在尝试调整MS COCO数据集的边界框的大小。 我已经举了一个例子

bounding_Boxes = train_label[:,:4]
class_ids = train_label[:,4:5]
print('Image size (height,width,RGB):',train_image.shape)
print('Num of objects:',bounding_Boxes.shape[0])
print('Bounding Boxes (num_Boxes,x_min,y_min,x_max,y_max):\n',bounding_Boxes)
print('Class IDs (num_Boxes,):\n',class_ids)

utils.viz.plot_bBox(train_image.asnumpy(),bounding_Boxes,scores=None,labels=class_ids,class_names=train_dataset.classes) #plotting normal image

utils.viz.plot_bBox(cv2.resize(train_image.asnumpy(),(416,416),interpolation=cv2.INTER_LINEAR),new_bb,class_names=train_dataset.classes)#plotting resized image

我得到以下输出

Image size (height,RGB): (640,426,3)
Num of objects: 5
Bounding Boxes (num_Boxes,y_max):
 [[ 54.27 359.7  367.46 445.16]
 [192.14 359.96 390.3  404.92]
 [252.29 354.08 408.37 382.69]
 [263.29 357.89 348.06 373.17]
 [272.71 355.56 296.41 365.58]]
Class IDs (num_Boxes,):
 [[8.]
 [8.]
 [8.]
 [8.]
 [8.]]
[[ 35.2755     351.25633803 238.849      434.71023474]
 [124.891      351.51023474 253.695      395.41483568]
 [163.9885     345.76826291 265.4405     373.70666667]
 [171.1385     349.48882629 226.239      364.41014085]
 [177.2615     347.21352113 192.6665     356.99830986]]

正常图像 enter image description here

将盒子变形的图像 enter image description here

对于某些图像,它的转换效果非常好。为什么在某些图像上会发生这种情况?该如何解决

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。