You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PyTorch实现的人体分割任务结果异常,TensorFlow Keras版本正常,求排查原因

PyTorch实现的人体分割任务结果异常,TensorFlow Keras版本正常,求排查原因

嘿,我大概率漏了些关键细节,但还是先把PyTorch和TensorFlow Keras两套人体分割的实现流程贴出来了,先看结果对比:

结果对比

  • PyTorch版本结果:
    PyTorch版本分割结果

  • TensorFlow Keras版本结果:
    TensorFlow Keras版本分割结果

我暂时没法把整个实现流程说透,先把我用PyTorch写的部分代码贴出来:

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

model = models.segmentation.deeplabv3_resnet50(weights="DEFAULT").to(device)

# Mettre le modèle en mode évaluation
model.eval()

# Transformations similaires à celles utilisées dans Keras
transform = transforms.Compose([
    transforms.ToTensor(),
    transforms.Resize((img_size, img_size)),
])

def t_read_image(imagepath: Image.Image):
    image ...

备注:内容来源于stack exchange,提问作者Metal3d

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.15 14:13:13