Package: basic-image-eda
basic-image-edaA simple multiprocessing EDA tool to check basic information of images under a directory(images are found recursively). This tool was made to quickly check info and prevent mistakes on reading, resizing, and normalizing images as inputs for neural networks. It can be used when first joining an image competition or training CNNs with images!Notes:- All images are converted to 3-channel(rgb) images. When images that have various channels are mixed, some results can be misleading.- uint8 and uint16 data types are supported. If different data types are mixed, error occurs.- Supported extensions: jpg, jpeg, jpe, png, tif, tiff, bmp, ppm, pbm, pgm, sr, ras, webpInstallationpipinstallbasic-image-edaor (latest version)pipinstallgit+https://github.com/Soongja/basic-image-edaprerequisites:opencv-pythonnumpymatplotlibskimage.iotifffiletqdmUsage(CLI/Code)CLIsimple one line command!basic-image-eda<data_dir>orbasic-image-eda<data_dir>-epngtiff-t12--dimension_plot--channel_hist--nonzero--hw_division_factor2.0>eda.txt

Options:-e--extensionstargetimageextensions.ifnone,allsupportedextensionsareincluded.(default=None)-t--threadsnumberofmultiprocessingthreads.if0,automaticallycountmaxthreads.(default=0)-d--dimension_plotshowdimension(height/width)scatterplot.(default=False)-c--channel_histshowchannelwisepixelvaluehistogram.takeslongertime.(default=False)-n--nonzerocalculatevaluesonlyfromnon-zeropixelsoftheimages.(default=False)-f--hw_division_factordivideheight,widthoftheimagesbythisfactortomakepixelvaluecalculationfaster.Informationonheight,widtharenotchangedandwillbeprintedcorrectly.(default=1.0)-V--versionshowversion.Codefrombasic_image_edaimportBasicImageEDAif__name__=="__main__":# for multiprocessingdata_dir="./data"BasicImageEDA.explore(data_dir)# orextensions=['png','jpg','jpeg']threads=0dimension_plot=Truechannel_hist=Truenonzero=Falsehw_division_factor=1.0BasicImageEDA.explore(data_dir,extensions,threads,dimension_plot,channel_hist,nonzero,hw_division_factor)ResultsResults onceleba dataset(test set)found 19962 images.
Using 12 threads. (max:12)

*--------------------------------------------------------------------------------------*
number of images                         |  19962

dtype                                    |  uint8
channels                                 |  [3]
extensions                               |  ['jpg']

min height                               |  85
max height                               |  5616
mean height                              |  591.8215108706543
median height                            |  500

min width                                |  85
max width                                |  5616
mean width                               |  490.2976655645727
median width                             |  396

mean height/width ratio                  |  1.207065732587525
median height/width ratio                |  1.2626262626262625
recommended input size(by mean)          |  [592 488] (h x w, multiples of 8)
recommended input size(by mean)          |  [592 496] (h x w, multiples of 16)
recommended input size(by mean)          |  [576 480] (h x w, multiples of 32)

channel mean(0~1)                        |  [0.4954518  0.42574266 0.39330518]
channel std(0~1)                         |  [0.3216056 0.3023355 0.3018837]
*--------------------------------------------------------------------------------------*download site:http://mmlab.ie.cuhk.edu.hk/projects/CelebA.htmlpaper: S. Yang, P. Luo, C. C. Loy, and X. Tang, "From Facial Parts Responses to Face Detection: A Deep Learning Approach", in IEEE International Conference on Computer Vision (ICCV), 2015Results onNIH Chest X-ray dataset(images_001.tar.gz)found 4999 images.
Using 12 threads. (max:12)

*--------------------------------------------------------------------------------------*
number of images                         |  4999

dtype                                    |  uint8
channels                                 |  [1, 4]
extensions                               |  ['png']

min height                               |  1024
max height                               |  1024
mean height                              |  1024.0
median height                            |  1024

min width                                |  1024
max width                                |  1024
mean width                               |  1024.0
median width                             |  1024

mean height/width ratio                  |  1.0
median height/width ratio                |  1.0
recommended input size(by mean)          |  [1024 1024] (h x w, multiples of 8)
recommended input size(by mean)          |  [1024 1024] (h x w, multiples of 16)
recommended input size(by mean)          |  [1024 1024] (h x w, multiples of 32)

channel mean(0~1)                        |  [0.5172472 0.5172472 0.5172472]
channel std(0~1)                         |  [0.25274998 0.25274998 0.25274998]
*--------------------------------------------------------------------------------------*data provider: NIH Clinical Centerdownload site:https://nihcc.app.box.com/v/ChestXray-NIHCCpaper: Xiaosong Wang, Yifan Peng, Le Lu, Zhiyong Lu, Mohammadhadi Bagheri, Ronald Summers, ChestX-ray8:
Hospital-scale Chest X-ray Database and Benchmarks on Weakly-Supervised Classification and Localization of
Common Thorax Diseases, IEEE CVPR, pp. 3462-3471, 2017LicenseMIT License