{ "info": { "author": "Ashwin Nair", "author_email": "ash1995@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy" ], "description": "\n# COCO-Assistant \n\n![CircleCI](https://circleci.com/gh/ashnair1/COCO-Assistant/tree/master.svg?style=shield&circle-token=553c83e37198fe02a71743d42ee427c292336743) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nHelper for dealing with MS-COCO annotations. \n\n\n## Overview\nThe MS COCO annotation format along with the pycocotools library is quite popular among the computer vision community. Yet I for one found it difficult to play around with the annotations. Deleting a specific category, combining multiple mini datasets to generate a larger dataset, viewing distribution of classes in the annotation file are things I would like to do without writing a separate script for each. The COCO Assistant is designed (or being designed) to assist with this problem. Any contributions and/or suggestions are welcome.\n\n### Requirements\nYour data directory should look as follows:\n\n```\nExample:\n.\n\u251c\u2500\u2500 images\n\u2502 \u251c\u2500\u2500 train\n\u2502 \u251c\u2500\u2500 val\n| \u251c\u2500\u2500 test\n| \n\u251c\u2500\u2500 annotations\n\u2502 \u251c\u2500\u2500 train.json\n\u2502 \u251c\u2500\u2500 val.json\n\u2502 \u251c\u2500\u2500 test.json\n\n``` \n\n## Installation\n\n```\n# Clone the repository\ngit clone https://github.com/ashnair1/COCO-Assistant.git\n# Build and install the library\nmake\n```\n\n## Usage\n\nUsage is similar to how you would use `pycocotools`\n\n```\nfrom coco_assistant import COCO_Assistant\n\n# Specify image and annotation directories\nimg_dir = os.path.join(os.getcwd(), 'images')\nann_dir = os.path.join(os.getcwd(), 'annotations')\n\n# Create COCO_Assistant object\ncas = COCO_Assistant(img_dir, ann_dir)\n```\n## So what can this package do?:\n\n#### Merge datasets\n\nThe `combine` function allows you to merge multiple datasets.\n\n```\ncas = COCO_Assistant(img_dir, ann_dir) \nloading annotations into memory...\nDone (t=0.09s)\ncreating index...\nindex created!\nloading annotations into memory...\nDone (t=0.06s)\ncreating index...\nindex created!\n\ncas.combine() \nMerging image dirs\n100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 2/2 [00:00<00:00, 18.33it/s]\nMerging annotations\n100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 2/2 [00:00<00:00, 14.72it/s]\n\n```\nThe merged dataset (images and annotation) can be found in `./results/combination`\n\n\n#### Remove_cat\n\nRemoves a specific category from an annotation file.\n\n```\ncas = COCO_Assistant(img_dir, ann_dir) \nloading annotations into memory...\nDone (t=0.09s)\ncreating index...\nindex created!\nloading annotations into memory...\nDone (t=0.06s)\ncreating index...\nindex created!\n\ncas.remove_cat()\n['tiny.json', 'tiny2.json']\nWho needs a cat removal?\ntiny.json\n\nCategories present:\n['building', 'vehicles]\n\nEnter categories you wish to remove:\nbuilding\n['building']\nPress n if you're done entering categories, else continue\nn\nRemoving specified categories...\n```\nThe modified annotation can be found in `./results/removal`\n\n\n#### Generate annotation statistics\n\n1. Generate countplot of instances per category that occur in the annotation files.\n`cas.ann_stats(stat=\"area\",arearng=[10,144,512,1e5],save=False)`\n2. Generate pie-chart that shows distribution of objects according to their size (as specified in areaRng).\n`cas.ann_stats(stat=\"cat\", show_count=False, save=False)`\n\n#### Visualise annotations\n\nCouldn't `pycocotools` visualise annotations (via [showAnns](https://github.com/cocodataset/cocoapi/blob/636becdc73d54283b3aac6d4ec363cffbb6f9b20/PythonAPI/pycocotools/coco.py#L233)) as well? Sure it could, but I required a way to freely view all the annotations of a particular dataset so here we are.\n\n```\ncas.visualise()\nChoose directory:\n['tiny', 'tiny2']\n```\n\n![](./rep_stuff/visualiser.gif)\n\n\n### Todo: \n1. Converter for converting COCO annotations to YOLO format\n2. Write tests for stats, converters and visualiser.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/ashnair1/COCO-Assistant/archive/v0.1.0.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ashnair1/COCO-Assistant", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "coco-assistant", "package_url": "https://pypi.org/project/coco-assistant/", "platform": "", "project_url": "https://pypi.org/project/coco-assistant/", "project_urls": { "Download": "https://github.com/ashnair1/COCO-Assistant/archive/v0.1.0.tar.gz", "Homepage": "https://github.com/ashnair1/COCO-Assistant" }, "release_url": "https://pypi.org/project/coco-assistant/0.1.0/", "requires_dist": [ "Cython (==0.29.13)", "matplotlib (==3.0.2)", "numpy (==1.16.0)", "pandas (==0.23.4)", "pycocotools", "seaborn (==0.9.0)", "scikit-image (==0.14.2)", "tensorflow (==1.12.0)", "tqdm (==4.28.1)", "setuptools (==40.6.3)", "wheel (==0.32.3)", "requests" ], "requires_python": ">=3.6.0", "summary": "Helper for dealing with MS-COCO annotations", "version": "0.1.0" }, "last_serial": 5945944, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "0cd85568d9f3393449f46a8637894e63", "sha256": "e8a12cfa7c4d7f9d98f4fe9b3916ced483d60556cc8644d29930fc5d7a59670a" }, "downloads": -1, "filename": "coco_assistant-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "0cd85568d9f3393449f46a8637894e63", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 30760, "upload_time": "2019-10-08T17:47:11", "url": "https://files.pythonhosted.org/packages/3d/80/ae2465c686d117eeb85b03166cc6a4dcf13a05193f53a83c8cc54d9760f9/coco_assistant-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "562cefc5655b1f1eb88b9b85a718d3ed", "sha256": "0fcb6132f1f5b8cc63d775df87c4d34b0643cb36be3143b3aa4e459f2a12a8d9" }, "downloads": -1, "filename": "coco_assistant-0.1.0.tar.gz", "has_sig": false, "md5_digest": "562cefc5655b1f1eb88b9b85a718d3ed", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 4003763, "upload_time": "2019-10-08T17:47:21", "url": "https://files.pythonhosted.org/packages/a2/1d/7fcd84448a60af6c9561ec0a004d6344c5356bbdd52cf07b6dc3865c76c1/coco_assistant-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0cd85568d9f3393449f46a8637894e63", "sha256": "e8a12cfa7c4d7f9d98f4fe9b3916ced483d60556cc8644d29930fc5d7a59670a" }, "downloads": -1, "filename": "coco_assistant-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "0cd85568d9f3393449f46a8637894e63", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6.0", "size": 30760, "upload_time": "2019-10-08T17:47:11", "url": "https://files.pythonhosted.org/packages/3d/80/ae2465c686d117eeb85b03166cc6a4dcf13a05193f53a83c8cc54d9760f9/coco_assistant-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "562cefc5655b1f1eb88b9b85a718d3ed", "sha256": "0fcb6132f1f5b8cc63d775df87c4d34b0643cb36be3143b3aa4e459f2a12a8d9" }, "downloads": -1, "filename": "coco_assistant-0.1.0.tar.gz", "has_sig": false, "md5_digest": "562cefc5655b1f1eb88b9b85a718d3ed", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 4003763, "upload_time": "2019-10-08T17:47:21", "url": "https://files.pythonhosted.org/packages/a2/1d/7fcd84448a60af6c9561ec0a004d6344c5356bbdd52cf07b6dc3865c76c1/coco_assistant-0.1.0.tar.gz" } ] }