Great to hear  Don’t forget to mark a reply as a correction answer in case other people are searching for a solution too!
Also: If you are wanting to go from tensor to numpy directly (and skip the PIL Image conversion part), that may be a good idea in terms of runtime. I’d imagine doing this for a bunch of images may be quite slow! I tried looking around for a bit and not sure what the exact cause of this error was

image790×92 46.8 KB

It may have to do with something with the datatype (i.e. numpy's uint8 from image_orig versus image_clone's datatype that comes from tensor_image.numpy(). I tried converting image_clone to be of numpy's uint8 via (image_clone*255).astype(np.uint8), but got the same error when trying to draw rectangles, very weird. Additionally tried doing (tensor_image*255).long().numpy() so it’s already in a non-float format (and between 0-255) but no luck. There must be some other states of these numpy variables behind-the-scenes perhaps.