1

I'm having issues using my own image with this code. I would like to upload my own image rather than using a predefined URL link. For example, in this notebook, we are using the following code :

URL = "https://vqa.cloudcv.org/media/test2014/COCO_test2014_000000262567.jpg"
frcnn_cfg = Config.from_pretrained("unc-nlp/frcnn-vg-finetuned")
frcnn = GeneralizedRCNN.from_pretrained("unc-nlp/frcnn-vg-finetuned", config=frcnn_cfg)
image_preprocess = Preprocess(frcnn_cfg)
images, sizes, scales_yx = image_preprocess(URL)
output_dict = frcnn(
    images,
    sizes,
    scales_yx=scales_yx,
    padding="max_detections",
    max_detections=frcnn_cfg.max_detections,
    return_tensors="pt",
)

and thus it gives us the features, but I want to implement something on the following lines:


# img (already being uploaded to google colab via local machine)

frcnn_cfg = Config.from_pretrained("unc-nlp/frcnn-vg-finetuned")
frcnn = GeneralizedRCNN.from_pretrained("unc-nlp/frcnn-vg-finetuned", config=frcnn_cfg)
image_preprocess = Preprocess(frcnn_cfg)

images, sizes, scales_yx = image_preprocess(img)

output_dict = frcnn(
    images,
    sizes,
    scales_yx=scales_yx,
    padding="max_detections",
    max_detections=frcnn_cfg.max_detections,
    return_tensors="pt",
)

Is there any way I can possibly implement it?

lazytux
  • 157
  • 5

0 Answers0