common
model
icevision.models.efficientdet.model.model(model_name, num_classes, img_size, pretrained=True)
Creates the efficientdet model specified by model_name
.
The model implementation is by Ross Wightman, original repo here.
Arguments
- model_name
str
: Specifies the model to create. For pretrained models, check this table. - num_classes
int
: Number of classes of your dataset (including background). - img_size
int
: Image size that will be fed to the model. Must be squared and divisible by 128. - pretrained
bool
: If True, use a pretrained backbone (on COCO).
Returns
A PyTorch model.
train_dl
icevision.models.efficientdet.dataloaders.train_dl(dataset, batch_tfms=None, **dataloader_kwargs)
A DataLoader
with a custom collate_fn
that batches items as required for training the model.
Arguments
- dataset: Possibly a
Dataset
object, but more generally, anySequence
that returns records. - batch_tfms: Transforms to be applied at the batch level.
- **dataloader_kwargs: Keyword arguments that will be internally passed to a Pytorch
DataLoader
. The parametercollate_fn
is already defined internally and cannot be passed here.
Returns
A Pytorch DataLoader
.
valid_dl
icevision.models.efficientdet.dataloaders.valid_dl(dataset, batch_tfms=None, **dataloader_kwargs)
A DataLoader
with a custom collate_fn
that batches items as required for validating the model.
Arguments
- dataset: Possibly a
Dataset
object, but more generally, anySequence
that returns records. - batch_tfms: Transforms to be applied at the batch level.
- **dataloader_kwargs: Keyword arguments that will be internally passed to a Pytorch
DataLoader
. The parametercollate_fn
is already defined internally and cannot be passed here.
Returns
A Pytorch DataLoader
.
infer_dl
icevision.models.efficientdet.dataloaders.infer_dl(dataset, batch_tfms=None, **dataloader_kwargs)
A DataLoader
with a custom collate_fn
that batches items as required for inferring the model.
Arguments
- dataset: Possibly a
Dataset
object, but more generally, anySequence
that returns records. - batch_tfms: Transforms to be applied at the batch level.
- **dataloader_kwargs: Keyword arguments that will be internally passed to a Pytorch
DataLoader
. The parametercollate_fn
is already defined internally and cannot be passed here.
Returns
A Pytorch DataLoader
.
build_train_batch
icevision.models.efficientdet.dataloaders.build_train_batch(records, batch_tfms=None)
Builds a batch in the format required by the model when training.
Arguments
- records: A
Sequence
of records. - batch_tfms: Transforms to be applied at the batch level.
Returns
A tuple with two items. The first will be a tuple like (images, targets)
,
in the input format required by the model. The second will be an updated list
of the input records with batch_tfms
applied.
Examples
Use the result of this function to feed the model.
batch, records = build_train_batch(records)
outs = model(*batch)
build_valid_batch
icevision.models.efficientdet.dataloaders.build_valid_batch(records, batch_tfms=None)
Builds a batch in the format required by the model when validating.
Arguments
- records: A
Sequence
of records. - batch_tfms: Transforms to be applied at the batch level.
Returns
A tuple with two items. The first will be a tuple like (images, targets)
,
in the input format required by the model. The second will be an updated list
of the input records with batch_tfms
applied.
Examples
Use the result of this function to feed the model.
batch, records = build_valid_batch(records)
outs = model(*batch)
build_infer_batch
icevision.models.efficientdet.dataloaders.build_infer_batch(dataset, batch_tfms=None)
Builds a batch in the format required by the model when doing inference.
Arguments
- records: A
Sequence
of records. - batch_tfms: Transforms to be applied at the batch level.
Returns
A tuple with two items. The first will be a tuple like (images, targets)
,
in the input format required by the model. The second will be an updated list
of the input records with batch_tfms
applied. # Examples
Use the result of this function to feed the model.
batch, records = build_infer_batch(records)
outs = model(*batch)