Skip to content

'KeyError: Property timeUnit does not exist in this annotation' when running on SWF v7.4 MMIF #7

@ledibr

Description

@ledibr

Bug Description

When running doctr-wrapper with an MMIF generated by the CLAMS SWT v7.4 wrapper, the application encounters an annotation error while processing a video time frame. The video_document_helper utility fails to retrieve the timeUnit property of the given time frame, resulting in a KeyError with the message 'Property timeUnit does not exist in this annotation.'

Reproduction steps

  1. Connect to lab machine using SSH.
  2. Activate conda environment.
  3. Select desired mp4 and MMIF file. The files I encountered this error with were cpb-aacip-225-65v6x41w.mp4 and its associated MMIF cpb-aacip-225-65v6x41w_HI_pass2_candidates_1.mmif.
  4. Run doctr-wrapper with podman run --device nvidia.com/gpu=all --security-opt=label=disable --name doctr -it -e TRITON_LIBCUDA_PATH=/lib64/libcuda.so.1 -v <DIR1>:<DIR2> -p <PORT>:5000 <IMAGE_NAME> python3 app.py
  5. Send the MMIF to the app server with curl -H "Accept: application/json" -X POST -d@<FILE_NAME>.mmif -s 'http://localhost:<PORT>?pretty=True&runningTime=True'
  6. See error in console output.

Expected behavior

The application should be able to successfully extract the timeUnit property and proceed with the annotation.

Log output

2025-06-20 00:38:32 http://apps.clams.ai/doctr-wrapper DEBUG    140111653828288 Found a time frame "v_1:tf_1" of label: "chyron"
2025-06-20 00:38:32 http://apps.clams.ai/doctr-wrapper DEBUG    140111653828288 Processing time frame "v_1:tf_1"
2025-06-20 00:38:35 http://apps.clams.ai/doctr-wrapper ERROR    140111653828288 Error in annotation
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/clams/restify/__init__.py", line 146, in post
    return self.json_to_response(self.cla.annotate(raw_data, **raw_params))
  File "/usr/local/lib/python3.8/site-packages/clams/app/__init__.py", line 151, in annotate
    annotated = self._annotate(mmif, **refined)
  File "/app/app.py", line 149, in _annotate
    timestamp, text_content = self.process_time_annotation(mmif, timeframe, new_view, video_doc)
  File "/app/app.py", line 77, in process_time_annotation
    image: np.ndarray = vdh.extract_mid_frame(mmif, representative, as_PIL=False)
  File "/usr/local/lib/python3.8/site-packages/mmif/utils/video_document_helper.py", line 127, in extract_mid_frame
    return extract_frames_as_images(vd, [get_mid_framenum(mmif, time_frame)], as_PIL=as_PIL)[0]
  File "/usr/local/lib/python3.8/site-packages/mmif/utils/video_document_helper.py", line 111, in get_mid_framenum
    timeunit = time_frame.get_property('timeUnit')
  File "/usr/local/lib/python3.8/site-packages/mmif/serialize/annotation.py", line 235, in get
    raise KeyError(f"Property {prop_name} does not exist in this annotation.")
KeyError: 'Property timeUnit does not exist in this annotation.'

Screenshots

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛BSomething isn't working

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions