Package: imgdata
img-data - PyPi package to make image datasetsimg-data is a small python package which will help you gather images from popular stock images sites and process them into image datasets. It can be incredibly easy to make a new image dataset for your deep learning project using img-data.Overviewimg-data provides 2 major functions :-Gather images from some of the most popular stock image websites using the API - No need to write the whole Python code to extract all the images yourself!It also conveniently divides those image into train, test and validation directories, so you have a dataset ready to useInstallationYou can PyPi repositiory to install img-data$ pip install imgdataUsageI am working on simplifying it further but as of now, using imgdata involves 3 stepsimporting the librarycreating the objectcalling requisite functionFunctionsFollowing functions are available for use in the library:pexels()-> Download data from pexels APIunsplash()-> Download data from unsplash APItransform_data()-> Divide data at a provided path into train/test/validationDownloading Images and Making Dataset$ import imgdata
$ obj = imgdata.Api()
$ obj.pexels(query = query,
            api_key = api_key,
            count = count,
            ratio = ratio,
            divide = True/False,
            validation = True/False)Arguments for Data Download functionsquery: You need to specify topic of image dataset. It can be a one word or multi word query. This will be the search query for API to work on.api_key: You need to provide API key through which to access website's data. Keep in mind, some sites limit use of API. Program may generate an error if limits exceed. I'll try to generate a warning beforehand for such sites when they are used.count: Total number of images needed. Again please check with site regarding the limit.ratio: Ratio in which you needed images divided into train and test. Default ratio is 0.2.divide: Setting this argument toTruewill automatically divide the downloaded images in train and test categoryvalidation: Only applicable ifdivideis set toTrue. Separates data into train/test/validation instead of train/test.File Structure for Data Download Functions-if`divide`issetto`True`:
â””â”€â”€datasetâ”œâ”€â”€trainâ”‚â””â”€â”€*.jpgâ”œâ”€â”€testâ”‚â””â”€â”€*.jpgâ””â”€â”€val(ifvalidationsetto`True`)â””â”€â”€*.jpg

-if`divide`issetto`False`â””â”€â”€datasetâ””â”€â”€*.jpgTransforming Available Dataset into Train, Test, ValidationShuffles the data converts them into train/test/val modules.$ import imgdata
$ obj = imgdata.Api()
$ obj.transform_data(path = data path
                    ratio = ratio,
                    validation = True/False)Arguments:path: The path to the dataset.ratio: Ratio of data for test and validation sets. (Default: 0.2)validation: If set to true, files will be divided into train/test/val instead of train/testFile Structure for Transforming data-InitialFileStructure

â””â”€â”€datasetâ”œâ”€â”€ClassAâ””â”€â”€ClassB




-Structureaftertransforming:
â””â”€â”€datasetâ”œâ”€â”€trainâ”‚â”œâ”€â”€ClassAâ”‚â””â”€â”€ClassBâ”œâ”€â”€testâ”‚â”œâ”€â”€ClassAâ”‚â””â”€â”€ClassBâ””â”€â”€validation(ifsettoTrue)â”œâ”€â”€ClassAâ””â”€â”€ClassBKeypointsThe ratio is mentioned is total count of files for test and validation individually. Eg. Assuming a ratio of 0.2 and a total of 10 files, test will have 2, validation will have 2 and train will have 6 files.The path for transforming data should be to folder containing the classesLicenseMIT LicenseCopyright (c) 2020 Arohan AjitPermission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.