【问题标题】:Using person detection in Google Colab using Google AI使用 Google AI 在 Google Colab 中使用人员检测
【发布时间】:2021-04-29 18:05:14
【问题描述】:
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

然后在运行时出现错误:

operation = detect_person(input_uri, output_uri)

错误:AttributeError:模块“google.cloud.videointelligence_v1p3beta1”没有属性“枚举”。尝试在 Google API 中使用人员检测但出现此错误?

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

【问题讨论】:

    标签: python-3.x google-colaboratory


    【解决方案1】:

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

    from google.cloud import videointelligence
    from google.cloud.videointelligence import enums, types
    

    【讨论】:

      猜你喜欢
      • 2020-11-29
      • 2021-02-17
      • 2020-03-31
      • 2017-07-30
      • 2021-11-10
      • 2021-12-15
      • 2021-02-20
      • 2021-05-03
      • 1970-01-01
      相关资源
      最近更新 更多