cvtools.label_convert.voc_to_coco module

class cvtools.label_convert.voc_to_coco.VOC2COCO(root, mode='train', cls=['aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat', 'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike', 'person', 'pottedplant', 'sheep', 'sofa', 'train', 'tvmonitor'], cls_replace=None, use_xml_name=True, read_test=False)[源代码]

基类:object

convert voc-like dataset to coco-like dataset

参数:
  • root (str) -- path include images, xml, file list
  • mode (str) -- 'train', 'val', 'trainval', 'test'. used to find file list.
  • cls (str or list) -- class name in a file or a list.
  • cls_replace (dict) -- a dictionary for replacing class name. if not needed, you can just ignore it.
  • use_xml_name (bool) -- image filename source, if true, using the same name as xml for the image, otherwise using 'filename' in xml context for the image.
  • read_test (bool) -- Test if the picture can be read normally.
check_image(img_path)[源代码]
convert(filter_objs=None)[源代码]
save_json(to_file='cocolike.json')[源代码]