Downloads · 30 days
0
ontocord/frcnn
frcnn is a machine learning model from ontocord. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This repository contains code that you can use to train or load Faster R-CNN models in half mode easily.
Downloads · 30 days
0
Access
Public
Updated Jun 22, 2025
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py139 KB · 96%
From the Hugging Face model README
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
import json
from frcnn.visualizing_image import SingleImageViz
from frcnn.processing_image import Preprocess
from frcnn.modeling_frcnn import GeneralizedRCNN
from frcnn.utils import Config, decode_image
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)