{"cells":[{"metadata":{},"cell_type":"markdown","source":"# About Competition\n- **Objective**: build a model to classify cloud organization patterns from satellite images.\n- **Evaluation**: This competition is evaluated on the mean [Dice coefficient](https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient).\n- The leaderboard score is the mean of the Dice coefficients for each <Image, Label> pair in the test set.\n- The pixels are numbered from top to bottom, then left to right: 1 is pixel (1,1), 2 is pixel (2,1), etc.\n- While the images in Train and Test are 1400 x 2100 pixels, the predictions should be scaled down to a 350 x 525 pixel image.\n- **Submission** \n    - file should be in csv format, with a header and columns names : **Image_Label, EncodedPixels**.\n    - Each row represents a single predicted cloud type segmentation for the given Image, and predicted Label\n    - Should have the the same number of rows as **num_images * num_labels**.\n    - Encode segment for cloud type in an image into a single row, even if there are several non-contiguous cloud type locations.\n    - If there is no area of a certain cloud type for an image, the corresponding EncodedPixels prediction should be left blank.\n- For each image in the test set, segment the regions of each cloud formation label (Fish, Flower, Gravel, Sugar). Each image has at least one cloud formation, and can possibly contain up to all all four.\n- **Data**\n    - An image might be stitched together from two orbits. The remaining area, which has not been covered by two succeeding orbits, is marked black.\n    - **train.csv** contains the run length encoded segmentations for each image-label pair in the train_images\n- Task is to predict the segmentations masks of each of the 4 cloud types (labels) for each image. (Your prediction masks should be scaled down to 350 x 525 px).\n\n# Notes\n- Shallow clouds play a huge role in determining the Earth's climate."},{"metadata":{"trusted":true},"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport os, random","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"! ls '/kaggle/input/understanding_cloud_organization'","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"Data_dir = \"/kaggle/input/understanding_cloud_organization/\"\n\nprint(\"There are {} Training images\".format(len(os.listdir(Data_dir + 'train_images'))))\nprint(\"There are {} Testing images\".format(len(os.listdir(Data_dir + 'test_images'))))","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"train_df = pd.read_csv(Data_dir + \"train.csv\")\ntrain_df.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train_df[['Image', 'Label']] = train_df['Image_Label'].str.split('_', expand=True)\ntrain_df.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"# There are 4 Lables for each image, but some have EncodedPixels and some don't\ntrain_df.groupby(\"Image\").count().head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"train_df.isnull().sum()\n# If a label is present then it's encodedPixels is given, if not it's NaN","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","collapsed":true,"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","trusted":false},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"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":4,"nbformat_minor":1}