首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Google Colab中使用Google AI进行人物检测

在Google Colab中使用Google AI进行人物检测
EN

Stack Overflow用户
提问于 2021-01-26 06:14:41
回答 1查看 77关注 0票数 1
代码语言:javascript
复制
def detect_person(input_uri, output_uri):
    """Detects people in a video."""

    client = videointelligence.VideoIntelligenceServiceClient(credentials=service_account.Credentials.from_service_account_file(
    './key.json'))

    # Configure the request
    config = videointelligence.types.PersonDetectionConfig(
        include_bounding_boxes=True,
        include_attributes=True,
        include_pose_landmarks=True,
    )
    context = videointelligence.types.VideoContext(person_detection_config=config)

    # Start the asynchronous request
    operation = client.annotate_video(
        input_uri=input_uri,
        output_uri=output_uri,
        features=[videointelligence.enums.Feature.PERSON_DETECTION],
        video_context=context,
    )

    return operation

然后我在运行时得到一个错误:

代码语言:javascript
复制
operation = detect_person(input_uri, output_uri)

错误:枚举:模块'google.cloud.videointelligence_v1p3beta1‘没有属性’AttributeError‘。尝试在Google API中使用人员检测,但我收到此错误?

由于某些原因,当我尝试在Google Colab中运行第一个代码时,什么也没有发生。我对此非常陌生,所以我不确定我还能做什么。非常感谢!我正在尝试按照这个教程来创建我自己的乒乓球射击检测。https://github.com/google/making_with_ml/blob/master/sports_ai/Sports_AI_Analysis.ipynb

EN

回答 1

Stack Overflow用户

发布于 2021-03-25 00:55:44

在运行代码之前导入枚举。

代码语言:javascript
复制
from google.cloud import videointelligence
from google.cloud.videointelligence import enums, types
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65893158

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档