Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/351.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python AutoML Vision元数据问题_Python_Google Cloud Platform_Google Cloud Automl - Fatal编程技术网

Python AutoML Vision元数据问题

Python AutoML Vision元数据问题,python,google-cloud-platform,google-cloud-automl,Python,Google Cloud Platform,Google Cloud Automl,我正在尝试使用RASPI3B+和AutoML Vision来训练分类模型。但是,当我尝试在Google云平台上创建数据集时,遇到了如下问题: Traceback (most recent call last): File "/home/pi/.local/lib/python3.7/site-packages/google/api core/grpc helpers.py", line 57, in error remapped callable return callabl

我正在尝试使用RASPI3B+和AutoML Vision来训练分类模型。但是,当我尝试在Google云平台上创建数据集时,遇到了如下问题:

Traceback (most recent call last):
File "/home/pi/.local/lib/python3.7/site-packages/google/api core/grpc helpers.py", line 57, in error remapped callable
return callable (*args, **kwargs)
File "/home/pi/.local/lib/python3.7/site-packages/grpc/ channel.py", line 826, in call __
return end_unary_response blocking({state, call, False, None)
File "/home/pi/.local/lib/python3.7/site-packages/grpc/ channel.py", line 729, in end unary response blocking
raise InactiveRpcError(state)
grpc. channel. InactiveRpcError: < InactiveRpcError of RPC that terminated with:
status = StatusCode. INVALID ARGUMENT
details = "List of found errors: 1.Field: parent; Message: Required field is invalid "
debug error string = "{"created":"G1604833054.567218256", "description":"Error received from peer ipv6: [2a00:1450:400a: 801: :200a] :443","file":"src/core/lib/surface/call.cc","file line":1056,"grpc_message":"List of found
errors:\tl.Field: parent; Nessage: Required field is invalid\t","grpc_ status":3}"
>

有人知道这里发生了什么吗?

您正在使用哪个区域?请注意,对于此功能,当前项目资源必须位于美国中部地区才能使用此API[1]

错误提示是一个无效的论点,因此我不认为上面提到的是问题。查看有关创建数据集[1]的GCP文档,我发现您的代码与在该示例上执行的代码不同。元数据和配置是以不同的方式设置的。请尝试使用与共享示例中相同的格式重新创建它,好吗?我认为这应该解决正在经历的问题

这里有一个代码示例:

from google.cloud import automl

# TODO(developer): Uncomment and set the following variables
# project_id = "YOUR_PROJECT_ID"
# display_name = "your_datasets_display_name"

client = automl.AutoMlClient()

# A resource that represents Google Cloud Platform location.
project_location = f"projects/{project_id}/locations/us-central1"
# Specify the classification type
# Types:
# MultiLabel: Multiple labels are allowed for one example.
# MultiClass: At most one label is allowed per example.
# https://cloud.google.com/automl/docs/reference/rpc/google.cloud.automl.v1#classificationtype
metadata = automl.ImageClassificationDatasetMetadata(
    classification_type=automl.ClassificationType.MULTILABEL
)
dataset = automl.Dataset(
    display_name=display_name,
    image_classification_dataset_metadata=metadata,
)

# Create a dataset with the dataset metadata in the region.
response = client.create_dataset(parent=project_location, dataset=dataset)

created_dataset = response.result()

# Display the dataset information
print("Dataset name: {}".format(created_dataset.name))
print("Dataset id: {}".format(created_dataset.name.split("/")[-1]))

[1]

谢谢!我在*.env文件中使用环境变量时,通过在代码中直接分配项目ID解决了这个问题。我仍然不明白为什么使用环境变量是个问题。。。