{
  "id": 390084,
  "title": "What is ROWS_PER_FRAME in provided function ?",
  "url": "/competitions/asl-signs/discussion/390084",
  "author_name": "",
  "post_date": "2023-02-24T03:42:48.519470300Z",
  "votes": 3,
  "comment_count": 1,
  "views": 0,
  "content": "<p>Each video is loaded with the following function:</p>\n<pre><code> ():\n    data_columns = [, , ]\n    data = pd.read_parquet(pq_path, columns=data_columns)\n    n_frames = ((data) / ROWS_PER_FRAME)\n    data = data.values.reshape(n_frames, ROWS_PER_FRAME, (data_columns))\n     data.astype(np.float32)\n</code></pre>\n<p>Can anyone explain me what is ROWS_PER_FRAME in this function ? </p>\n<p>*edit: I changed few lines of code. Not sure am I correct ?</p>\n<pre><code> ():\n    data_columns = [, , ]\n    df = pd.read_parquet(pq_path)\n    data = df[data_columns]\n    ROWS_PER_FRAME = (df.index) // (df[].unique())\n    n_frames = ((data) / ROWS_PER_FRAME)\n    data = data.values.reshape(n_frames, ROWS_PER_FRAME, (data_columns))\n     data.astype(np.float32)\n</code></pre>\n<p>With </p>\n<pre><code>participant_id = \n\nsequence_id = \n\nparquet_filepath = \n\nload_relevant_data_subset(parquet_filepath)\n</code></pre>\n<p>This give me this output:</p>\n<pre><code>array([[[ 0.49440014,  0.38046983, -0.03062646],\n\n        [ 0.49601725,  0.3507348 , -0.05756483],\n\n        [ 0.5008185 ,  0.35934305, -0.03028346],\n\n        ...,\n\n        [ 0.31373617,  0.41234398, -0.05269891],\n\n        [ 0.35072815,  0.39958185, -0.06021732],\n\n        [ 0.38579622,  0.4011007 , -0.06471767]],\n\n       [[ 0.5011503 ,  0.38055426, -0.03156953],\n\n        [ 0.49290648,  0.3493601 , -0.05817606],\n\n        [ 0.49832708,  0.3581275 , -0.03118932],\n\n        ...,\n\n        [ 0.33588555,  0.3889878 , -0.0631762 ],\n\n        [ 0.37742943,  0.3802519 , -0.07176355],\n\n        [ 0.41639116,  0.38289747, -0.076529  ]],\n\n       [[ 0.49847096,  0.37949273, -0.0309729 ],\n\n        [ 0.49176967,  0.34847346, -0.05721497],\n\n        [ 0.49767977,  0.3573629 , -0.03084622],\n\n        ...,\n\n        [ 0.35855788,  0.3844513 , -0.06097187],\n\n        [ 0.4005313 ,  0.37769613, -0.07045607],\n\n        [ 0.43907768,  0.37987   , -0.07860945]],\n\n       ...,\n\n       [[ 0.5357876 ,  0.37571952, -0.04070858],\n\n        [ 0.5371784 ,  0.34479237, -0.06370237],\n\n        [ 0.5389905 ,  0.3552047 , -0.03697387],\n\n        ...,\n\n        [        nan,         nan,         nan],\n\n        [        nan,         nan,         nan],\n\n        [        nan,         nan,         nan]],\n\n       [[ 0.53569597,  0.37659568, -0.04069101],\n        [ 0.53505826,  0.34505755, -0.06355848],\n        [ 0.53723085,  0.35539716, -0.0369088 ],\n        ...,\n        [        nan,         nan,         nan],\n        [        nan,         nan,         nan],\n        [        nan,         nan,         nan]],\n\n       [[ 0.5364163 ,  0.37519765, -0.0414404 ],\n        [ 0.53597146,  0.34245962, -0.06361609],\n        [ 0.5378655 ,  0.35314763, -0.03705885],\n        ...,\n        [ 0.00672346,  0.6650444 , -0.11401682],\n        [-0.01475476,  0.6437988 , -0.12348831],\n        [-0.03181136,  0.62707704, -0.12906739]]], dtype=float32)\n</code></pre>\n<p>Not sure why some x/y/z give me nan.</p>",
  "messages": [
    {
      "id": "2157482",
      "postDate": "02/24/2023 03:42:48",
      "content": "<p>Each video is loaded with the following function:</p>\n<pre><code> ():\n    data_columns = [, , ]\n    data = pd.read_parquet(pq_path, columns=data_columns)\n    n_frames = ((data) / ROWS_PER_FRAME)\n    data = data.values.reshape(n_frames, ROWS_PER_FRAME, (data_columns))\n     data.astype(np.float32)\n</code></pre>\n<p>Can anyone explain me what is ROWS_PER_FRAME in this function ? </p>\n<p>*edit: I changed few lines of code. Not sure am I correct ?</p>\n<pre><code> ():\n    data_columns = [, , ]\n    df = pd.read_parquet(pq_path)\n    data = df[data_columns]\n    ROWS_PER_FRAME = (df.index) // (df[].unique())\n    n_frames = ((data) / ROWS_PER_FRAME)\n    data = data.values.reshape(n_frames, ROWS_PER_FRAME, (data_columns))\n     data.astype(np.float32)\n</code></pre>\n<p>With </p>\n<pre><code>participant_id = \n\nsequence_id = \n\nparquet_filepath = \n\nload_relevant_data_subset(parquet_filepath)\n</code></pre>\n<p>This give me this output:</p>\n<pre><code>array([[[ 0.49440014,  0.38046983, -0.03062646],\n\n        [ 0.49601725,  0.3507348 , -0.05756483],\n\n        [ 0.5008185 ,  0.35934305, -0.03028346],\n\n        ...,\n\n        [ 0.31373617,  0.41234398, -0.05269891],\n\n        [ 0.35072815,  0.39958185, -0.06021732],\n\n        [ 0.38579622,  0.4011007 , -0.06471767]],\n\n       [[ 0.5011503 ,  0.38055426, -0.03156953],\n\n        [ 0.49290648,  0.3493601 , -0.05817606],\n\n        [ 0.49832708,  0.3581275 , -0.03118932],\n\n        ...,\n\n        [ 0.33588555,  0.3889878 , -0.0631762 ],\n\n        [ 0.37742943,  0.3802519 , -0.07176355],\n\n        [ 0.41639116,  0.38289747, -0.076529  ]],\n\n       [[ 0.49847096,  0.37949273, -0.0309729 ],\n\n        [ 0.49176967,  0.34847346, -0.05721497],\n\n        [ 0.49767977,  0.3573629 , -0.03084622],\n\n        ...,\n\n        [ 0.35855788,  0.3844513 , -0.06097187],\n\n        [ 0.4005313 ,  0.37769613, -0.07045607],\n\n        [ 0.43907768,  0.37987   , -0.07860945]],\n\n       ...,\n\n       [[ 0.5357876 ,  0.37571952, -0.04070858],\n\n        [ 0.5371784 ,  0.34479237, -0.06370237],\n\n        [ 0.5389905 ,  0.3552047 , -0.03697387],\n\n        ...,\n\n        [        nan,         nan,         nan],\n\n        [        nan,         nan,         nan],\n\n        [        nan,         nan,         nan]],\n\n       [[ 0.53569597,  0.37659568, -0.04069101],\n        [ 0.53505826,  0.34505755, -0.06355848],\n        [ 0.53723085,  0.35539716, -0.0369088 ],\n        ...,\n        [        nan,         nan,         nan],\n        [        nan,         nan,         nan],\n        [        nan,         nan,         nan]],\n\n       [[ 0.5364163 ,  0.37519765, -0.0414404 ],\n        [ 0.53597146,  0.34245962, -0.06361609],\n        [ 0.5378655 ,  0.35314763, -0.03705885],\n        ...,\n        [ 0.00672346,  0.6650444 , -0.11401682],\n        [-0.01475476,  0.6437988 , -0.12348831],\n        [-0.03181136,  0.62707704, -0.12906739]]], dtype=float32)\n</code></pre>\n<p>Not sure why some x/y/z give me nan.</p>",
      "rawMarkdown": "Each video is loaded with the following function:\n``` python\ndef load_relevant_data_subset(pq_path):\n    data_columns = ['x', 'y', 'z']\n    data = pd.read_parquet(pq_path, columns=data_columns)\n    n_frames = int(len(data) / ROWS_PER_FRAME)\n    data = data.values.reshape(n_frames, ROWS_PER_FRAME, len(data_columns))\n    return data.astype(np.float32)\n```\n\nCan anyone explain me what is ROWS_PER_FRAME in this function ? \n\n*edit: I changed few lines of code. Not sure am I correct ?\n\n```python\ndef load_relevant_data_subset(pq_path):\n    data_columns = ['x', 'y', 'z']\n    df = pd.read_parquet(pq_path)\n    data = df[data_columns]\n    ROWS_PER_FRAME = len(df.index) // len(df['frame'].unique())\n    n_frames = int(len(data) / ROWS_PER_FRAME)\n    data = data.values.reshape(n_frames, ROWS_PER_FRAME, len(data_columns))\n    return data.astype(np.float32)\n```\n\nWith \n\n```python\n\nparticipant_id = '26734'\n\nsequence_id = '1000035562'\n\nparquet_filepath = f'/kaggle/input/asl-signs/train_landmark_files/{participant_id}/{sequence_id}.parquet'\n\nload_relevant_data_subset(parquet_filepath)\n```\n\nThis give me this output:\n```bash\n\narray([[[ 0.49440014,  0.38046983, -0.03062646],\n\n        [ 0.49601725,  0.3507348 , -0.05756483],\n\n        [ 0.5008185 ,  0.35934305, -0.03028346],\n\n        ...,\n\n        [ 0.31373617,  0.41234398, -0.05269891],\n\n        [ 0.35072815,  0.39958185, -0.06021732],\n\n        [ 0.38579622,  0.4011007 , -0.06471767]],\n\n       [[ 0.5011503 ,  0.38055426, -0.03156953],\n\n        [ 0.49290648,  0.3493601 , -0.05817606],\n\n        [ 0.49832708,  0.3581275 , -0.03118932],\n\n        ...,\n\n        [ 0.33588555,  0.3889878 , -0.0631762 ],\n\n        [ 0.37742943,  0.3802519 , -0.07176355],\n\n        [ 0.41639116,  0.38289747, -0.076529  ]],\n\n       [[ 0.49847096,  0.37949273, -0.0309729 ],\n\n        [ 0.49176967,  0.34847346, -0.05721497],\n\n        [ 0.49767977,  0.3573629 , -0.03084622],\n\n        ...,\n\n        [ 0.35855788,  0.3844513 , -0.06097187],\n\n        [ 0.4005313 ,  0.37769613, -0.07045607],\n\n        [ 0.43907768,  0.37987   , -0.07860945]],\n\n       ...,\n\n       [[ 0.5357876 ,  0.37571952, -0.04070858],\n\n        [ 0.5371784 ,  0.34479237, -0.06370237],\n\n        [ 0.5389905 ,  0.3552047 , -0.03697387],\n\n        ...,\n\n        [        nan,         nan,         nan],\n\n        [        nan,         nan,         nan],\n\n        [        nan,         nan,         nan]],\n\n       [[ 0.53569597,  0.37659568, -0.04069101],\n        [ 0.53505826,  0.34505755, -0.06355848],\n        [ 0.53723085,  0.35539716, -0.0369088 ],\n        ...,\n        [        nan,         nan,         nan],\n        [        nan,         nan,         nan],\n        [        nan,         nan,         nan]],\n\n       [[ 0.5364163 ,  0.37519765, -0.0414404 ],\n        [ 0.53597146,  0.34245962, -0.06361609],\n        [ 0.5378655 ,  0.35314763, -0.03705885],\n        ...,\n        [ 0.00672346,  0.6650444 , -0.11401682],\n        [-0.01475476,  0.6437988 , -0.12348831],\n        [-0.03181136,  0.62707704, -0.12906739]]], dtype=float32)\n```\n\nNot sure why some x/y/z give me nan.",
      "votes": null
    },
    {
      "id": "2157508",
      "postDate": "02/24/2023 04:35:35",
      "content": "<p>ROWS_PER_FRAME is the number of landmarks we attempt to capture per frame, or 543. I've added that to the evaluation tab for clarity.</p>\n<p>It's expected that many of the landmarks will be null for any given frame. The most common reason is if the associated body part simply wasn't visible at the time, which is often the case for at least one hand.</p>",
      "rawMarkdown": "ROWS_PER_FRAME is the number of landmarks we attempt to capture per frame, or 543. I've added that to the evaluation tab for clarity.\n\nIt's expected that many of the landmarks will be null for any given frame. The most common reason is if the associated body part simply wasn't visible at the time, which is often the case for at least one hand.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2157508,
      "author_name": "sohier",
      "author_url": "",
      "post_date": "02/24/2023 04:35:35",
      "content": "<p>ROWS_PER_FRAME is the number of landmarks we attempt to capture per frame, or 543. I've added that to the evaluation tab for clarity.</p>\n<p>It's expected that many of the landmarks will be null for any given frame. The most common reason is if the associated body part simply wasn't visible at the time, which is often the case for at least one hand.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2157482": "Each video is loaded with the following function:\n``` python\ndef load_relevant_data_subset(pq_path):\n    data_columns = ['x', 'y', 'z']\n    data = pd.read_parquet(pq_path, columns=data_columns)\n    n_frames = int(len(data) / ROWS_PER_FRAME)\n    data = data.values.reshape(n_frames, ROWS_PER_FRAME, len(data_columns))\n    return data.astype(np.float32)\n```\n\nCan anyone explain me what is ROWS_PER_FRAME in this function ? \n\n*edit: I changed few lines of code. Not sure am I correct ?\n\n```python\ndef load_relevant_data_subset(pq_path):\n    data_columns = ['x', 'y', 'z']\n    df = pd.read_parquet(pq_path)\n    data = df[data_columns]\n    ROWS_PER_FRAME = len(df.index) // len(df['frame'].unique())\n    n_frames = int(len(data) / ROWS_PER_FRAME)\n    data = data.values.reshape(n_frames, ROWS_PER_FRAME, len(data_columns))\n    return data.astype(np.float32)\n```\n\nWith \n\n```python\n\nparticipant_id = '26734'\n\nsequence_id = '1000035562'\n\nparquet_filepath = f'/kaggle/input/asl-signs/train_landmark_files/{participant_id}/{sequence_id}.parquet'\n\nload_relevant_data_subset(parquet_filepath)\n```\n\nThis give me this output:\n```bash\n\narray([[[ 0.49440014,  0.38046983, -0.03062646],\n\n        [ 0.49601725,  0.3507348 , -0.05756483],\n\n        [ 0.5008185 ,  0.35934305, -0.03028346],\n\n        ...,\n\n        [ 0.31373617,  0.41234398, -0.05269891],\n\n        [ 0.35072815,  0.39958185, -0.06021732],\n\n        [ 0.38579622,  0.4011007 , -0.06471767]],\n\n       [[ 0.5011503 ,  0.38055426, -0.03156953],\n\n        [ 0.49290648,  0.3493601 , -0.05817606],\n\n        [ 0.49832708,  0.3581275 , -0.03118932],\n\n        ...,\n\n        [ 0.33588555,  0.3889878 , -0.0631762 ],\n\n        [ 0.37742943,  0.3802519 , -0.07176355],\n\n        [ 0.41639116,  0.38289747, -0.076529  ]],\n\n       [[ 0.49847096,  0.37949273, -0.0309729 ],\n\n        [ 0.49176967,  0.34847346, -0.05721497],\n\n        [ 0.49767977,  0.3573629 , -0.03084622],\n\n        ...,\n\n        [ 0.35855788,  0.3844513 , -0.06097187],\n\n        [ 0.4005313 ,  0.37769613, -0.07045607],\n\n        [ 0.43907768,  0.37987   , -0.07860945]],\n\n       ...,\n\n       [[ 0.5357876 ,  0.37571952, -0.04070858],\n\n        [ 0.5371784 ,  0.34479237, -0.06370237],\n\n        [ 0.5389905 ,  0.3552047 , -0.03697387],\n\n        ...,\n\n        [        nan,         nan,         nan],\n\n        [        nan,         nan,         nan],\n\n        [        nan,         nan,         nan]],\n\n       [[ 0.53569597,  0.37659568, -0.04069101],\n        [ 0.53505826,  0.34505755, -0.06355848],\n        [ 0.53723085,  0.35539716, -0.0369088 ],\n        ...,\n        [        nan,         nan,         nan],\n        [        nan,         nan,         nan],\n        [        nan,         nan,         nan]],\n\n       [[ 0.5364163 ,  0.37519765, -0.0414404 ],\n        [ 0.53597146,  0.34245962, -0.06361609],\n        [ 0.5378655 ,  0.35314763, -0.03705885],\n        ...,\n        [ 0.00672346,  0.6650444 , -0.11401682],\n        [-0.01475476,  0.6437988 , -0.12348831],\n        [-0.03181136,  0.62707704, -0.12906739]]], dtype=float32)\n```\n\nNot sure why some x/y/z give me nan.",
    "2157508": "ROWS_PER_FRAME is the number of landmarks we attempt to capture per frame, or 543. I've added that to the evaluation tab for clarity.\n\nIt's expected that many of the landmarks will be null for any given frame. The most common reason is if the associated body part simply wasn't visible at the time, which is often the case for at least one hand."
  },
  "source": "meta"
}