{ "info": { "author": "Long Chen", "author_email": "looooong.chen@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "\nstill under construction, coming soon\n# tfAugmentor\nAn image augmentation library for tensorflow. All operations are implemented as pure tensorflow graph operations. Thus, tfAugmentor can be easily combined with any tensorflow graph, such as tf.Data, for on-the-fly data augmentation. \nOf cousrse, you can also use it off-line to generate your augmented dataset. \n\n## Installation\ntfAugmentor is written in Python and can be easily installed via:\n```python\npip install tfAugmentor\n```\nTo run tfAugmentor properly, the following library should be installed as well:\n- tensorflow (developed under tf 1.12)\n- numpy (developed under numpy 1.15)\n\n## Quick Start\ntfAugmentor aims to implement image augmentations purly as a tensorflow graph, so that it can be used seamlessly with other tensorflow components, such as tf.Data. \nBut you can also use it independently as a off-line augmentation tool. \n\nTo begin, instantiate an `Augmentor` object and pass a dictionary of tensors to it. These tensors should have the same 4-D shape of `[batch, height, width, channels]`. \n\nTo preserve the consistence of label/segmentation maps, the corresponding dict key should be pass to `label` as a list.\n\n```python\nimport tfAugmentor as tfa\ntensor_list = {\n\t'images': image_tensor,\n\t'segmentation_mask': mask_tensor\n}\naug1 = tfa.Augmentor(tensor_list, label=['segmentation_mask'])\n```\n\nAdd augmentations and get the output tensor:\n\n```python\naug1.flip_left_right(probability=0.5) # apply left right flip with probability 0.5\nout1 = aug1.out\n```\n\nSeveral augmentors with the same structure can be merged, which means you can parallel several pipelines\n\n```python\naug2 = tfa.Augmentor(tensor_list, label=['segmentation_mask']) # another augmentor with the same input as aug1\naug2.flip_up_down(probability=0.5) # apply up down flip this time\naug3 = tfa.Augmentor(tensor_list, label=['segmentation_mask'])\naug3.elastic_deform(probability=0.5, strength=1, scale=30) # elastic deformation\nout = aug1.merge([aug2, aug3])\n```\n\n### Example with tf.Data\n\nAn example of data importing with tf.data and tfAugmentor:\n\n```python\nds = tf.data.TFRecordDataset([...])\nds = ds.map(extract_fn)\nds = ds.shuffle(buffer_size=500)\nds = ds.batch(batch_size)\n\niterator = dataset.make_one_shot_iterator()\nnext_element = iterator.get_next()\n\n\ndef extract_fn(sample):\n\n\t# parse the tfrecord example of your dataset\n\t....\n\t# assume the dataset contains three tensors: image, weight_map, seg_mask\n\n\t# instantiate an Augmentor\n\tinput_list = {\n\t\t'img': image,\n\t\t'weight': weight_map,\n\t\t'mask': seg_mask\n\t}\n\ta = tfa.Augmentor(input_list, label=['segmentation_mask'])\n\n\ta.flip_left_right(probability=0.5) # apply left right flip\n\ta.random_rotate(probability=0.6) # apply random rotation\n\ta.elastic_deform(probability=0.2, strength=200, scale=20) # apply elastic deformation\n\n\t# dictionary of the augmented images, which has the same keys as input_list\n\taugmented = a.out\n\t# return tensors in a form you need\n\treturn augmented['img'], augmented['weight'], augmented['mask'] \n```\n\n## Main Features\n\n### Mirroring\n```python\na.flip_left_right(probability) # flip the image left right \na.flip_up_down(probability) # flip the image up down\n```\n### Rotating\n```python\na.rotate90(probability) # rotate by 90 degree clockwise\na.rotate180(probability) # rotate by 180 degree clockwise\na.rotate270(probability) # rotate by 270 degree clockwise\na.rotate(probability, angle) # rotate by *angel* degree clockwise\na.random_rotate(probability) # randomly rotate the image\n```\n### crop and resize\n```python\na.random_crop_resize(probability, scale_range=(0.5, 0.8)) # randomly crop a sub-image and resize to the same size of the original image\na.crop(probability, size) # randomly crop a sub-image of a certain size\n```\n\n### elastic deformation\n```\na.elastic_deform(probability, strength, scale)\n```\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/looooongChen/tfAugmentor", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "tfAugmentor", "package_url": "https://pypi.org/project/tfAugmentor/", "platform": "", "project_url": "https://pypi.org/project/tfAugmentor/", "project_urls": { "Homepage": "https://github.com/looooongChen/tfAugmentor" }, "release_url": "https://pypi.org/project/tfAugmentor/1.0.2/", "requires_dist": [ "tensorflow (>=1.12.0)", "numpy" ], "requires_python": "", "summary": "An image augmentation library for tensorflow. All operations are implemented as pure tensorflow graph operations.", "version": "1.0.2" }, "last_serial": 5286928, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "0876a96a89699095df409b1b0c046edb", "sha256": "e932f41bedbaffc6b409dcf4fcb64dec0873ca29bb1009528a35e56d665379ec" }, "downloads": -1, "filename": "tfAugmentor-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "0876a96a89699095df409b1b0c046edb", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7752, "upload_time": "2019-05-17T16:32:37", "url": "https://files.pythonhosted.org/packages/24/10/70e2ffb25407c190f82811bef81a70eb4ef1cf95eea7ba59891bef771394/tfAugmentor-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1d994aac3709727773929412ca24ee05", "sha256": "fa4efef64fe09d894d5e16e8b98157a618aadf856280439cfcac9e81d2c0145e" }, "downloads": -1, "filename": "tfAugmentor-1.0.1.tar.gz", "has_sig": false, "md5_digest": "1d994aac3709727773929412ca24ee05", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6870, "upload_time": "2019-05-17T16:32:39", "url": "https://files.pythonhosted.org/packages/0b/a8/a6e12a2537cd0975035011a44e6a6140c305943d0c29b5980f38aab3b251/tfAugmentor-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "f19355e919b604a10ff75360a59608ac", "sha256": "fbba479ea990a93a0f0984dea49915e358055a571ee37b4eb3e89115ad4182f0" }, "downloads": -1, "filename": "tfAugmentor-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "f19355e919b604a10ff75360a59608ac", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7982, "upload_time": "2019-05-19T00:12:50", "url": "https://files.pythonhosted.org/packages/4c/82/f4b80821d6eccead5c772d42b363257f6f59112326c5bc471370b0fe49db/tfAugmentor-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ba1ab1d2a9e7381e19ad0efa2464947c", "sha256": "acfa4a022263e81cdff76fe227ed4ecb5aed95f44ee64a26a8e20d77b7ac573b" }, "downloads": -1, "filename": "tfAugmentor-1.0.2.tar.gz", "has_sig": false, "md5_digest": "ba1ab1d2a9e7381e19ad0efa2464947c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7161, "upload_time": "2019-05-19T00:12:52", "url": "https://files.pythonhosted.org/packages/60/f9/dd2484a630a441135b7bdd0886aaa25dd355fea0df731d69f879932c55d8/tfAugmentor-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f19355e919b604a10ff75360a59608ac", "sha256": "fbba479ea990a93a0f0984dea49915e358055a571ee37b4eb3e89115ad4182f0" }, "downloads": -1, "filename": "tfAugmentor-1.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "f19355e919b604a10ff75360a59608ac", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7982, "upload_time": "2019-05-19T00:12:50", "url": "https://files.pythonhosted.org/packages/4c/82/f4b80821d6eccead5c772d42b363257f6f59112326c5bc471370b0fe49db/tfAugmentor-1.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ba1ab1d2a9e7381e19ad0efa2464947c", "sha256": "acfa4a022263e81cdff76fe227ed4ecb5aed95f44ee64a26a8e20d77b7ac573b" }, "downloads": -1, "filename": "tfAugmentor-1.0.2.tar.gz", "has_sig": false, "md5_digest": "ba1ab1d2a9e7381e19ad0efa2464947c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7161, "upload_time": "2019-05-19T00:12:52", "url": "https://files.pythonhosted.org/packages/60/f9/dd2484a630a441135b7bdd0886aaa25dd355fea0df731d69f879932c55d8/tfAugmentor-1.0.2.tar.gz" } ] }