コード例 #1
0
def _rename_losses_effdet(loss):
    loss["effdet_total_loss"] = loss["loss"]
    _ = loss.pop("loss", None)
    return loss


def _sum_losses_effdet(loss):
    _loss = loss.copy()
    _ = _loss.pop("effdet_total_loss", None)
    loss["loss_total"] = sum(_loss.values())
    return loss


_LOSSES_DICT = {
    "effdet_total_loss": [],
    "class_loss": [],
    "box_loss": [],
    "loss_total": [],
}

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

interp._rename_losses = _rename_losses_effdet
interp._sum_losses = _sum_losses_effdet
コード例 #2
0
    device: Optional[torch.device] = None,
) -> None:
    return base_show_results(
        predict_fn=predict,
        model=model,
        dataset=dataset,
        num_samples=num_samples,
        ncols=ncols,
        denormalize_fn=denormalize_fn,
        show=show,
        detection_threshold=detection_threshold,
        device=device,
    )


_LOSSES_DICT = {
    "loss_classifier": [],
    "loss_box_reg": [],
    "loss_objectness": [],
    "loss_rpn_box_reg": [],
    "loss_keypoint": [],
    "loss_total": [],
}

interp = Interpretation(
    losses_dict=_LOSSES_DICT,
    valid_dl=valid_dl,
    infer_dl=infer_dl,
    predict_from_dl=predict_from_dl,
)
コード例 #3
0
ファイル: __init__.py プロジェクト: sasakits/icevision
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_centerness": [],
    "loss_cls": [],
    "loss_bbox": [],
    "loss_total": [],
}

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

interp._loop = loop_mmdet