Closed
Description
- Package Name: azure-cognitiveservices-vision-customvision
- Package Version: 3.0.0
- Operating System: Ubuntu 18.04
- Python Version: 3.6.9
Describe the bug
I tried to follow https://docs.microsoft.com/en-us/azure/cognitive-services/custom-vision-service/quickstarts/object-detection?pivots=programming-language-python to upload my image to the project.
I got this error
msrest.exceptions.SerializationError: Unable to build a model: Unable to deserialize to object: type, AttributeError: 'ImageFileCreateEntry' object has no attribute 'lower', DeserializationError: Unable to deserialize to object: type, AttributeError: 'ImageFileCreateEntry' object has no attribute 'lower'
code snippet
credentials = ApiKeyCredentials(in_headers={"Training-key": training_key})
trainer = CustomVisionTrainingClient(endpoint=ENDPOINT, credentials=credentials)
for fol in tqdm(os.listdir(base_path)):
savepath = os.path.join(base_path,fol)
allfiles = os.listdir(savepath)
image_list = list()
for fname in random.sample(allfiles,5):
with open(os.path.join(savepath,fname), "rb") as image_contents:
image_list.append(ImageFileCreateEntry(name=fname, contents=image_contents.read()))
upload_result = trainer.create_images_from_files(project_id, image_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment