{"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","execution":{"iopub.status.busy":"2022-04-10T14:10:43.778752Z","iopub.execute_input":"2022-04-10T14:10:43.778997Z","iopub.status.idle":"2022-04-10T14:11:16.75075Z","shell.execute_reply.started":"2022-04-10T14:10:43.77897Z","shell.execute_reply":"2022-04-10T14:11:16.74779Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd\nimport numpy as np\n%matplotlib inline\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport tqdm","metadata":{"execution":{"iopub.status.busy":"2022-04-10T23:59:27.255427Z","iopub.execute_input":"2022-04-10T23:59:27.255713Z","iopub.status.idle":"2022-04-10T23:59:27.26276Z","shell.execute_reply.started":"2022-04-10T23:59:27.255686Z","shell.execute_reply":"2022-04-10T23:59:27.261611Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df=pd.read_csv(\"../input/tensorflow-great-barrier-reef/train.csv\")\ndf","metadata":{"execution":{"iopub.status.busy":"2022-04-10T23:59:32.371622Z","iopub.execute_input":"2022-04-10T23:59:32.37199Z","iopub.status.idle":"2022-04-10T23:59:32.4282Z","shell.execute_reply.started":"2022-04-10T23:59:32.371966Z","shell.execute_reply":"2022-04-10T23:59:32.4274Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df[\"video_id\"].plot.hist()","metadata":{"execution":{"iopub.status.busy":"2022-04-10T23:53:17.482356Z","iopub.execute_input":"2022-04-10T23:53:17.4827Z","iopub.status.idle":"2022-04-10T23:53:17.697208Z","shell.execute_reply.started":"2022-04-10T23:53:17.482667Z","shell.execute_reply":"2022-04-10T23:53:17.696283Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#バウンディングボックスの有無で分類\nannot=[]\nfor i  in df[\"annotations\"]:\n    if i==\"[]\": annot.append(1)\n    else:annot.append(0)\n\nannot_True = annot.count(1)\nannot_False = annot.count(0)\n\nprint(annot_True)\nprint(annot_False)\n\n#dfにボックスの有無を追加\ndf[\"bounding_box_or_not\"] = annot\n\ndf","metadata":{"execution":{"iopub.status.busy":"2022-04-10T23:53:17.699928Z","iopub.execute_input":"2022-04-10T23:53:17.700927Z","iopub.status.idle":"2022-04-10T23:53:17.729092Z","shell.execute_reply.started":"2022-04-10T23:53:17.700874Z","shell.execute_reply":"2022-04-10T23:53:17.727695Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# converting string annotations into list\ndf['annotations'] =df['annotations'].apply(eval)\n########################################################################\n\n#counting number of bounding boxes in each img  and adding it to new variable no_of_boundingBox\n\nno_of_BoundingBox=[]\nfor i in tqdm(df[\"annotations\"]):\n    no_of_BoundingBox.append(len(i))\ndf[\"no_of_BoundingBox\"]=no_of_BoundingBox\n#######################################################################\n\n#plot histogram\nsns.countplot(df[\"no_of_BoundingBox\"])","metadata":{"execution":{"iopub.status.busy":"2022-04-10T23:53:17.73089Z","iopub.execute_input":"2022-04-10T23:53:17.731131Z","iopub.status.idle":"2022-04-10T23:53:17.983747Z","shell.execute_reply.started":"2022-04-10T23:53:17.731102Z","shell.execute_reply":"2022-04-10T23:53:17.982583Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}