BBoxLblBlock: BBoxLblBlock

Description Usage Arguments Value Examples

View source: R/vision_data.R

Description

A 'TransformBlock' for labeled bounding boxes, potentially with 'vocab'

Usage

1
BBoxLblBlock(vocab = NULL, add_na = TRUE)

Arguments

vocab

vocabulary

add_na

add NA

Value

None'

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## Not run: 

URLs_COCO_TINY()

c(images, lbl_bbox) %<-% get_annotations('coco_tiny/train.json')
timg = Transform(ImageBW_create)
idx = 49
c(coco_fn,bbox) %<-% list(paste('coco_tiny/train',images[[idx]],sep = '/'),
                          lbl_bbox[[idx]])
coco_img = timg(coco_fn)

tbbox = LabeledBBox(TensorBBox(bbox[[1]]), bbox[[2]])

coco_bb = function(x) {
TensorBBox_create(bbox[[1]])
}

coco_lbl = function(x) {
  bbox[[2]]
}

coco_dsrc = Datasets(c(rep(coco_fn,10)),
                     list(Image_create(), list(coco_bb),
                          list( coco_lbl, MultiCategorize(add_na = TRUE) )
                     ), n_inp = 1)

coco_tdl = TfmdDL(coco_dsrc, bs = 9,
                  after_item = list(BBoxLabeler(), PointScaler(),
                                    ToTensor()),
                  after_batch = list(IntToFloatTensor(), aug_transforms())
)

coco_tdl %>% show_batch(dpi = 200)


## End(Not run)

fastai documentation built on July 28, 2021, 5:06 p.m.