import cv2
# COCO Class names
#For human pose task We just use "BG" and "person"
class_names = ['BG', 'person']
# Load a random image from the images folder
file_names = next(os.walk(IMAGE_DIR))[2]
# image = skimage.io.imread(os.path.join(IMAGE_DIR, random.choice(file_names)))
for root_now,dirs_now,files_1 in os.walk(IMAGE_DIR):
for file_now in files_1:
print(os.path.join(root_now,file_now)) #根目录与文件名组合,形成绝对路径。
image1 = cv2.imread(os.path.join(IMAGE_DIR, file_now))
image1 = image1[:,:,::-1]
results = model.detect_keypoint([image1], verbose=1)
r = results[0] # for one image
visualize.display_keypoints(image1,r['rois'],r['keypoints'],r['class_ids'],class_names,skeleton = inference_config.LIMBS)