MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.25k stars 21.42k forks source link

Step 4: Upload Images Error #7325

Closed deldersveld closed 5 years ago

deldersveld commented 6 years ago

For Step 4 with Python 3.6 hosted in Azure Notebooks, I got the following error: "TypeError: init() takes 1 positional argument but 3 were given" I had to change ImageUrlCreateEntry(image_url, [ hemlock_tag.id ] ) to ImageUrlCreateEntry(url=image_url, tag_ids=[ hemlock_tag.id ]) to get the code to work.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

deldersveld commented 6 years ago

Hemlock works from the sample below, but Cherry does not. Positional args did not work in 3.6. image

YutongTie-MSFT commented 6 years ago

@deldersveld Thanks for the feedback! We are currently investigating and will update you shortly.

YutongTie-MSFT commented 6 years ago

@deldersveld Thanks for the feedback! I have assigned the issue to the content author to investigate further and update the document as appropriate.

@areddish Hi, this is a issue about the format of parameters, the user has given a comparison. Can you please check it and update the document as necessary? Thanks a lot.

Farhad-Heybati commented 6 years ago

I get the same error than the one reported:

Adding images...


TypeError Traceback (most recent call last)

in () 4 for image_num in range(1,10): 5 image_url = base_image_url + "Images/Hemlock/hemlock_{}.jpg".format(image_num) ----> 6 trainer.create_images_from_urls(project.id, [ ImageUrlCreateEntry(image_url, [ hemlock_tag.id ] ) ]) 7 8 for image_num in range(1,10): TypeError: __init__() takes 1 positional argument but 3 were given
petermc129 commented 6 years ago

I get the following error when attempting to use images that are stored locally (hitting the github repo works fine). I am using python 2.7.12. I assume the fsencode function does not exist in the os module.

Traceback (most recent call last): File "c:/..../Computer Vision/MSFT CV Tutorial/sample.py", line 35, in for image in os.listdir(os.fsencode("Images\Hemlock")): AttributeError: 'module' object has no attribute 'fsencode'

areddish commented 5 years ago

@YutongTie-MSFT This can be closed as the article was updated to include the argument names.

tchristiani commented 5 years ago

please-close

YutongTie-MSFT commented 5 years ago

@deldersveld We will now proceed to close this thread. If there are further questions regarding this matter, please respond here and @YutongTie-MSFT and we will gladly continue the discussion.

GKarmakar commented 5 years ago

@YutongTie-MSFT There is a problem loading images as seen below. It says "bad request" although keys are correct. (azmlenv) Trinas-Air:~ trinakarmakar$ python sampleCustomCVision.py Creating project... 3f67dfe9-bc7d-49c8-8ca0-2b3a3b2cc39f Adding images... Traceback (most recent call last): File "sampleCustomCVision.py", line 26, in trainer.create_images_from_urls(project.id, [ ImageUrlCreateEntry(url=image_url, tag_ids=[ hemlock_tag.id ] ) ]) File "/anaconda3/envs/azmlenv/lib/python3.5/site-packages/azure/cognitiveservices/vision/customvision/training/custom_vision_training_client.py", line 1018, in create_images_from_urls raise HttpOperationError(self._deserialize, response) msrest.exceptions.HttpOperationError: Operation returned an invalid status code 'Bad Request'

mbouskila commented 5 years ago

@YutongTie-MSFT: Exception has occurred: msrest.exceptions.HttpOperationError line 40 : .. 37 import time

39 print ("Training...") 40 iteration = trainer.train_project(project.id)

Why this kind of error i din't change the script, execept for the input where I am reading images directly from gitHub : base_image_url = "https://github.com/Azure-Samples/cognitive-services-python-sdk-samples/tree/master/samples/vision/"