MicrosoftDocs / azure-docs

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

Bug: uploading multiple images in one batch #11501

Closed CaronteDemonio closed 6 years ago

CaronteDemonio commented 6 years ago

Hi, I think there might be a bug when you try to upload multiple images at once. I created a sample code https://github.com/CaronteDemonio/CustomVisionAPI to upload multiple images in one batch. BTW, this might be considered for the public sample repository as there is currently no sample on how to upload multiple images. If you change the constant MAX_IMAGES to a number greater than 30 you have an error. The current documentation say the limit should be 64 and I think this is not correct.


Document Details

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

YutongTie-MSFT commented 6 years ago

@CaronteDemonio 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 doc-bug issue, can you please check the limitation of constant MAX_IMAGES and update the document as necessary? Thanks a lot!

YutongTie-MSFT commented 6 years ago

@areddish Hi, I want to check if there any update for this issue? Thanks a lot!

ewyuanzhang commented 6 years ago

It looks like a misunderstanding. The doc string says "There is a limit of 64 images and 20 tags". I think the function trainer.create_images_from_files is going to tag each image (<=64) with all the tags (<=20) in tag_ids, instead of tagging each image with the corresponding items in the tag_ids. For intuition, the graphic portal tags uploaded images like this.

areddish commented 6 years ago

@CaronteDemonio

The limit you are hitting is the maximum number of tags. The documentation is for older version of the APIs that have a limit of 20, we have recently raised it to 30.

Looking at the code you referenced, the problem is that the for loop that is iterating over the images is also adding the same up_tag to the list_of_tags array every iteration of the loop. So when you hit image #31 then the list_of_tags array will have 31 up_tag's in it and our API will see >30 tags and return the error.

I'd suggest instead when you make the call to create_images_from_files you just pass tag_ids = [ up_tag.id ]. Alternatively, you could create list_of_tags = [ up_tag.id ] outside of the loop and remove the appending of the tag to the list in the loop.

YutongTie-MSFT commented 6 years ago

@areddish Thanks a lot.

@CaronteDemonio 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.