{"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":"#Import package\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport os\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport pprint\nfrom tqdm import tqdm","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-03-05T06:40:31.425557Z","iopub.execute_input":"2023-03-05T06:40:31.426079Z","iopub.status.idle":"2023-03-05T06:40:31.432569Z","shell.execute_reply.started":"2023-03-05T06:40:31.426033Z","shell.execute_reply":"2023-03-05T06:40:31.431551Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"asl_signs_path='/kaggle/input/asl-signs'","metadata":{"execution":{"iopub.status.busy":"2023-03-05T06:44:07.991076Z","iopub.execute_input":"2023-03-05T06:44:07.991561Z","iopub.status.idle":"2023-03-05T06:44:07.997973Z","shell.execute_reply.started":"2023-03-05T06:44:07.991518Z","shell.execute_reply":"2023-03-05T06:44:07.996495Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Load traning data from CSV file","metadata":{}},{"cell_type":"code","source":"#Read CSV file\ntrain_df = pd.read_csv('/kaggle/input/asl-signs/train.csv')","metadata":{"execution":{"iopub.status.busy":"2023-03-05T06:33:12.609756Z","iopub.execute_input":"2023-03-05T06:33:12.610246Z","iopub.status.idle":"2023-03-05T06:33:12.841390Z","shell.execute_reply.started":"2023-03-05T06:33:12.610205Z","shell.execute_reply":"2023-03-05T06:33:12.840126Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#get shape of training data\ntrain_df.shape","metadata":{"execution":{"iopub.status.busy":"2023-03-05T06:33:15.241058Z","iopub.execute_input":"2023-03-05T06:33:15.241512Z","iopub.status.idle":"2023-03-05T06:33:15.251930Z","shell.execute_reply.started":"2023-03-05T06:33:15.241472Z","shell.execute_reply":"2023-03-05T06:33:15.250275Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.head(10)","metadata":{"execution":{"iopub.status.busy":"2023-03-05T06:33:17.953617Z","iopub.execute_input":"2023-03-05T06:33:17.955034Z","iopub.status.idle":"2023-03-05T06:33:17.989497Z","shell.execute_reply.started":"2023-03-05T06:33:17.954976Z","shell.execute_reply":"2023-03-05T06:33:17.988386Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.dtypes","metadata":{"execution":{"iopub.status.busy":"2023-03-05T06:33:20.754979Z","iopub.execute_input":"2023-03-05T06:33:20.756032Z","iopub.status.idle":"2023-03-05T06:33:20.765633Z","shell.execute_reply.started":"2023-03-05T06:33:20.755968Z","shell.execute_reply":"2023-03-05T06:33:20.764423Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"gb = train_df.groupby(['sign'])['participant_id'].count()\n#gb['sequence_id'].count().plot(kind = \"bar\", legend=True)\nsns.set_theme(style=\"whitegrid\")\nf, ax = plt.subplots(figsize=(15, 50))\nsns.barplot( y = gb.index, x = gb.values, orient='h')\nax.set_title(\"Count of dataset for each sign\")","metadata":{"execution":{"iopub.status.busy":"2023-03-05T06:34:04.604649Z","iopub.execute_input":"2023-03-05T06:34:04.605186Z","iopub.status.idle":"2023-03-05T06:34:09.073178Z","shell.execute_reply.started":"2023-03-05T06:34:04.605136Z","shell.execute_reply":"2023-03-05T06:34:09.071757Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"gb = train_df.groupby(['participant_id','sign'])['path'].count()\ngb","metadata":{"execution":{"iopub.status.busy":"2023-03-05T06:52:21.659901Z","iopub.execute_input":"2023-03-05T06:52:21.660355Z","iopub.status.idle":"2023-03-05T06:52:21.700495Z","shell.execute_reply.started":"2023-03-05T06:52:21.660318Z","shell.execute_reply":"2023-03-05T06:52:21.698872Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Load Landmark data","metadata":{}},{"cell_type":"code","source":"#Read data\nsigns_df=pd.read_parquet('/kaggle/input/asl-signs/train_landmark_files/16069/1007343357.parquet')","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"signs_df.head(10)","metadata":{"execution":{"iopub.status.busy":"2023-03-05T06:52:26.042866Z","iopub.execute_input":"2023-03-05T06:52:26.044387Z","iopub.status.idle":"2023-03-05T06:52:26.063659Z","shell.execute_reply.started":"2023-03-05T06:52:26.044319Z","shell.execute_reply":"2023-03-05T06:52:26.061956Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"signs_df.describe()","metadata":{"execution":{"iopub.status.busy":"2023-03-05T06:52:28.969124Z","iopub.execute_input":"2023-03-05T06:52:28.969590Z","iopub.status.idle":"2023-03-05T06:52:29.007769Z","shell.execute_reply.started":"2023-03-05T06:52:28.969548Z","shell.execute_reply":"2023-03-05T06:52:29.006489Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#frame list \nsigns_df['frame'].unique()","metadata":{"execution":{"iopub.status.busy":"2023-03-05T06:52:31.436808Z","iopub.execute_input":"2023-03-05T06:52:31.437316Z","iopub.status.idle":"2023-03-05T06:52:31.446614Z","shell.execute_reply.started":"2023-03-05T06:52:31.437272Z","shell.execute_reply":"2023-03-05T06:52:31.445171Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(signs_df['frame'].unique())","metadata":{"execution":{"iopub.status.busy":"2023-03-05T06:54:33.946495Z","iopub.execute_input":"2023-03-05T06:54:33.947063Z","iopub.status.idle":"2023-03-05T06:54:33.956749Z","shell.execute_reply.started":"2023-03-05T06:54:33.947017Z","shell.execute_reply":"2023-03-05T06:54:33.955413Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"gb = signs_df[signs_df['frame']==25].groupby(['type'])['landmark_index'].count()\n#sns.set_theme(style=\"whitegrid\")\nf, ax = plt.subplots(figsize=(15, 5))\nsns.barplot( y = gb.index, x = gb.values, orient='h')\nax.set_title(\"Landmark count for each type:\")\nprint('Landmark count for each type:')\ngb","metadata":{"execution":{"iopub.status.busy":"2023-03-05T06:54:41.112393Z","iopub.execute_input":"2023-03-05T06:54:41.112890Z","iopub.status.idle":"2023-03-05T06:54:41.429360Z","shell.execute_reply.started":"2023-03-05T06:54:41.112847Z","shell.execute_reply":"2023-03-05T06:54:41.428115Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### So, each frame has 543 records","metadata":{}},{"cell_type":"code","source":"#Data count in each frame\nsigns_df[signs_df['frame']==25]","metadata":{"execution":{"iopub.status.busy":"2023-03-05T06:54:44.710228Z","iopub.execute_input":"2023-03-05T06:54:44.710691Z","iopub.status.idle":"2023-03-05T06:54:44.734887Z","shell.execute_reply.started":"2023-03-05T06:54:44.710653Z","shell.execute_reply":"2023-03-05T06:54:44.733176Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Find max frame count","metadata":{}},{"cell_type":"code","source":"max_frame_count = 0\nfor t_indx,t_row in tqdm(train_df.iterrows(), total=train_df.shape[0]):\n    #print(t_row)\n    path = os.path.join(asl_signs_path,t_row['path'])\n    signs_df=pd.read_parquet(path)\n    max_frame_count = max(max_frame_count,len(signs_df['frame'].unique()))\nprint(\"max_frame_count : \", max_frame_count)","metadata":{"execution":{"iopub.status.busy":"2023-03-05T06:56:00.325552Z","iopub.execute_input":"2023-03-05T06:56:00.326460Z","iopub.status.idle":"2023-03-05T07:38:50.364367Z","shell.execute_reply.started":"2023-03-05T06:56:00.326410Z","shell.execute_reply":"2023-03-05T07:38:50.362108Z"},"trusted":true},"execution_count":null,"outputs":[]}]}