{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_kg_hide-input":true,"_kg_hide-output":true,"execution":{"iopub.status.busy":"2022-08-15T18:06:07.377704Z","iopub.execute_input":"2022-08-15T18:06:07.378184Z","iopub.status.idle":"2022-08-15T18:06:17.669079Z","shell.execute_reply.started":"2022-08-15T18:06:07.378082Z","shell.execute_reply":"2022-08-15T18:06:17.667441Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#FastDup - A tool for gaining insights from a large image collection\n\n\"Large Image Datasets Today are a Mess | Blog Post | Video Tutorial\"\n\n\"FastDup is a tool for gaining insights from a large image collection. It can find anomalies, duplicate and near duplicate images, clusters of similarity, learn the normal behavior and temporal interactions between images. It can be used for smart subsampling of a higher quality dataset, outlier removal, novelty detection of new information to be sent for tagging. FastDup scales to millions of images running on CPU only.\"\n\nFrom the authors of GraphLab and Turi Create.\n\n#FastDup Software, (C) copyright 2022 Dr. Amir Alush and Dr. Danny Bickson.\n\nhttps://github.com/visualdatabase/fastdup","metadata":{}},{"cell_type":"markdown","source":"#Here I learned how to look at different image statistics like bluriness, darkness and image size using fastdup\n\nhttps://github.com/visualdatabase/fastdup/blob/main/examples/fastdup_image_stats.ipynb","metadata":{}},{"cell_type":"code","source":"!pip install -U fastdup","metadata":{"execution":{"iopub.status.busy":"2022-08-15T18:06:54.512362Z","iopub.execute_input":"2022-08-15T18:06:54.512799Z","iopub.status.idle":"2022-08-15T18:07:09.843506Z","shell.execute_reply.started":"2022-08-15T18:06:54.512753Z","shell.execute_reply":"2022-08-15T18:07:09.842160Z"},"_kg_hide-output":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import fastdup\nfastdup.__version__","metadata":{"execution":{"iopub.status.busy":"2022-08-15T18:07:31.251902Z","iopub.execute_input":"2022-08-15T18:07:31.252375Z","iopub.status.idle":"2022-08-15T18:07:32.082215Z","shell.execute_reply.started":"2022-08-15T18:07:31.252333Z","shell.execute_reply":"2022-08-15T18:07:32.081282Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!ls /kaggle/input/be-honest-what-do-you-think-of-this-image/","metadata":{"execution":{"iopub.status.busy":"2022-08-15T18:07:49.474165Z","iopub.execute_input":"2022-08-15T18:07:49.474652Z","iopub.status.idle":"2022-08-15T18:07:50.550497Z","shell.execute_reply.started":"2022-08-15T18:07:49.474609Z","shell.execute_reply":"2022-08-15T18:07:50.549012Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fastdup.run('/kaggle/input/be-honest-what-do-you-think-of-this-image/images', work_dir='out')","metadata":{"execution":{"iopub.status.busy":"2022-08-15T18:08:58.479149Z","iopub.execute_input":"2022-08-15T18:08:58.479652Z","iopub.status.idle":"2022-08-15T18:15:44.271038Z","shell.execute_reply.started":"2022-08-15T18:08:58.479606Z","shell.execute_reply":"2022-08-15T18:15:44.269095Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#The most blurry images","metadata":{}},{"cell_type":"code","source":"import fastdup\n\nfrom IPython.display import HTML\nfastdup.create_stats_gallery('out/atrain_stats.csv','.',max_width=400,metric='blur',num_images=5)\nHTML('./blur.html')","metadata":{"execution":{"iopub.status.busy":"2022-08-15T18:15:49.447117Z","iopub.execute_input":"2022-08-15T18:15:49.447566Z","iopub.status.idle":"2022-08-15T18:15:50.354099Z","shell.execute_reply.started":"2022-08-15T18:15:49.447531Z","shell.execute_reply":"2022-08-15T18:15:50.352822Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#The sharpest images","metadata":{}},{"cell_type":"code","source":"fastdup.create_stats_gallery('out/atrain_stats.csv','.',max_width=400,metric='blur',descending=True, num_images=5)\nHTML('./blur.html')","metadata":{"execution":{"iopub.status.busy":"2022-08-15T18:16:34.975721Z","iopub.execute_input":"2022-08-15T18:16:34.976176Z","iopub.status.idle":"2022-08-15T18:16:36.000491Z","shell.execute_reply.started":"2022-08-15T18:16:34.976139Z","shell.execute_reply":"2022-08-15T18:16:35.999309Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#The smallest images","metadata":{}},{"cell_type":"code","source":"fastdup.create_stats_gallery('out/atrain_stats.csv','.',max_width=400,metric='size',descending=False, num_images=5)\nHTML('./size.html')","metadata":{"execution":{"iopub.status.busy":"2022-08-15T18:17:56.139517Z","iopub.execute_input":"2022-08-15T18:17:56.140695Z","iopub.status.idle":"2022-08-15T18:17:56.716719Z","shell.execute_reply.started":"2022-08-15T18:17:56.140648Z","shell.execute_reply":"2022-08-15T18:17:56.715670Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#The largest images","metadata":{}},{"cell_type":"code","source":"fastdup.create_stats_gallery('out/atrain_stats.csv','.',max_width=400,metric='size',descending=True, num_images=5)\nHTML('./size.html')","metadata":{"execution":{"iopub.status.busy":"2022-08-15T18:18:48.275474Z","iopub.execute_input":"2022-08-15T18:18:48.276056Z","iopub.status.idle":"2022-08-15T18:18:49.440169Z","shell.execute_reply.started":"2022-08-15T18:18:48.276012Z","shell.execute_reply":"2022-08-15T18:18:49.439060Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#The darkest images","metadata":{}},{"cell_type":"code","source":"fastdup.create_stats_gallery('out/atrain_stats.csv','.',max_width=400,metric='mean',descending=False, num_images=5)\nHTML('./mean.html')","metadata":{"execution":{"iopub.status.busy":"2022-08-15T18:20:01.163842Z","iopub.execute_input":"2022-08-15T18:20:01.164301Z","iopub.status.idle":"2022-08-15T18:20:01.872695Z","shell.execute_reply.started":"2022-08-15T18:20:01.164263Z","shell.execute_reply":"2022-08-15T18:20:01.870906Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#The brightest images","metadata":{}},{"cell_type":"code","source":"fastdup.create_stats_gallery('out/atrain_stats.csv','.',max_width=400,metric='mean',descending=True, num_images=5)\nHTML('./mean.html')","metadata":{"execution":{"iopub.status.busy":"2022-08-15T18:20:55.180122Z","iopub.execute_input":"2022-08-15T18:20:55.180666Z","iopub.status.idle":"2022-08-15T18:20:55.858714Z","shell.execute_reply.started":"2022-08-15T18:20:55.180607Z","shell.execute_reply":"2022-08-15T18:20:55.857353Z"},"_kg_hide-input":true,"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Unique image report","metadata":{}},{"cell_type":"code","source":"fastdup.create_stats_gallery('out/atrain_stats.csv','.',max_width=400,metric='unique',descending=True, num_images=5)\nHTML('./unique.html')","metadata":{"execution":{"iopub.status.busy":"2022-08-15T18:22:15.577749Z","iopub.execute_input":"2022-08-15T18:22:15.578262Z","iopub.status.idle":"2022-08-15T18:22:16.248440Z","shell.execute_reply.started":"2022-08-15T18:22:15.578224Z","shell.execute_reply":"2022-08-15T18:22:16.247154Z"},"_kg_hide-input":true,"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#STDV Image report","metadata":{}},{"cell_type":"code","source":"fastdup.create_stats_gallery('out/atrain_stats.csv','.',max_width=400,metric='stdv',descending=False, num_images=5)\nHTML('./stdv.html')","metadata":{"execution":{"iopub.status.busy":"2022-08-15T18:23:28.848821Z","iopub.execute_input":"2022-08-15T18:23:28.849309Z","iopub.status.idle":"2022-08-15T18:23:29.489835Z","shell.execute_reply.started":"2022-08-15T18:23:28.849274Z","shell.execute_reply":"2022-08-15T18:23:29.488832Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Acknowledgements:\n\nFastDup Software, (C) copyright 2022 Dr. Amir Alush and Dr. Danny Bickson.\n\nFastDup https://github.com/visualdatabase/fastdup\n\nhttps://wordpress.org/plugins/fastdup/\n\nhttps://github.com/visualdatabase/fastdup/blob/main/examples/getting_started_kaggle.ipynb\n\nhttps://www.kaggle.com/code/graphlab/fastdup\n\nCompetition Host Jean-Michel D. @jeanmidev: Be honest, What do you think of this image?\nEvaluate the interest of your submission to Unsplash\n\nhttps://www.kaggle.com/datasets/keithpinson/butterfly-mimics-2022\n\nHappy Cloning! Happy Kaggling!","metadata":{}}]}