Here is my code snippet:
from detectron2.utils.visualizer import ColorMode
from detectron2.structures import pairwise_iou
import random
import numpy
from numpy import savetxt
dataset_dicts = DatasetCatalog.get('/content/scaphoid/test')
for d in random.sample(dataset_dicts,20):
im = cv2.imread(d["file_name"])
outputs = predictor(im)
v = Visualizer(im[:, :, ::-1], metadata=microcontroller_metadata, scale=0.8)
v = v.draw_instance_predictions(outputs["instances"].to("cpu"))
bb2 =(outputs["instances"].get_fields()["pred_boxes"].tensor.to("cpu").numpy())
#numpy.savetxt("/content/output/bb2.csv",bb2, delimiter=',', header="xmin,ymin,xmax,ymax", comments="")
I want to store bb2 np array into a csv file. I tried using the commented statement but this only saves last value of bb2 and not all the values How can I do it? Can any one please help