sabrinabenas commited on
Commit
ffec0de
β€’
1 Parent(s): 8f6affd
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -70,6 +70,7 @@ def draw_keypoints_on_image(image,
70
  im_width, im_height = image.size
71
  keypoints_x = [k[0] for k in keypoints]
72
  keypoints_y = [k[1] for k in keypoints]
 
73
 
74
  # adjust keypoints coords if required
75
  if use_normalized_coordinates:
@@ -81,7 +82,8 @@ def draw_keypoints_on_image(image,
81
  draw.ellipse([(keypoint_x - marker_size, keypoint_y - marker_size),
82
  (keypoint_x + marker_size, keypoint_y + marker_size)],
83
  outline=keypt_color,
84
- fill=keypt_color)
 
85
 
86
  # add string labels around keypoints
87
  if flag_show_str_labels:
@@ -226,9 +228,7 @@ def predict_pipeline(img_input,
226
  kpts_likelihood_th,
227
  path_to_DLCmodel,
228
  dlc_proc)
229
- # draw kpts on input img
230
- print(list_kpts_per_crop)
231
- print(list_kpts_per_crop[0])
232
  draw_keypoints_on_image(img_input,
233
  list_kpts_per_crop[0], # a numpy array with shape [num_keypoints, 2].
234
  map_label_id_to_str,
@@ -272,8 +272,7 @@ def predict_pipeline(img_input,
272
  keypt_color=keypt_color,
273
  marker_size=marker_size)
274
 
275
- ## Paste crop in original image
276
- # https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.paste
277
  img_background.paste(img_crop,
278
  box = tuple([int(t) for t in md_results.xyxy[0][ic,:2]]))
279
 
 
70
  im_width, im_height = image.size
71
  keypoints_x = [k[0] for k in keypoints]
72
  keypoints_y = [k[1] for k in keypoints]
73
+ alpha = [k[2] for k in keypoints]
74
 
75
  # adjust keypoints coords if required
76
  if use_normalized_coordinates:
 
82
  draw.ellipse([(keypoint_x - marker_size, keypoint_y - marker_size),
83
  (keypoint_x + marker_size, keypoint_y + marker_size)],
84
  outline=keypt_color,
85
+ fill=keypt_color,
86
+ width=alpha[i])
87
 
88
  # add string labels around keypoints
89
  if flag_show_str_labels:
 
228
  kpts_likelihood_th,
229
  path_to_DLCmodel,
230
  dlc_proc)
231
+ # draw kpts on input img #fix!
 
 
232
  draw_keypoints_on_image(img_input,
233
  list_kpts_per_crop[0], # a numpy array with shape [num_keypoints, 2].
234
  map_label_id_to_str,
 
272
  keypt_color=keypt_color,
273
  marker_size=marker_size)
274
 
275
+ ## Paste crop in original image https://pillow.readthedocs.io/en/stable/reference/Image.html#PIL.Image.Image.paste
 
276
  img_background.paste(img_crop,
277
  box = tuple([int(t) for t in md_results.xyxy[0][ic,:2]]))
278