0

I am trying to use human pose estimation through keras implementation. I am using this source https://github.com/michalfaber/keras_Realtime_Multi-Person_Pose_Estimation. My problem is how can I generate the skeleton view of the following image, the one on the left part? However, I can generate the one on the right part.

enter image description here ** Source Photograph taken from Pexels

Below is the code I am using to achieve this.

    # vgg normalization (subtracting mean) on input images
    model = get_testing_model()
    model.load_weights(keras_weights_file)

    # load config
    params, model_params = config_reader()

    input_image = cv2.imread(image_path)  # B,G,R order

    body_parts, all_peaks, subset, candidate = extract_parts(input_image, params, model, model_params)
    canvas = draw(input_image, all_peaks, subset, candidate)

    toc = time.time()
    print('processing time is %.5f' % (toc - tic))

    cv2.imwrite(output, canvas)

    cv2.destroyAllWindows()
Alex W
  • 37,233
  • 13
  • 109
  • 109
ashish14
  • 650
  • 1
  • 8
  • 20
  • 1
    Don't draw the input image on the canvas, you need an empty black image and then draw just the skeleton portion. – Alex W May 28 '20 at 14:57

1 Answers1

1

You need to draw over black image not input image for your requirement. Here below in the updated code.

# vgg normalization (subtracting mean) on input images
model = get_testing_model()
model.load_weights(keras_weights_file)

# load config
params, model_params = config_reader()

input_image = cv2.imread(image_path)  # B,G,R order

body_parts, all_peaks, subset, candidate = extract_parts(input_image, params, model, model_params)
black_img = np.zeros_like(input_image, np.uint8)
canvas = draw(black_img, all_peaks, subset, candidate)

toc = time.time()
print('processing time is %.5f' % (toc - tic))

cv2.imwrite(output, canvas)

cv2.destroyAllWindows()
Alok Nayak
  • 2,381
  • 22
  • 28