本文整理汇总了Python中timeline.Timeline.copy方法的典型用法代码示例。如果您正苦于以下问题:Python Timeline.copy方法的具体用法?Python Timeline.copy怎么用?Python Timeline.copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类timeline.Timeline
的用法示例。
在下文中一共展示了Timeline.copy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Annotation
# 需要导入模块: from timeline import Timeline [as 别名]
# 或者: from timeline.Timeline import copy [as 别名]
class Annotation(object):
"""
Annotated timeline.
An annotation is
Parameters
----------
multitrack : bool, optional
whether a segment can contain multiple track (True) or not (False).
Default is True (multi-track annotation).
modality : string, optional
name of annotated modality
video : string, optional
name of (audio or video) annotated document
Returns
-------
annotation : Annotation
New empty annotation
Examples
--------
>>> annotation = Annotation(video='MyVideo')
>>> print annotation.video
MyVideo
"""
def __init__(self, multitrack=True, video=None, modality=None):
super(Annotation, self).__init__()
# whether a segment can contain multiple track (True) or not (False)
self.__multitrack = multitrack
# name of annotated modality
self.__modality = modality
# path to (or any identifier of) segmented video
self.__video = video
# this timeline is meant to store annotated segments.
# it only contains segments with at least one labelled track.
# a segment that is no longer annotated must be removed from it.
self.__timeline = Timeline(video=self.video)
# this is where tracks and labels are actually stored.
# it is a dictionary indexed by segments.
# .__data[segment] is a dictionary indexed by tracks.
# .__data[segment][track] contains the actual label.
self.__data = {}
# this is a dictionary indexed by labels.
# .__label_timeline[label] is a timeline made of segments for which
# there exists at least one track labelled by label.
# when a label no longer exists, its entry must be removed.
self.__label_timeline = {}
# this is a dictionary indexed by labels
# .__label_count[label] is a dictionary indexed by segments containing
# at least one track labelled by label.
# .__label_count[label][segment] contains the number of tracks labelled
# as label in this segment. when zero, segment entry must be removed.
self.__label_count = {}
def __get_multitrack(self):
return self.__multitrack
multitrack = property(fget=__get_multitrack)
"""Can segments contain multiple tracks?"""
def __get_video(self):
return self.__video
video = property(fget=__get_video)
"""Path to (or any identifier of) annotated video
Examples
--------
>>> annotation = Annotation(video="MyVideo.avi")
>>> print annotation.video
MyVideo.avi
"""
def __get_modality(self):
return self.__modality
modality = property(fget=__get_modality)
"""Name (or any identifier) of annotated modality
Examples
--------
>>> annotation = Annotation(modality="speaker")
>>> print annotation.modality
speaker
"""
def __get_timeline(self):
return self.__timeline.copy()
timeline = property(fget=__get_timeline)
"""Timeline made of every annotated segments
#.........这里部分代码省略.........