Bounding box detection
PyTorch
File size: 678 Bytes
bf40459
 
 
8c2dd5d
 
4a75742
 
 
 
8c2dd5d
 
 
4a75742
 
 
 
8c2dd5d
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
---
license: apache-2.0
---
```

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(asarray(raw_image),  frcnn, image_preprocessor, max_detections=max_detections)

```