无法在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 (将#修改为@)