clamsproject / app-swt-detection

CLAMS app for detecting scenes with text from video input
Apache License 2.0
1 stars 0 forks source link

sampled timepoint gaps are vastly off from set frame sample rate #90

Closed keighrim closed 7 months ago

keighrim commented 7 months ago

Bug Description

When calling the app with a sampling rate of 1000 ms (default value), the output TimePoint are actually annotating frames sampled at ~967 due to the loss of decimal point precision in the upstream SDK code. This was introduced in 1953baba9a86ba3f8cdd026da06ce6208e7a3ecc and only v4.2 is affected.

Reproduction steps

Here's an example MMIF output snippet


      "annotations": [
        {
          "@type": "http://mmif.clams.ai/vocabulary/TimePoint/v2",
          "properties": {
            "timePoint": 0,
            "label": "B",
            "classification": {
                ...
            },
            "id": "tp_1"
          }
        },
        {
          "@type": "http://mmif.clams.ai/vocabulary/TimePoint/v2",
          "properties": {
            "timePoint": 967,
            "label": "B",
            "classification": {
                ...
            },
            "id": "tp_2"
          }
        },
        {
          "@type": "http://mmif.clams.ai/vocabulary/TimePoint/v2",
          "properties": {
            "timePoint": 1935,
            "label": "B",
            "classification": {
                ...
            },
            "id": "tp_3"
          }
        },
        {
          "@type": "http://mmif.clams.ai/vocabulary/TimePoint/v2",
          "properties": {
            "timePoint": 2902,
            "label": "B",
            "classification": {
                ...
            },
            "id": "tp_4"
          }
        },
        {
          "@type": "http://mmif.clams.ai/vocabulary/TimePoint/v2",
          "properties": {
            "timePoint": 3870,
            "label": "B",
            "classification": {
                ...
            },
            "id": "tp_5"
          }
        },

Expected behavior

No response

Log output

No response

Screenshots

No response

Additional context

new version of mmif-python (1.0.13) includes a patch to support sample frames with fractional sampling rate (directly re-using video FPS value)