{"id":18919019,"url":"https://github.com/alek-dr/pascalvoc","last_synced_at":"2025-10-25T12:06:40.483Z","repository":{"id":173751676,"uuid":"338594598","full_name":"Alek-dr/PascalVOC","owner":"Alek-dr","description":"Python utility to work with PascalVoc annotation format","archived":false,"fork":false,"pushed_at":"2025-02-02T09:14:55.000Z","size":1467,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T21:04:33.536Z","etag":null,"topics":["annotation","annotation-processing","annotation-tool","annotations","annotationview","dataset","labelimg","labelme","labelme-json","pascal-voc","yoloformat"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Alek-dr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-02-13T14:39:41.000Z","updated_at":"2025-02-02T09:03:40.000Z","dependencies_parsed_at":"2024-11-08T10:39:23.873Z","dependency_job_id":"300e2a8a-9179-4b18-b30e-7dcda39e171b","html_url":"https://github.com/Alek-dr/PascalVOC","commit_stats":null,"previous_names":["alek-dr/pascalvoc"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alek-dr%2FPascalVOC","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alek-dr%2FPascalVOC/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alek-dr%2FPascalVOC/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alek-dr%2FPascalVOC/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Alek-dr","download_url":"https://codeload.github.com/Alek-dr/PascalVOC/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248631686,"owners_count":21136562,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["annotation","annotation-processing","annotation-tool","annotations","annotationview","dataset","labelimg","labelme","labelme-json","pascal-voc","yoloformat"],"created_at":"2024-11-08T10:34:38.865Z","updated_at":"2025-10-25T12:06:40.346Z","avatar_url":"https://github.com/Alek-dr.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"### pascal\n\nPython utility to work with PascalVoc annotation format\n\nImage examples from [PascalVoc2007](hhttp://host.robots.ox.ac.uk/pascal/VOC/voc2007/) dataset\n\n##### Code Example\n\n```\nimport json\nfrom pathlib import Path\n\nfrom PIL import Image\n\nfrom pascal import annotation_from_xml\nfrom pascal.utils import save_xml\n\nds_path = Path(\"/home/VOCtest_06-Nov-2007/VOCdevkit/VOC2007\")\n\nimg_src = ds_path / \"JPEGImages\"\nann_src = ds_path / \"Annotations\"\n\nout_labelme = ds_path / \"converted_labelme\"\n\nattr_type_spec = {\"truncated\": bool, \"difficult\": bool}\n\nlabel_map = {\"car\": 1, \"dog\": 0, \"person\": 2, \"train\": 3}\n\nif __name__ == \"__main__\":\n    for file in img_src.glob(\"*.jpg\"):\n        # Get annotation file path\n        ann_file = (ann_src / file.name).with_suffix(\".xml\")\n        # Make pascal annotation object\n        ann = annotation_from_xml(ann_file, attr_type_spec)\n        print(ann)\n        # Save to xml file (same as ann_file)\n        xml = ann.to_xml()\n        out_xml_name = file.with_suffix(\".xml\").name\n        save_xml(out_xml_name, xml)\n        # Save yolo annotation\n        yolo_ann = ann.to_yolo(label_map)\n        out_yolo_name = file.with_suffix(\".txt\").name\n        with open(out_yolo_name, \"w\") as f:\n            f.write(yolo_ann)\n        # Convert to labelme and save json file\n        res = ann.to_labelme(file, save_img_data=False)\n        with open((out_labelme / file.name).with_suffix(\".json\"), \"w\") as f:\n            json.dump(res, f, indent=2)\n        # Draw objects\n        img = Image.open(file)\n        draw_img = ann.draw_boxes(img)\n        draw_img.show()\n```\n\n##### Visualization example:\n```\ndraw_img = ann.draw_boxes(img)\ndraw_img.show()\n```\n![vis_example](examples/vis.png)\n\n#### Installation\nFrom source \n```\npython setup.py install\n```\nUsing pip\n```\npip install pascal-voc\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falek-dr%2Fpascalvoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falek-dr%2Fpascalvoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falek-dr%2Fpascalvoc/lists"}