本文整理汇总了Python中Drawing.bounding_boxes方法的典型用法代码示例。如果您正苦于以下问题:Python Drawing.bounding_boxes方法的具体用法?Python Drawing.bounding_boxes怎么用?Python Drawing.bounding_boxes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drawing
的用法示例。
在下文中一共展示了Drawing.bounding_boxes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_images
# 需要导入模块: import Drawing [as 别名]
# 或者: from Drawing import bounding_boxes [as 别名]
def check_images(img, kp, name, all_ = True):
if not all_: draw.bounding_boxes(cv.imread(img), kp, '_'+name)
else:
for n_file in range(len(img)):
img_ = cv.imread(img[n_file])
kp_ = kp[n_file]
draw.bounding_boxes(img_, kp_, '_'+name)
示例2: range
# 需要导入模块: import Drawing [as 别名]
# 或者: from Drawing import bounding_boxes [as 别名]
kp_pred = []
kp_label = []
for count in range(pred.shape[0]):
kp_pred.append(get_kp(pred[count]))
kp_label.append(get_kp(label[count]))
input_ = net.blobs["data"].data.transpose((2, 3, 1, 0)).astype(np.uint8) # [:,:,:,0]#224 x 224 x 3 x batch
mean_value = [104, 116, 122] # Imagenet mean value
for count, mean in enumerate(mean_value):
input_[:, :, count, :] += mean
ch = raw_input("Do you want to watch prediction and label images? Type Y or N. ")
if ch == "Y":
for n in range(input_.shape[3]):
draw.bounding_boxes(
input_[:, :, :, n],
kp_label[n],
"_Label",
save=True,
name_save="images_result/label_" + str(n).zfill(3) + ".png",
)
draw.bounding_boxes(
input_[:, :, :, n],
kp_pred[n],
"_Prediction",
save=True,
name_save="images_result/pred_" + str(n).zfill(3) + ".png",
)
time.sleep(1)
示例3: get_kp
# 需要导入模块: import Drawing [as 别名]
# 或者: from Drawing import bounding_boxes [as 别名]
import Drawing as draw
vgg_size = cfg.vgg_size
def get_kp(label):
keypoint = []
if not len(label) == 48:
ValueError("Keypoints are not 48")
for kp in range(0, len(label), 2):
keypoint.append([label[kp], label[kp + 1]])
return keypoint
# For a txt file
f = open("model/Validation.txt").readlines()
imgs = [line.split(" ")[0] for line in f]
label = []
for line in range(len(f)):
label.append([float(num) * vgg_size / 2 + vgg_size / 2 for num in f[line][:-1].split(" ")[1:]])
if not len(label[-1]) == 48:
ValueError("Keypoints are not 48")
kp_label = []
for label_ in label:
kp_label.append(get_kp(label_))
n = 0
draw.bounding_boxes(cv.imread(imgs[n]), kp_label[n], 0, save=True, name_save="img_kp_" + str(n) + ".png")
# for n in np.random.permutation(len(imgs)):
# draw.bounding_boxes(cv.imread(imgs[n]), kp_label[n], 0)