BBoxLblBlock: BBoxLblBlock

View source: R/vision_data.R

BBoxLblBlockR Documentation

BBoxLblBlock

Description

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

Usage

BBoxLblBlock(vocab = NULL, add_na = TRUE)

Arguments

vocab

vocabulary

add_na

add NA

Value

None'

Examples


## 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 June 22, 2024, 11:15 a.m.