我在this tutorial之后使用Exploface,除了第四点没有问题:“使用Exploface编写Elan文件”。

本教程提供了此内容:

dataframe_timestamp = exploface.write_elan_file(
    feature_detections,
    video_path=video_file,
    output_path="video.eaf",
)


我正在尝试的是:

dataframe_timestamp = exploface.write_elan_file(
    'frame',
    'timestamp',
    'confidence',
    video_path=video_file,
    output_path="C:\\Users\\fullname\\Desktop",
)


还尝试了:

dataframe_timestamp = exploface.write_elan_file(
    'frame',
    'timestamp',
    'confidence',
    video_path=video_file,
    output_path="C:\\Users\\fullname\\Desktop\\output.eaf",
)


而且我还尝试将其指向原始视频

dataframe_timestamp = exploface.write_elan_file(
    'frame',
    'timestamp',
    'confidence',
    video_path="C:\\Users\\fullname\\Desktop\\originalvideo.mp4",
    output_path="C:\\Users\\fullname\\Desktop\\output.eaf",
)


应该创建elan文件,但给出以下错误消息:

File "<stdin>", line 3, in <module>
TypeError: write_elan_file() got multiple values for argument
'video_path'

最佳答案

我检查了Exploface存储库,并定义了write_elan_file函数,如下所示。

# exploface/__init__.py

def write_elan_file(detections,
                    output_path=None,
                    video_path=None,
                    #column_selection = None,
                    ):
    """
    Generates an Elan file for the detections

    """
    elanwriter.write_elan_file(detections, video_path, output_path,
        feature_col_name = _FEAT_NAME_ID)


由于向函数传递了太多参数,该函数仅接受3,因此产生了您的问题,导致了错误。

08-07 16:40