Exemple #1
0
from icevision.models.mmdet.models.vfnet import backbones
from icevision.models.mmdet.common.bbox.single_stage import *
from icevision.models.interpretation import Interpretation, _move_to_device
from icevision.models.mmdet.common.interpretation_utils import (
    sum_losses_mmdet,
    loop_mmdet,
)

_LOSSES_DICT = {
    "loss_cls": [],
    "loss_bbox": [],
    "loss_total": [],
}

interp = Interpretation(
    losses_dict=_LOSSES_DICT,
    valid_dl=valid_dl,
    infer_dl=infer_dl,
    predict_from_dl=predict_from_dl,
)

interp._loop = loop_mmdet
Exemple #2
0
            loss = compute_loss(preds, y)[0]
            loss = {
                "loss_yolo": float(loss.cpu().numpy()),
                "loss_total": float(loss.cpu().numpy()),
            }

            for l in losses_stats.keys():
                losses_stats[l].append(loss[l])

            loss_comp = LossesRecordComponent()
            loss_comp.set_losses(loss)
            sample[0].add_component(loss_comp)
            sample[0].set_img(tensor_to_image(x[0]))
            samples_plus_losses.append(sample[0])
    return samples_plus_losses, losses_stats


_LOSSES_DICT = {
    "loss_yolo": [],
    "loss_total": [],
}

interp = Interpretation(
    losses_dict=_LOSSES_DICT,
    valid_dl=valid_dl,
    infer_dl=infer_dl,
    predict_from_dl=predict_from_dl,
)

interp._loop = loop_yolo
Exemple #3
0
                "loss_unet": float(loss.cpu().numpy()),
                "loss_total": float(loss.cpu().numpy()),
            }

            for l in losses_stats.keys():
                losses_stats[l].append(loss[l])

            loss_comp = LossesRecordComponent()
            loss_comp.set_losses(loss)
            sample[0].add_component(loss_comp)
            sample[0].set_img(tensor_to_image(x[0]))
            sample[0].segmentation.set_mask_array(
                MaskArray(y[0].detach().cpu().numpy()))
            samples_plus_losses.append(sample[0])
    return samples_plus_losses, losses_stats


_LOSSES_DICT = {
    "loss_unet": [],
    "loss_total": [],
}

interp = Interpretation(
    losses_dict=_LOSSES_DICT,
    valid_dl=valid_dl,
    infer_dl=infer_dl,
    predict_from_dl=predict_from_dl,
)

interp._loop = loop_unet