Search code examples
tensorflowjupyter-notebookobject-detectionobject-detection-api

Can I save the output images of TensorFlow Objectdetection API in a folder?


I am new to object detection. Can I save the output images of my tensorflow object detection API in a folder after detection is completed in the Jupyter notebook?

It was intuitive to right click and save the images when detecting a few images, but it is impractical to do same when I have over 1000 images to run detection on.

is the output already stored in a subfolder that I am unaware of?? Can I store the output in a folder or directory?

Any suggestions will be appreciated. I have checked differnt means but found nothing helpful

this is what my detection cell looks like enter image description here Thanks


Solution

  • Use PIL you can save your image to disk. First you import the module

    from PIL import Image
    

    And then you can comment out the plot lines, add the save lines.

    #plt.figure(figsize=IMAGE_SIZE)
    #plt.imshow(image_np)
    #save to same folder as data input
    img = Image.fromarray(image_np)
    img.save(image_path[:-4]+'output_'+'.png')