You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run the app-east-textdetection with an input mmif file that has view that contains timeframe annotation, it returns the following error:
Traceback (most recent call last):
File "/home/zixinjiang/east/lib64/python3.9/site-packages/clams/restify/__init__.py", line 146, in post
return self.json_to_response(self.cla.annotate(raw_data, **raw_params))
File "/home/zixinjiang/east/lib64/python3.9/site-packages/clams/app/__init__.py", line 151, in annotate
annotated = self._annotate(mmif, **refined)
File "/home/zixinjiang/app-east-textdetection/app.py", line 46, in _annotate
mmif = self.run_on_video(mmif, videodocument, new_view, **parameters)
File "/home/zixinjiang/app-east-textdetection/app.py", line 105, in run_on_video
target_frames.update(*[np.linspace(*vdh.convert_timeframe(mmif, a, 'frame'), 2, dtype=int)
File "/home/zixinjiang/app-east-textdetection/app.py", line 105, in <listcomp>
target_frames.update(*[np.linspace(*vdh.convert_timeframe(mmif, a, 'frame'), 2, dtype=int)
File "/home/zixinjiang/east/lib64/python3.9/site-packages/mmif/utils/video_document_helper.py", line 224, in convert_timeframe
in_unit = time_frame.get_property('timeUnit')
File "/home/zixinjiang/east/lib64/python3.9/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.'
This kind of error also happens with the Property Document.
This is because the app code uses the function video_document_helper.convert_timeframe(mmif: Mmif, time_frame: Annotation, out_unit: str) from mmif utils package. In the implementation code of this function, there are these two lines of code:
These two lines of code require the property 'timeUnit' and 'document' from the metadata of the timeframe annotation. However, in the implementation of certain clams apps, they don't have the code that adds the above properties to the timeframe's type matedata. For example, instead of using new_view.new_contain(AnnotationTypes.TimeFrame, timeUnit="milliseconds", document=doc.long_id), they don't use view.new_contain function or don't add these two property when using v.new_annotation(AnnotationTypes.TimeFrame) and view.new_contain. This would cause the function time_frame.get_property() to fail to get the properties 'timeUnit' and 'document', and consequentially causes the function vdh.convert_timeframe() to fail.
In short, some clams apps lack key information in the output mmif files due to old versions or neglect during development, which causes the failure in running certain mmif-python functions with the output mmif files. Standardizing the Clams app development process may be a good idea.
The text was updated successfully, but these errors were encountered:
When I run the app-east-textdetection with an input mmif file that has view that contains timeframe annotation, it returns the following error:
This kind of error also happens with the Property Document.
This is because the app code uses the function video_document_helper.convert_timeframe(mmif: Mmif, time_frame: Annotation, out_unit: str) from mmif utils package. In the implementation code of this function, there are these two lines of code:
These two lines of code require the property 'timeUnit' and 'document' from the metadata of the timeframe annotation. However, in the implementation of certain clams apps, they don't have the code that adds the above properties to the timeframe's type matedata. For example, instead of using
new_view.new_contain(AnnotationTypes.TimeFrame, timeUnit="milliseconds", document=doc.long_id)
, they don't useview.new_contain
function or don't add these two property when usingv.new_annotation(AnnotationTypes.TimeFrame)
andview.new_contain
. This would cause the functiontime_frame.get_property()
to fail to get the properties 'timeUnit' and 'document', and consequentially causes the functionvdh.convert_timeframe()
to fail.In short, some clams apps lack key information in the output mmif files due to old versions or neglect during development, which causes the failure in running certain mmif-python functions with the output mmif files. Standardizing the Clams app development process may be a good idea.
The text was updated successfully, but these errors were encountered: