tensorflow/models · error · ValueError
Not supported loss mode: {loss_mode}
Error message
Not supported loss mode: {loss_mode} What it means
Error "Not supported loss mode: {loss_mode}" thrown in tensorflow/models.
Source
Thrown at official/projects/unified_detector/modeling/universal_detector.py:855
tf.reduce_sum(pointwise_loss * pos_mask) /
(tf.reduce_sum(pos_mask) + EPSILON))
# neg
neg_mask = gt_affinity_mask * (1. - gt_affinity[:, 0])
neg_loss = (
tf.reduce_sum(pointwise_loss * neg_mask) /
(tf.reduce_sum(neg_mask) + EPSILON))
loss = 0.25 * pos_loss + 0.75 * neg_loss
elif loss_mode == "focal":
alpha_wt = fl_alpha * gt_affinity + (1. - fl_alpha) * (1. - gt_affinity)
prob_pos = tf.math.sigmoid(affinity / tau)
pt = prob_pos * gt_affinity + (1. - prob_pos) * (1. - gt_affinity)
fl_loss_pw = tf.stop_gradient(
alpha_wt * tf.pow(1. - pt, fl_gamma))[:, 0] * pointwise_loss
loss = (
tf.reduce_sum(fl_loss_pw * gt_affinity_mask) /
(tf.reduce_sum(gt_affinity_mask) + EPSILON))
else:
raise ValueError(f"Not supported loss mode: {loss_mode}")
loss_dict["loss_para"] = loss
def _mask_id_xent_loss(loss_dict: Dict[str, Any], labels: Dict[str, Any],
outputs: Dict[str, Any]):
"""Mask ID loss.
This method adds the mask ID loss term to loss_dict directly.
Args:
loss_dict: A dictionary for the loss. The values are loss scalars.
labels: The label dictionary.
outputs: The output dictionary.
"""
# (B, N, H, W)
mask_gt = labels["masks"]
# B, H, W, NView on GitHub (pinned to e006f5f0d5)
When it happens
Trigger: Thrown at official/projects/unified_detector/modeling/universal_detector.py:855 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/f6397b146ce1d757.
Report an issue: GitHub.