Object detection using fastai

Object detection using fastai Hello,

I am looking to create a fast ai object detection model on the deep fashion dataset but do not know how make it predict. How can I make my model output prediction on images. Here is the code:

The data is loaded using the COCO format as a json. Then I create the model and run the training like this:


def get_train_imgs(noop): return imgs



datablock = DataBlock(blocks=(ImageBlock, BBoxBlock, BBoxLblBlock),

splitter=RandomSplitter(),

get_items=get_train_imgs,

getters=getters,

item_tfms=item_tfms,

batch_tfms=batch_tfms,

n_inp=1)



model = resnet34()

encoder = create_body(model, pretrained=False)

get_c(dls)

%cd "Practical-Deep-Learning-for-Coders-2.0/Computer Vision"

from imports import *

arch = RetinaNet(encoder, get_c(dls), final_bias=-4)

create_head(124, 4)

arch.smoothers

arch.classifier

arch.box_regressor

ratios = [1/2,1,2]

scales = [1,2**(-1/3), 2**(-2/3)]

crit = RetinaNetFocalLoss(scales=scales, ratios=ratios)

def _retinanet_split(m): return L(m.encoder,nn.Sequential(m.c5top6, m.p6top7, m.merges, m.smoothers, m.classifier, m.box_regressor)).map(params)

learn = Learner(dls, arch, loss_func=crit, splitter=_retinanet_split)

learn.freeze()

learn.fit_one_cycle(2, slice(1e-5, 1e-4))

from fastai.vision.core import PILImage

image = PILImage.create('./000032.jpg')

prediction, _, _ = learn.predict(image)

predict is outputing the following error: TypeError: clip_remove_empty() missing 2 required positional arguments: ‘bbox’ and ‘label’

I understand that I am not suppose to use .predict but I cant find any reference on what else to use.