【问题标题】:BodyPix: Real-time Person SegmentationBodyPix:实时人物分割
【发布时间】:2019-11-13 16:21:54
【问题描述】:

BodyPix 是一个开源机器学习模型,它允许在浏览器中使用 TensorFlow.js 进行人物和身体部位的分割。 我想将模型转换为 .pb 冻结图,以便在 Python 上使用它。

我该怎么做?

我尝试在不同的places 上找到解决方案,但不起作用。

【问题讨论】:

  • bodyPix的保存模型格式来了,敬请期待。

标签: tensorflow image-segmentation tensorflow.js bodypix


【解决方案1】:

【讨论】:

【解决方案2】:

在 Python 中使用 bodypix 进行分割。但只有当人在墙前而不是其他物体时才能获得更好的效果。

from tf_bodypix.api import download_model, load_model, BodyPixModelPaths
import cv2
bodypix_model = load_model(download_model(BodyPixModelPaths.MOBILENET_FLOAT_50_STRIDE_16))

cap = cv2.VideoCapture(0) 
while cap.isOpened(): 
    ret, frame = cap.read()
    # BodyPix Segmentation
    result = bodypix_model.predict_single(frame)
    mask = result.get_mask(threshold=0.5).numpy().astype(np.uint8)
    seg = result.get_colored_part_mask(mask)

    tf.keras.preprocessing.image.save_img(
    pwd+"\\output-colored-mask.jpg",
    seg
)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-11-05
    • 2016-09-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-16
    • 2017-12-15
    • 1970-01-01
    相关资源
    最近更新 更多