-
Notifications
You must be signed in to change notification settings - Fork 1
/
metadata.py
64 lines (51 loc) · 2.39 KB
/
metadata.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"""
The purpose of this file is to define the metadata of the app with minimal imports.
DO NOT CHANGE the name of the file
"""
from mmif import DocumentTypes, AnnotationTypes
from clams.appmetadata import AppMetadata
from clams.app import ClamsApp
# DO NOT CHANGE the function name
def appmetadata() -> AppMetadata:
metadata = AppMetadata(
name="Slate Detection",
description="This tool detects slates.",
app_license="MIT",
identifier="slatedetection",
url="https://github.com/clamsproject/app-slatedetection",
)
metadata.add_input(DocumentTypes.VideoDocument)
metadata.add_output(AnnotationTypes.TimeFrame, properties={"frameType": "slate"})
metadata.add_parameter(name="timeUnit",
description="Unit of time to use in output.",
type="string",
choices=["frames", "seconds", "milliseconds"],
default="frames")
metadata.add_parameter(name="sampleRatio",
description="Frequency to sample frames.",
type="integer",
default=30) # ~1 frame per second
metadata.add_parameter(name="stopAt",
description="Frame number to stop processing",
type="integer",
default=5*60*30) # ~5 minutes of video at 30fps
metadata.add_parameter(name="stopAfterOne",
description="When True, processing stops after first timeframe is found",
type="boolean",
default=True)
metadata.add_parameter(name="minFrameCount",
description="Minimum number of frames required for a timeframe to be included in the output",
type="integer",
default=10)
metadata.add_parameter(name="threshold",
description="Threshold from 0-1, lower accepts more potential slates.",
type="number",
default=0.7)
return metadata
# DO NOT CHANGE the main block
if __name__ == '__main__':
import sys
metadata = appmetadata()
for param in ClamsApp.universal_parameters:
metadata.add_parameter(**param)
sys.stdout.write(metadata.jsonify(pretty=True))