Bounding box detection
PyTorch

This repository contains code that you can use to train or load Faster R-CNN models in half mode easily.

Below is an example of how to load pretrained weights in half mode.

import numpy as np
from PIL import Image

from frcnn.visualizing_image import SingleImageViz
from frcnn.processing_image import Preprocess
from frcnn.modeling_frcnn import GeneralizedRCNN
from frcnn.utils import Config

max_detections = 36
frcnn_config = json.load(open("frcnn/config.jsonl"))
frcnn_config = Config(frcnn_config)
image_preprocessor= Preprocess(frcnn_config).half().cuda()
box_segmentation_model= GeneralizedRCNN.from_pretrained("unc-nlp/frcnn-vg-finetuned", frcnn_config).half().cuda()
    
img_url = 'image.png' 
raw_image = Image.open(img_url).convert('RGB')
frcnn_output = decode_image(np.asarray(raw_image),  box_segmentation_model, image_preprocessor, max_detections=max_detections)
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API: The model has no library tag.