Search code examples
pythonazureazure-functionsazure-cognitive-services

Custom vision upload multiple images in the same time


Trying to upload multiple TRAINING images with custom vision SDK

for i in range(0,len(split_input)):
        img_byte=connection_blob(confidential)   #first I download images from my blob with a custom function, images names are in list split_input

        image_list.append(ImageFileCreateEntry(name=split_input[i], contents=img_byte, tag_ids=[hemlock_tag]))   #Then I create the list of images


for i in range(0,len(image_list)):
        upload_result = trainer.create_images_from_files(model_id, images=[image_list[i]],raw=True) #I push data on custom vision

My problem is sometimes it goes wrong and only some images are send. For exemple I'm trying to send 20 pictures and only 10 are sended...

Any idea of where to look to try to fix the problem?

Edit: Even when I try to send images 1 by 1, they are not uploaded


Solution

  • I might have found the solution. Image are taken from a powerApps, and to make my test I was taking picture very fast. Some picture where strictly identical = custom vision only accept one version of the images.

    You can check upload status with:

    for i in range(0,len(image_list)):
            upload_result = trainer.create_images_from_files(model_id, images=[image_list[i]],raw=True)
            res_upload_img=upload_result.output.images
            id_list.append(res_upload_img[0].image.id)  #Get ID of uploaded image so u can track them on custom vision
            img_status.append(res_upload_img[0].status)  #return status i.e for example "Ok" or "OkDuplicated" if images was already existing