# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import argparse
import base64
import json
import os
import os.path as osp
import warnings
import PIL.Image
import yaml
from labelme import utils
def main():
warnings.warn("This script is aimed to demonstrate how to convert the\n"
"JSON file to a single image dataset, and not to handle\n"
"multiple JSON files to generate a real-use dataset.")
parser = argparse.ArgumentParser() # 创建一个解释对象
parser.add_argument('json_file') # 向该对象中添加你要关注的命令行参数和选项
parser.add_argument('-o', '--out', default=None)
args = parser.parse_args() # 进行解析
json_file = args.json_file
if args.out is None:
# os.path.basename(path),返回path最后的文件名
# Python replace() 方