GoogleCloudPlatform / GoogleCloudPlatform/python-docs-samples

Error API Cloud Video Intelligence - Requested model could not be loaded

未關閉
#10,733 6 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
api: videointelligence priority: p2 samples type: bug
主要語言
Jupyter Notebook
星號
8.1k
分支
6.7k
平均合併
4 天 2 小時
30 天內合併 PR
16

描述

## In which file did you encounter the issue?
import io

from google.cloud import videointelligence_v1p3beta1 as videointelligence

# path = 'path_to_file'
# project_id = 'gcp_project_id'
# model_id = 'automl_classification_model_id'

client = videointelligence.StreamingVideoIntelligenceServiceClient()

model_path = "projects/{}/locations/us-central1/models/{}".format(
project_id, model_id
)

# Here we use classification as an example.
automl_config = videointelligence.StreamingAutomlClassificationConfig(
model_name=model_path
)

video_config = videointelligence.StreamingVideoConfig(
feature=videointelligence.StreamingFeature.STREAMING_AUTOML_CLASSIFICATION,
automl_classification_config=automl_config,
)

# config_request should be the first in the stream of requests.
config_request = videointelligence.StreamingAnnotateVideoRequest(
video_config=video_config
)

# Set the chunk size to 5MB (recommended less than 10MB).
chunk_size = 5 * 1024 * 1024

# Load file content.
# Note: Input videos must have supported video codecs. See
# https://cloud.google.com/video-intelligence/docs/streaming/streaming#supported_video_codecs
# for more details.
stream = []
with io.open(path, "rb") as video_file:
while True:
data = video_file.read(chunk_size)
if not data:
break
stream.append(data)

def stream_generator():
yield config_request
for chunk in stream:
yield videointelligence.StreamingAnnotateVideoRequest(input_content=chunk)

requests = stream_generator()

# streaming_annotate_video returns a generator.
# The default timeout is about 300 seconds.
# To process longer videos it should be set to
# larger than the length (in seconds) of the stream.
responses = client.streaming_annotate_video(requests, timeout=600)

for response in responses:
# Check for errors.
if response.error.message:
print(response.error.message)
break

for label in response.annotation_results.label_annotations:
for frame in label.frames:
print(
"At {:3d}s segment, {:5.1%} {}".format(
frame.time_offset.seconds,
frame.confidence,
label.entity.entity_id,
)
)

## Describe the issue
https://cloud.google.com/video-intelligence/docs/streaming/video-classification

I am conducting a series of tests on AutoML, using the code provided in the official documentation, and I am encountering an issue. After training the model with VortexAI, completing the process, and retrieving the Model ID, the Python APIs consistently return 'Requested model could not be loaded.' Honestly, the demos are poorly written, and the exceptions in the code are very implicit. Some demos don't work, and you have to make corrections in certain areas to get them to function properly.

```python
python3 ./test.py
"Requested model could not be loaded."
```

The model was specifically trained for Video Intelligence in the VortexAI section and, in turn, did not function correctly. In the documentation, it's not clear whether the model necessarily requires an Endpoint. Both the code and the documentation have a comprehension issue.

![Screen401](https://github.com/GoogleCloudPlatform/python-docs-samples/assets/28324952/eeb1b221-7443-4b8b-abe5-7ccaadf11c57)

貢獻指南

開啟貢獻指南

研究方向

先從 test.py 和連結的 Video Intelligence 串流影片分類文件開始,然後檢視 StreamingVideoIntelligenceServiceClient 範例及其模型設定。重現「Requested model could not be loaded」回應,並驗證文件中對 AutoML 模型和端點的要求。完成的標準是範例和文件清楚說明必要的設定,或修正示範的用法。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python
領域
cloud, documentation
Issue 類型
文件
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
28/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。