image-augs


Nameimage-augs JSON
Version 2.4.16 PyPI version JSON
download
home_page
SummaryImage Augs supports Augmentation for Object Detection , Instance Segmentation and classification tasks.
upload_time2023-05-13 15:15:02
maintainer
docs_urlNone
authorSouvik Saha
requires_python>=3.7
license
keywords machine_learning development data_augmentations
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Image Augmentations 🚀
***
<img src='images\logo.png'>

***
<img alt="GitHub code size in bytes" src="https://img.shields.io/github/languages/code-size/Souviksaha1998/Image_augmentations">

<img alt="GitHub code size in bytes" src="https://static.pepy.tech/personalized-badge/image-augs?period=total&units=international_system&left_color=black&right_color=brightgreen&left_text=Downloads">

<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/Souviksaha1998/image_augmentations?style=social">
<img alt="GitHub followers" src="https://img.shields.io/github/followers/Souviksaha1998?style=plastic">

***

This is a augemntation tool for Object Detection , Image classification and Instance Segmentation , it can perform 14 annotations. The important ones are rotation, affine, zooming in and out, noise, and blur. The augmentations were applied to a fraction of the data (40 - 50 percent of the images out of 100 can be augmented).When rotating or zooming in and out, the bounding box coordinates will also change as the image is rotated or zoomed.

***
##  Code Starts from here 

### 👩🏼‍💻Create a folder first, inside that folder keep your image annotation folder 👩🏼‍💻
***
<img src='images\3.jpg'>

### 👩🏼‍💻 Create a virtual environment 👩🏼‍💻

```python

pip install virtualenv
#name your environment
python3 -m venv <your env name>

#activate the environment --> for linux user
source <your env name>/bin/activate

#activate the environment  --> for windows user
<your env name>/Source/activate.ps1

```

### Installation (for pip installation) 🚀

```python
pip install image_augs
```

## After installation 🎯
***

**Create a .py script inside your created folder**

**This Script is for OBJECT DETECTION**

```python
#import these modules in your created <scriptname>.py file


from object_detection_new.txt_reader_rect import RectAugmentation

################# image height and width combination  ##################

# first combination --> for custom image size
#  image_height = < custom image size > ; 640
#  image_width = < custom image size > ; 320


# second combination --> keep aspect ratio of the image
#  image_height = 640
#  image_width  = 'keep_aspect_ratio_False'

# Third combination --> keeping original image height and width
#  image_height = 'keep_original_image_height'
#  image_width = 'keep_original_image_width'



annotation_folder = 'your folder'
new_aug_saved_folder = 'new saved folder'
train_split = 0.90
image_H = 640  #check above for height and width setting
image_W = 'keep_aspect_ratio'


rect_aug = RectAugmentation(new_aug_saved_folder)

rect_aug.Image_augmentation(annotation_folder,
                                 
                                train_split=train_split,
                                 image_height= image_H,
                                 image_width= image_W,


                                 blur=False,  blur_f=0.8,

                                 motionBlur= False , motionBlur_f= 0.8 ,

                                 rotate=False, rotate_f = 0.8, 

                                 noise=False, noise_f=0.8,

                                 perspective=False, perspective_f = 0.8,

                                 affine=False, affine_f=0.8,

                                 brightness=False, brightness_f=0.8,
                                    
                                 hue=False, hue_f=0.8,

                                 removesaturation=False, removesaturation_f=0.8,

                                 contrast=False, contrast_f=0.8,

                                 upflip=False, upflip_f=0.8,

                                 shear=False, shear_f=0.8, 

                                 rotate90=False, rotate90_f =0.8,

                                 blur_and_noise=False, blur_and_noise_f=0.8,

                                 image_cutout = False, image_cutout_f=0.8,
                                    
                                 mix_aug= False, mix_aug_f=0.8, 
                                    
                                 temperature_change= False, temperature_change_f=0.8,  # change color temperature from cool to warm color

                                 weather_change=True,weather_change_f=0.8), # add rain , fog , snow in your images
                               
                                

#results will be saved in < your given folder >
```
***

**This Script is for INSTANCE SEGMENTATION**

```python
#import these modules in your created <scriptname>.py file
from instance_seg.json_reader_poly import PolygonAugmentation


################# image height and width combination  ##################

# first combination --> for custom image size
#  image_height = < custom image size > ; 640
#  image_width = < custom image size > ; 320


# second combination --> keep aspect ratio of the image
#  image_height = 640
#  image_width  = 'keep_aspect_ratio_False'

# Third combination --> keeping original image height and width
#  image_height = 'keep_original_image_height'
#  image_width = 'keep_original_image_width'


#### yolo ####
# if yolo False then it will normalize all images and save it as txt , if false augmentations will be saved as json.

annotation_folder = 'your data'
new_aug_saved_folder = 'new saved dataset name'
train_split = 0.70
image_H = 640  #check above for height and width setting
image_W = 'keep_aspect_ratio'
yolo = True


im_aug_helper = PolygonAugmentation(aug_save_folder_name=new_aug_saved_folder,
                                    yolo=yolo)

im_aug_helper.Image_augmentation(annotation_folder,
                                 
                                 train_split=train_split,
                                 image_height= image_H,
                                 image_width= image_W,


                                 blur=True,  blur_f=0.8,

                                 motionBlur= False , motionBlur_f= 0.5,

                                 rotate=True, rotate_f = 0.8, 

                                 noise=True, noise_f=0.6,

                                 perspective=True, perspective_f = 0.6,

                                 affine=True, affine_f=0.6,

                                 brightness=True, brightness_f=0.6,
                                    
                                 hue=True, hue_f=0.6,

                                 removesaturation=True, removesaturation_f=0.6,

                                 contrast=True, contrast_f=0.6,

                                 upflip=True, upflip_f=0.8,

                                 shear=True , shear_f=0.7, 

                                 rotate90=True, rotate90_f =1.0,

                                 blur_and_noise=True, blur_and_noise_f=0.6,

                                 image_cutout = True, image_cutout_f=0.6,
                                    
                                 mix_aug=True, mix_aug_f=0.7,
                                    
                                 temperature_change=True, temperature_change_f=0.5,
                                 
                                 weather_change=True,weather_change_f=0.3)
#results will be saved in < your given folder >
***

```

**This Script is for IMAGE CLASSIFICATION**

```python
#import these modules in your created <scriptname>.py file
from classification.classification_combined import ImageAugmentHelper


### PARAMS ###
source_folder = '<source folder>'
aug_saved_folder = '<augmentation saved folder>'
train_split = 0.5
image_height = 512
image_width = 512

classification_aug = ImageAugmentHelper(source_folder=source_folder,
                                        aug_save_folder_name=aug_saved_folder,
                                        train_split=train_split,
                                        height=image_height,
                                        width=image_width)


classification_aug.augmentations(

    save_raw_images=True,

    blur=True, blur_f=1.0,

    noise=True,noise_f=1.0,

    horizontalFlip=True, horizontalFlip_f=1.0,

    brightness=True, brightness_f=1.0,

    contrast=True, contrast_f=1.0,

    hue=True, hue_f=1.0,

    saturation=True, saturation_f=1.0,

    zoom=True, zoom_f=1.0,

    perspective=True, perspective_f=1.0,

    translation=True, translation_f=1.0,

    sharpen=True, sharpen_f=1.0,
    
    randomShadow=True, randomShadow_f=1.0
)
```
***
Use github to clone [image_augmentations](https://github.com/Souviksaha1998/Image_augmentations) repo 🖥️
Use instanceSeg_aug_script.py / classification_aug_script.py / objectDetection_augScript.py according to your needs.

***


## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

## License
[MIT](https://choosealicense.com/licenses/mit/)



            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "image-augs",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "machine_learning,development,data_augmentations",
    "author": "Souvik Saha",
    "author_email": "ssouvik.191@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ea/80/bf892804c081eab2c005a23e4b658d1006bd2ab562a3d67ad4c325a510a3/image_augs-2.4.16.tar.gz",
    "platform": null,
    "description": "\n# Image Augmentations \ud83d\ude80\n***\n<img src='images\\logo.png'>\n\n***\n<img alt=\"GitHub code size in bytes\" src=\"https://img.shields.io/github/languages/code-size/Souviksaha1998/Image_augmentations\">\n\n<img alt=\"GitHub code size in bytes\" src=\"https://static.pepy.tech/personalized-badge/image-augs?period=total&units=international_system&left_color=black&right_color=brightgreen&left_text=Downloads\">\n\n<img alt=\"GitHub Repo stars\" src=\"https://img.shields.io/github/stars/Souviksaha1998/image_augmentations?style=social\">\n<img alt=\"GitHub followers\" src=\"https://img.shields.io/github/followers/Souviksaha1998?style=plastic\">\n\n***\n\nThis is a augemntation tool for Object Detection , Image classification and Instance Segmentation , it can perform 14 annotations. The important ones are rotation, affine, zooming in and out, noise, and blur. The augmentations were applied to a fraction of the data (40 - 50 percent of the images out of 100 can be augmented).When rotating or zooming in and out, the bounding box coordinates will also change as the image is rotated or zoomed.\n\n***\n##  Code Starts from here \n\n### \ud83d\udc69\ud83c\udffc\u200d\ud83d\udcbbCreate a folder first, inside that folder keep your image annotation folder \ud83d\udc69\ud83c\udffc\u200d\ud83d\udcbb\n***\n<img src='images\\3.jpg'>\n\n### \ud83d\udc69\ud83c\udffc\u200d\ud83d\udcbb Create a virtual environment \ud83d\udc69\ud83c\udffc\u200d\ud83d\udcbb\n\n```python\n\npip install virtualenv\n#name your environment\npython3 -m venv <your env name>\n\n#activate the environment --> for linux user\nsource <your env name>/bin/activate\n\n#activate the environment  --> for windows user\n<your env name>/Source/activate.ps1\n\n```\n\n### Installation (for pip installation) \ud83d\ude80\n\n```python\npip install image_augs\n```\n\n## After installation \ud83c\udfaf\n***\n\n**Create a .py script inside your created folder**\n\n**This Script is for OBJECT DETECTION**\n\n```python\n#import these modules in your created <scriptname>.py file\n\n\nfrom object_detection_new.txt_reader_rect import RectAugmentation\n\n################# image height and width combination  ##################\n\n# first combination --> for custom image size\n#\u00a0 image_height = < custom image size > ; 640\n#\u00a0 image_width = < custom image size > ; 320\n\n\n# second combination --> keep aspect ratio of the image\n#\u00a0 image_height = 640\n#\u00a0 image_width\u00a0 = 'keep_aspect_ratio_False'\n\n# Third combination --> keeping original image height and width\n#\u00a0 image_height = 'keep_original_image_height'\n#\u00a0 image_width = 'keep_original_image_width'\n\n\n\nannotation_folder = 'your folder'\nnew_aug_saved_folder = 'new saved folder'\ntrain_split = 0.90\nimage_H = 640  #check above for height and width setting\nimage_W = 'keep_aspect_ratio'\n\n\nrect_aug = RectAugmentation(new_aug_saved_folder)\n\nrect_aug.Image_augmentation(annotation_folder,\n                                 \n                                train_split=train_split,\n                                 image_height= image_H,\n                                 image_width= image_W,\n\n\n                                 blur=False,  blur_f=0.8,\n\n                                 motionBlur= False , motionBlur_f= 0.8 ,\n\n                                 rotate=False, rotate_f = 0.8, \n\n                                 noise=False, noise_f=0.8,\n\n                                 perspective=False, perspective_f = 0.8,\n\n                                 affine=False, affine_f=0.8,\n\n                                 brightness=False, brightness_f=0.8,\n                                    \n                                 hue=False, hue_f=0.8,\n\n                                 removesaturation=False, removesaturation_f=0.8,\n\n                                 contrast=False, contrast_f=0.8,\n\n                                 upflip=False, upflip_f=0.8,\n\n                                 shear=False, shear_f=0.8, \n\n                                 rotate90=False, rotate90_f =0.8,\n\n                                 blur_and_noise=False, blur_and_noise_f=0.8,\n\n                                 image_cutout = False, image_cutout_f=0.8,\n                                    \n                                 mix_aug= False, mix_aug_f=0.8, \n                                    \n                                 temperature_change= False, temperature_change_f=0.8,  # change color temperature from cool to warm color\n\n                                 weather_change=True,weather_change_f=0.8), # add rain , fog , snow in your images\n                               \n                                \n\n#results will be saved in < your given folder >\n```\n***\n\n**This Script is for INSTANCE SEGMENTATION**\n\n```python\n#import these modules in your created <scriptname>.py file\nfrom instance_seg.json_reader_poly import PolygonAugmentation\n\n\n################# image height and width combination  ##################\n\n# first combination --> for custom image size\n#\u00a0 image_height = < custom image size > ; 640\n#\u00a0 image_width = < custom image size > ; 320\n\n\n# second combination --> keep aspect ratio of the image\n#\u00a0 image_height = 640\n#\u00a0 image_width\u00a0 = 'keep_aspect_ratio_False'\n\n# Third combination --> keeping original image height and width\n#\u00a0 image_height = 'keep_original_image_height'\n#\u00a0 image_width = 'keep_original_image_width'\n\n\n#### yolo ####\n# if yolo False then it will normalize all images and save it as txt , if false augmentations will be saved as json.\n\nannotation_folder = 'your data'\nnew_aug_saved_folder = 'new saved dataset name'\ntrain_split = 0.70\nimage_H = 640  #check above for height and width setting\nimage_W = 'keep_aspect_ratio'\nyolo = True\n\n\nim_aug_helper = PolygonAugmentation(aug_save_folder_name=new_aug_saved_folder,\n                                    yolo=yolo)\n\nim_aug_helper.Image_augmentation(annotation_folder,\n                                 \n                                 train_split=train_split,\n                                 image_height= image_H,\n                                 image_width= image_W,\n\n\n                                 blur=True,  blur_f=0.8,\n\n                                 motionBlur= False , motionBlur_f= 0.5,\n\n                                 rotate=True, rotate_f = 0.8, \n\n                                 noise=True, noise_f=0.6,\n\n                                 perspective=True, perspective_f = 0.6,\n\n                                 affine=True, affine_f=0.6,\n\n                                 brightness=True, brightness_f=0.6,\n                                    \n                                 hue=True, hue_f=0.6,\n\n                                 removesaturation=True, removesaturation_f=0.6,\n\n                                 contrast=True, contrast_f=0.6,\n\n                                 upflip=True, upflip_f=0.8,\n\n                                 shear=True , shear_f=0.7, \n\n                                 rotate90=True, rotate90_f =1.0,\n\n                                 blur_and_noise=True, blur_and_noise_f=0.6,\n\n                                 image_cutout = True, image_cutout_f=0.6,\n                                    \n                                 mix_aug=True, mix_aug_f=0.7,\n                                    \n                                 temperature_change=True, temperature_change_f=0.5,\n                                 \n                                 weather_change=True,weather_change_f=0.3)\n#results will be saved in < your given folder >\n***\n\n```\n\n**This Script is for IMAGE CLASSIFICATION**\n\n```python\n#import these modules in your created <scriptname>.py file\nfrom classification.classification_combined import ImageAugmentHelper\n\n\n### PARAMS ###\nsource_folder = '<source folder>'\naug_saved_folder = '<augmentation saved folder>'\ntrain_split = 0.5\nimage_height = 512\nimage_width = 512\n\nclassification_aug = ImageAugmentHelper(source_folder=source_folder,\n                                        aug_save_folder_name=aug_saved_folder,\n                                        train_split=train_split,\n                                        height=image_height,\n                                        width=image_width)\n\n\nclassification_aug.augmentations(\n\n    save_raw_images=True,\n\n    blur=True, blur_f=1.0,\n\n    noise=True,noise_f=1.0,\n\n    horizontalFlip=True, horizontalFlip_f=1.0,\n\n    brightness=True, brightness_f=1.0,\n\n    contrast=True, contrast_f=1.0,\n\n    hue=True, hue_f=1.0,\n\n    saturation=True, saturation_f=1.0,\n\n    zoom=True, zoom_f=1.0,\n\n    perspective=True, perspective_f=1.0,\n\n    translation=True, translation_f=1.0,\n\n    sharpen=True, sharpen_f=1.0,\n    \n    randomShadow=True, randomShadow_f=1.0\n)\n```\n***\nUse github to clone [image_augmentations](https://github.com/Souviksaha1998/Image_augmentations) repo \ud83d\udda5\ufe0f\nUse instanceSeg_aug_script.py / classification_aug_script.py / objectDetection_augScript.py according to your needs.\n\n***\n\n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Image Augs supports Augmentation for Object Detection , Instance Segmentation and classification tasks.",
    "version": "2.4.16",
    "project_urls": null,
    "split_keywords": [
        "machine_learning",
        "development",
        "data_augmentations"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6a070ac459cb4c02e879a5247b7414d0c108b59a81303d34bd4192d6328c6e32",
                "md5": "9b76dc9a17f3acf16aee2abc792e455d",
                "sha256": "dd91d160098b9b8bf2b24ee84b63b9be40323e07eb0e8bccfedec77e78f12255"
            },
            "downloads": -1,
            "filename": "image_augs-2.4.16-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9b76dc9a17f3acf16aee2abc792e455d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 30983,
            "upload_time": "2023-05-13T15:14:59",
            "upload_time_iso_8601": "2023-05-13T15:14:59.641488Z",
            "url": "https://files.pythonhosted.org/packages/6a/07/0ac459cb4c02e879a5247b7414d0c108b59a81303d34bd4192d6328c6e32/image_augs-2.4.16-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ea80bf892804c081eab2c005a23e4b658d1006bd2ab562a3d67ad4c325a510a3",
                "md5": "4917ef712010f2a553252dc031d7bfec",
                "sha256": "f014af75a431619bb0b85d4d5fdb54c0cc772e38ae614117b3e0a31796f02a16"
            },
            "downloads": -1,
            "filename": "image_augs-2.4.16.tar.gz",
            "has_sig": false,
            "md5_digest": "4917ef712010f2a553252dc031d7bfec",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 28938,
            "upload_time": "2023-05-13T15:15:02",
            "upload_time_iso_8601": "2023-05-13T15:15:02.176310Z",
            "url": "https://files.pythonhosted.org/packages/ea/80/bf892804c081eab2c005a23e4b658d1006bd2ab562a3d67ad4c325a510a3/image_augs-2.4.16.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-13 15:15:02",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "image-augs"
}
        
Elapsed time: 0.06521s