Hi,
I’m sorry probably a stupid question. I want to make a databunch for bounding box regression. I’m able to make the ImageBBox. However I can not find how to use these to get a labeled databunch.
I tried a lot of variations of:
dataDir = "./coco"
dataType = "val2017"
annFile = "{}/instances_{}.json".format(dataDir, dataType)
coco = COCOHumanBBoxDataset(annFile)
labels = {}
imgs = []
for id in coco.coco.getImgIds()[:12]:
path, bbox = coco.get_one_pic_w_bb(id)
imgs.append({"filename": path})
labels[path.name] = bbox
name = Path(path).name
DATASET = pd.DataFrame.from_dict(imgs)
def get_y_func(pathStr):
name = Path(pathStr).name
return labels[name] # ImageBBox class
data = (
Data.ObjectItemList.from_df(
df=DATASET, path=Path("/home/tako/devtools/furry-geras")
)
.random_split_by_pct()
.label_from_func(get_y_func)
.transform(Transform.get_transforms(), tfm_y=True, size=(224, 224))
.databunch()
)
An example using the ImageBBox class would be useful.