Skip to content

Commit

Permalink
Merge pull request #56 from clamsproject/develop
Browse files Browse the repository at this point in the history
Removing a fatal error in 2.0 and adding timeUnit
  • Loading branch information
marcverhagen authored Jan 25, 2024
2 parents f58a949 + 297873f commit 29b0ca9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ def _annotate(self, mmif: Union[str, dict, Mmif], **parameters) -> Mmif:
predictions = self.classifier.process_video(vd.location)
timeframes = self.stitcher.create_timeframes(predictions)

new_view.new_contain(AnnotationTypes.TimeFrame, document=vd.id)
new_view.new_contain(
AnnotationTypes.TimeFrame, document=vd.id, timeUnit='milliseconds')
for tf in timeframes:
timeframe_annotation = new_view.new_annotation(AnnotationTypes.TimeFrame)
timeframe_annotation.add_property("start", tf.start)
Expand Down
2 changes: 1 addition & 1 deletion metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def appmetadata() -> AppMetadata:
)

metadata.add_input(DocumentTypes.VideoDocument, required=True)
metadata.add_output(AnnotationTypes.TimeFrame)
metadata.add_output(AnnotationTypes.TimeFrame, timeUnit='milliseconds')

# TODO: defaults are the same as in modeling/config/classifier.yml, which is possibly
# not a great idea, should perhaps read defaults from the configuration file. There is
Expand Down
2 changes: 1 addition & 1 deletion modeling/classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def process_video(self, mp4_file: str) -> list:
logging.info(f'processing {mp4_file}...')
predictions = []
vidcap = cv2.VideoCapture(mp4_file)
if vidcap.isOpened():
if not vidcap.isOpened():
raise IOError(f'Could not open {mp4_file}')
fps = round(vidcap.get(cv2.CAP_PROP_FPS), 2)
fc = vidcap.get(cv2.CAP_PROP_FRAME_COUNT)
Expand Down

0 comments on commit 29b0ca9

Please sign in to comment.