Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions evalbody_singleposemodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ def getBoundingBox(keypointPositions, offset=(10, 10, 10, 10)):

# Segmentation MASk
segmentation_threshold = 0.7
segments = tf.image.resize(segments,(targetWidth, targetHeight))
segmentScores = tf.sigmoid(segments)
mask = tf.math.greater(segmentScores, tf.constant(segmentation_threshold))
print('maskshape', mask.shape)
segmentationMask = tf.dtypes.cast(mask, tf.int32)
segmentationMask = np.reshape(
segmentationMask, (segmentationMask.shape[0], segmentationMask.shape[1]))
segmentationMask = np.squeeze(segmentationMask)
print('maskValue', segmentationMask[:][:])

plt.clf()
Expand All @@ -186,11 +186,8 @@ def getBoundingBox(keypointPositions, offset=(10, 10, 10, 10)):

# Draw Segmented Output
mask_img = Image.fromarray(segmentationMask * 255)
mask_img = mask_img.resize(
(targetWidth, targetHeight), Image.LANCZOS).convert("RGB")
mask_img = tf.keras.preprocessing.image.img_to_array(
mask_img, dtype=np.uint8)

segmentationMask_inv = np.bitwise_not(mask_img)
fg = np.bitwise_and(np.array(img), np.array(
mask_img))
Expand Down