【发布时间】:2021-06-27 10:10:33
【问题描述】:
当我使用 labelme 接口中的图像标记作为输出时,我得到 json 文件。但标记后我需要使用 png、bmp、jpeg 等图像格式。任何人都可以建议我任何代码吗?
导入 json 从 PIL 导入图片
with open('your,json') as f:
data = json.load(f)
# Load the file path from the json
imgpath = data['yourkey']
# Place the image path into the open method
img = Image.open(imgpath)
【问题讨论】:
-
我认为您的问题中没有足够的信息来回答您。你有
imgpath,我认为它是一个文件名?那么您的文件系统中是否有一个具有该名称的文件?如果没有,请问您要加载的图像在哪里?如果您的文件系统中确实有一个具有该名称的图像,那么当您运行代码时会发生什么?您可以用其他应用程序打开该图像吗?
标签: json image png multilabel-classification vgg-net