-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmetadata.py
68 lines (60 loc) · 2.52 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
65
66
67
68
"""
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.app import ClamsApp
from clams.appmetadata import AppMetadata
# DO NOT CHANGE the function name
def appmetadata() -> AppMetadata:
metadata = AppMetadata(
name="EAST Text Detection",
description="OpenCV-based text localization app that used EAST text detection model. Please visit the source code repository for full documentation.",
app_license="Apache 2.0",
identifier="east-textdetection",
url="https://github.com/clamsproject/app-east-textdetection",
)
metadata.add_input_oneof(DocumentTypes.VideoDocument, DocumentTypes.ImageDocument)
metadata.add_input(AnnotationTypes.TimeFrame, required=False)
metadata.add_output(AnnotationTypes.BoundingBox, label="text")
metadata.add_parameter(
name="timeUnit",
type="string",
choices=["frames", "seconds", "milliseconds"],
default="frames",
description="Unit for time points in the output. Only works with VideoDocument input.",
)
metadata.add_parameter(
name="frameType",
type="string",
choices=["", "slate", "chyron", "rolling-credit"],
default="",
multivalued=True,
description="Segments of video to run on. Only works with VideoDocument input and TimeFrame input. Empty value means run on the every frame types.",
)
metadata.add_parameter(
name="sampleRate",
type="integer",
default=30,
description="Frequency to sample frames. Only works with VideoDocument input, and without TimeFrame input. (when `TimeFrame` annotation is found, this parameter is ignored.)",
)
metadata.add_parameter(
name="stopAt",
type="integer",
default=2 * 60 * 60 * 30, # ~2 hours of video at 30fps 1 * 60 * 60 * 30
description="Frame number to stop running. Only works with VideoDocument input. The default is roughly 2 hours of video at 30fps.",
)
metadata.add_parameter(
name="mergeBoxes",
type="boolean",
default=False,
description="if True, creates a single merged bounding box from all detected boxes."
)
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))